Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
b75c339c
Commit
b75c339c
authored
Nov 25, 2021
by
Maxime Perrotin
Browse files
Model checking: create a library for python interfacing
parent
0d657839
Changes
6
Hide whitespace changes
Inline
Side-by-side
test/iterators/work/simulation/Makefile
View file @
b75c339c
...
...
@@ -4,6 +4,8 @@ all: mc
mc
:
observer/my_observer.adb mcsrc/mc.adb mcsrc/properties.adb
ADA_PROJECT_PATH
=
~/.local/share/gpr:
${ADA_PROJECT_PATH}
gprbuild
-p
-P
mc
# also make a library version for python interfacing
ADA_PROJECT_PATH
=
~/.local/share/gpr:
${ADA_PROJECT_PATH}
gprbuild
-p
-P
mc_lib.gpr
observer/my_observer.adb
:
observer/observer.pr observer/observer.asn
cd
observer
&&
opengeode
--toAda
observer.pr
&&
\
...
...
test/iterators/work/simulation/mc.gpr
View file @
b75c339c
...
...
@@ -8,7 +8,7 @@ project mc is
"observer"
--"../build/node1/simulation"
);
for
Main
use
(
"m
c
.adb"
);
for
Main
use
(
"m
odelcheck
.adb"
);
package
Compiler
is
for
Default_Switches
(
"Ada"
)
use
(
"-g"
,
"-O2"
);
end
Compiler
;
...
...
test/iterators/work/simulation/mc_lib.gpr
0 → 100644
View file @
b75c339c
with
"share/gpr/demo_simulator.gpr"
;
with
"asn1_iterators"
;
library
project
mc_lib
is
for
Library_Name
use
"simulator"
;
for
Library_Dir
use
"."
;
for
Library_Kind
use
"dynamic"
;
for
Library_Standalone
use
"encapsulated"
;
for
Library_Options
use
(
"-lrt"
,
"-lm"
);
for
Interfaces
use
(
"properties.ads"
,
"gser.ads"
,
"my_observer.ads"
,
"my_observer_datamodel.ads"
,
"my_observer_ri.ads"
,
"mc.ads"
);
for
Source_Dirs
use
(
"mcsrc"
,
"../dataview/iterators"
,
"observer"
);
for
Object_Dir
use
"../build/node1/demo_simu_obj"
;
package
Compiler
is
for
Default_Switches
(
"Ada"
)
use
(
"-Wall"
,
"-Wextra"
,
"-Wcast-align"
);
end
Compiler
;
end
mc_lib
;
test/iterators/work/simulation/mcsrc/mc.adb
View file @
b75c339c
with
Text_IO
;
use
Text_IO
;
package
body
MC
is
procedure
Startup
is
begin
Put_Line
(
"[Model Checker] Initialization done"
);
Init_Done
:=
True
;
end
Startup
;
with
Simulator_Interface
;
with
Properties
;
-- user-defined properties
procedure
MC
is
use
Properties
;
package
Simulator_Pkg
is
new
Simulator_Interface
(
State_With_Observers
=>
State_With_Observers
,
Application_State
=>
Application_State
,
Update_State
=>
Update_State
,
Full_State_Init
=>
Full_State_Init
,
State_As_String
=>
State_To_String
,
Run_Observers
=>
Properties
.
My_Properties
'
Access
);
use
Simulator_Pkg
;
-- procedure Encode_And_md5 (State: asn1SccSystem_State) is
-- uPER_Encoded : asn1SccSystem_State_uPER_Stream;
-- uPER_Result : adaasn1rtl.ASN1_RESULT;
-- begin
-- uPER_Result := asn1SccSystem_State_IsConstraintValid (State);
-- Put_Line ("IsConstraintValid: " & uPER_Result.Success'Img & uPER_Result.ErrorCode'Img);
-- asn1SccSystem_State_Encode (State, uPER_Encoded, uPER_Result);
-- Put_Line (uPER_Result.Success'Img & uPER_Result.ErrorCode'Img);
-- Put_Line (adaasn1rtl.encoding.BitStream_Current_Length_In_Bytes(uPER_Encoded)'img);
-- end Encode_And_md5;
procedure
Model_Check
is
begin
if
not
Init_Done
then
Startup
;
end
if
;
Simulator_Pkg
.
Run_Exhaustive_Simulation
;
end
Model_Check
;
begin
Simulator_Pkg
.
Simulation_Startup
;
Put_Line
(
"Now exhausting all interfaces..."
);
Simulator_Pkg
.
Run_Exhaustive_Simulation
;
Startup
;
end
MC
;
test/iterators/work/simulation/mcsrc/mc.ads
0 → 100644
View file @
b75c339c
with
Text_IO
;
use
Text_IO
;
with
Simulator_Interface
;
with
Properties
;
-- user-defined properties
-- External interface to the model checker.
-- Symbols are exported in C so that they can be called from Python via ctypes
package
MC
is
use
Properties
;
procedure
Model_Check
with
Export
,
Convention
=>
C
,
Link_Name
=>
"mc_run_exhaustive"
;
private
init_done
:
boolean
:=
False
;
procedure
Startup
;
package
Simulator_Pkg
is
new
Simulator_Interface
(
State_With_Observers
=>
State_With_Observers
,
Application_State
=>
Application_State
,
Update_State
=>
Update_State
,
Full_State_Init
=>
Full_State_Init
,
State_As_String
=>
State_To_String
,
Run_Observers
=>
Properties
.
My_Properties
'
Access
);
use
Simulator_Pkg
;
-- procedure Encode_And_md5 (State: asn1SccSystem_State) is
-- uPER_Encoded : asn1SccSystem_State_uPER_Stream;
-- uPER_Result : adaasn1rtl.ASN1_RESULT;
-- begin
-- uPER_Result := asn1SccSystem_State_IsConstraintValid (State);
-- Put_Line ("IsConstraintValid: " & uPER_Result.Success'Img & uPER_Result.ErrorCode'Img);
-- asn1SccSystem_State_Encode (State, uPER_Encoded, uPER_Result);
-- Put_Line (uPER_Result.Success'Img & uPER_Result.ErrorCode'Img);
-- Put_Line (adaasn1rtl.encoding.BitStream_Current_Length_In_Bytes(uPER_Encoded)'img);
-- end Encode_And_md5;
end
MC
;
test/iterators/work/simulation/mcsrc/modelcheck.adb
0 → 100644
View file @
b75c339c
with
MC
;
procedure
modelcheck
is
begin
MC
.
Model_Check
;
end
modelcheck
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment