Commit 71cfe9b6 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add another test for continuous signals

parent 4643d9a9
include ../shared.mk
all: test-ada test-llvm
edit:
$(OPENGEODE) og.pr
test-parse:
$(OPENGEODE) og.pr --check
test-ada:
$(OPENGEODE) og.pr --toAda
$(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
$(GNATMAKE) -O$(O) -c *.adb
$(GNATBIND) -n og.ali
test-c:
$(OPENGEODE) og.pr --toC
$(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
$(CC) -O$(O) -c *.c
test-llvm:
$(OPENGEODE) og.pr --llvm -O$(O)
$(LLC) *.ll
$(CC) -O$(O) -c *.s
test-python:
$(OPENGEODE) og.pr --shared
$(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
$(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
$(GNATMAKE) -O$(O) -gnat2012 -fPIC -c *.adb
$(GNATBIND) -n -Llibog og
$(GNATMAKE) -c -fPIC -gnat2012 b~og.adb
$(CC) -shared -fPIC -o libog.so b~og.o og.o adaasn1rtl.o taste_dataview.o -lgnat
python -c "from ctypes import *; test=CDLL('./libog.so'); test.liboginit();"
coverage:
coverage run -p $(OPENGEODE) og.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
TASTE-Dataview DEFINITIONS ::=
BEGIN
TC-Type ::= SEQUENCE {
apid INTEGER (0..100),
content CHOICE {
change-mode ENUMERATED { safe, operational },
patch-memory INTEGER (0..100)
}
}
TM-Type ::= SEQUENCE {
apid INTEGER (0..100)
}
Boolean-Type ::= BOOLEAN
END
SYSTEM og;
/* CIF TEXT (156, 190), (356, 248) */
use dv comment 'dataview-uniq.asn';
signal telecommand(tc_type);
signal telemetry(tm_type);
/* CIF ENDTEXT */
CHANNEL c
FROM ENV TO og WITH telecommand;
FROM og TO ENV WITH telemetry;
ENDCHANNEL;
BLOCK og;
SIGNALROUTE r
FROM ENV TO og WITH telecommand;
FROM og TO ENV WITH telemetry;
CONNECT c AND r;
/* CIF PROCESS (225, 49), (150, 75) */
PROCESS og;
STATE AGGREGATION wait;
SUBSTRUCTURE
STATE mode_manager;
SUBSTRUCTURE
/* CIF START (359, 108), (70, 35) */
START;
/* CIF NEXTSTATE (331, 158), (126, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (331, 158), (126, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (68, 213), (360, 35) */
PROVIDED got_tc=true and present(tc!content)=change_mode;
/* CIF PROCEDURECALL (135, 263), (226, 35) */
CALL writeln('Change Mode');
/* CIF TASK (172, 313), (151, 35) */
TASK got_tc := false
/* CIF COMMENT (344, 313), (216, 48) */
COMMENT 'Reset the flag to avoid
infinite loop';
/* CIF NEXTSTATE (213, 363), (70, 35) */
NEXTSTATE -;
/* CIF PROVIDED (570, 213), (110, 35) */
PROVIDED true = false;
/* CIF NEXTSTATE (590, 263), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE tc_router;
SUBSTRUCTURE
/* CIF START (144, 56), (70, 35) */
START;
/* CIF NEXTSTATE (116, 106), (126, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (116, 106), (126, 35) */
STATE wait_for_tc;
/* CIF INPUT (93, 161), (175, 35) */
INPUT telecommand(tc);
/* CIF TASK (107, 211), (146, 35) */
TASK got_tc := true;
/* CIF NEXTSTATE (145, 261), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE memory_manager;
SUBSTRUCTURE
/* CIF START (259, 60), (70, 35) */
START;
/* CIF NEXTSTATE (231, 110), (126, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (231, 110), (126, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (118, 165), (351, 35) */
PROVIDED got_tc=true and present(tc!content)=patch_memory;
/* CIF PROCEDURECALL (178, 215), (231, 35) */
CALL writeln('Patch Memory');
/* CIF TASK (218, 265), (151, 35) */
TASK got_tc := false
/* CIF COMMENT (389, 265), (216, 48) */
COMMENT 'Reset the flag to avoid
infinite loop';
/* CIF NEXTSTATE (258, 315), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF STATE (370, 97), (182, 35) */
STATE memory_manager;
ENDSTATE;
/* CIF STATE (238, 111), (113, 35) */
STATE tc_router;
ENDSTATE;
/* CIF STATE (336, 191), (117, 35) */
STATE mode_manager;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF TEXT (622, 310), (327, 208) */
-- This system tests the provided clause
-- (continuous signal)
dcl tc TC_type;
dcl tm TM_type;
dcl got_tc Boolean_type;
dcl anything boolean_Type := true;
/* CIF ENDTEXT */
/* CIF START (351, 297), (70, 35) */
START;
/* CIF NEXTSTATE (347, 348), (78, 35) */
NEXTSTATE wait;
/* CIF STATE (432, 450), (81, 35) */
STATE wait;
ENDSTATE;
ENDPROCESS og;
ENDBLOCK;
ENDSYSTEM;
\ No newline at end of file
#!/bin/bash -e
make test-python
rm -rf simu
mkdir -p simu
asn2aadlPlus dataview-uniq.asn simu/DataView.aadl
cp libog.so dataview-uniq.asn *.pr simu
mv *.aadl simu
cd simu
aadl2glueC DataView.aadl og_interface.aadl
asn2dataModel -toPython dataview-uniq.asn
make -f Makefile.python
echo "errCodes=$(taste-asn1-errCodes ./dataview-uniq.h)" >>datamodel.py
LD_LIBRARY_PATH=. taste-gui -l
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment