Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
e9022b27
Commit
e9022b27
authored
3 years ago
by
Basile Desloges
Browse files
Options
Downloads
Patches
Plain Diff
[eacsl] Update Ensuresec README and root Makefile
parent
a59ba5ed
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/e-acsl/examples/ensuresec/Makefile
+26
-0
26 additions, 0 deletions
src/plugins/e-acsl/examples/ensuresec/Makefile
src/plugins/e-acsl/examples/ensuresec/README.md
+58
-3
58 additions, 3 deletions
src/plugins/e-acsl/examples/ensuresec/README.md
with
84 additions
and
3 deletions
src/plugins/e-acsl/examples/ensuresec/Makefile
0 → 100644
+
26
−
0
View file @
e9022b27
JSON_OUTPUT_DIR
=
$(
dir
$(
abspath
$(
lastword
$(
MAKEFILE_LIST
))))
json-output
PUSH_ALERTS_DIR
=
$(
dir
$(
abspath
$(
lastword
$(
MAKEFILE_LIST
))))
push-alerts
compile
:
make
-C
$(
JSON_OUTPUT_DIR
)
compile
run
:
make
-C
$(
JSON_OUTPUT_DIR
)
run
launch_receiver
:
FLASK_APP
=
$(
PUSH_ALERTS_DIR
)
/receiver.py
FLASK_ENV
=
development flask run
run_wrapped
:
compile
$(
PUSH_ALERTS_DIR
)
/wrapper.py
\
--alert-url
http://localhost:5000/alert
\
--id
EnsuresecEE
\
--tool-id
EnsuresecEE_EACSL
\
$(
JSON_OUTPUT_DIR
)
/build/ensuresec_ee.e-acsl
run_wrapped_print_all
:
make
-C
$(
JSON_OUTPUT_DIR
)
compile_print_all
$(
PUSH_ALERTS_DIR
)
/wrapper.py
\
--alert-url
http://localhost:5000/alert
\
--id
EnsuresecEE
\
--tool-id
EnsuresecEE_EACSL
\
$(
JSON_OUTPUT_DIR
)
/build/ensuresec_ee_pall.e-acsl
This diff is collapsed.
Click to expand it.
src/plugins/e-acsl/examples/ensuresec/README.md
+
58
−
3
View file @
e9022b27
...
@@ -3,9 +3,33 @@
...
@@ -3,9 +3,33 @@
This folder illustrates the developments done for the European H2020 project
This folder illustrates the developments done for the European H2020 project
Ensuresec.
Ensuresec.
## Usage
The
`Makefile`
in the root folder provides targets to launch some tests.
-
`compile`
: Compile the example in folder
`json-output`
;
-
`run`
: Run the example in folder
`json-output`
;
-
`launch_receiver`
: Launch the test server in folder
`push-alerts`
;
-
`run_wrapped`
: Run the example in folder
`json-output`
wrapped with the script
in folder
`push-alerts`
. The test server must be launched before executing
this target.
-
`run_wrapped_print_all`
: Same than
When using
`make run`
, the alerts raised by the example are saved to a JSON file
in
`./json-output/build/ensuresec_ee.json`
.
To test pushing alerts to a web API,
`make launch_receiver`
should be run in a
secondary terminal. Then
`make run_wrapped`
can be executed in the primary
terminal and alerts raised by the example should be visible on the receiver. The
target
`run_wrapped_print_all`
will also push valid assertions.
## Files
## Files
### `Makefile`
### Folder `json-output`
Custom E-ACSL assert to output alerts in a JSON file.
#### `Makefile`
The makefile in the folder provides some targets to test the ensuresec
The makefile in the folder provides some targets to test the ensuresec
developments:
developments:
...
@@ -19,7 +43,7 @@ developments:
...
@@ -19,7 +43,7 @@ developments:
-
`run_print_all`
: run the output of the
`compile_print_all`
step.
-
`run_print_all`
: run the output of the
`compile_print_all`
step.
-
`run_debug`
: run the output of the
`compile_debug`
step.
-
`run_debug`
: run the output of the
`compile_debug`
step.
### `json_assert.c`
###
#
`json_assert.c`
The file
`json_assert.c`
contains an external
`__e_acsl_assert()`
implementation
The file
`json_assert.c`
contains an external
`__e_acsl_assert()`
implementation
that will print assertion violations to a json file.
that will print assertion violations to a json file.
...
@@ -31,8 +55,39 @@ implementation:
...
@@ -31,8 +55,39 @@ implementation:
-
`ENSURESEC_EE_TOOL_ID`
: Ensuresec e-commerce ecosystem tool id
-
`ENSURESEC_EE_TOOL_ID`
: Ensuresec e-commerce ecosystem tool id
-
`ENSURESEC_OUTPUT_FILE`
: json output file
-
`ENSURESEC_OUTPUT_FILE`
: json output file
### `ensuresec_ee.c`
###
#
`ensuresec_ee.c`
Multithread program serving as an exemple Ensuresec e-commerce ecosystem
Multithread program serving as an exemple Ensuresec e-commerce ecosystem
program. The program contains
`check`
assertions that will be violated during
program. The program contains
`check`
assertions that will be violated during
its execution without halting the program.
its execution without halting the program.
### Folder `push-alerts`
Example of wrapping script to push alerts emitted by the program in
`json-output`
to a specific URL.
#### `wrapper.py`
Wrapper for an E-ACSL monitored executable that will
`POST`
each raised alert to
a specific URL. See
`./wrapper.py -h`
for how to use the script.
Python dependencies:
-
`python-dotenv`
-
`python-ijson`
-
`python-requests`
#### `.env-example`
Example
`.env`
file with environment variables read by
`wrapper.py`
.
#### `receiver.py`
Test server that listen on URL
`http://localhost:5000/alert`
for JSON emitted by
an E-ACSL monitored program and print received alerts to the console output.
Run with
`FLASK_APP=receiver.py FLASK_ENV=development flask run`
Python dependencies:
-
`python-flask`
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment