Commit c8badabd authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add test for continuous signals

parent 309e3a5c
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 generic_tc_handler_1;
SUBSTRUCTURE
/* CIF TEXT (131, 91), (323, 140) */
-- Model a generic TC handler. The content of this
-- state can be copied several times, to manage
-- several TC in parallel.
/* CIF ENDTEXT */
/* CIF START (490, 84), (70, 35) */
START;
/* CIF NEXTSTATE (472, 134), (106, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (472, 134), (106, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (485, 189), (79, 35) */
PROVIDED got_tc;
/* CIF TASK (462, 239), (126, 35) */
TASK got_tc := false;
/* CIF PROCEDURECALL (428, 289), (194, 35) */
CALL writeln('Processing TC 1');
/* CIF PROCEDURECALL (433, 339), (184, 35) */
CALL set_timer(5000, timer1);
/* CIF NEXTSTATE (462, 389), (126, 35) */
NEXTSTATE Processing_TC;
ENDSTATE;
/* CIF STATE (667, 182), (123, 35) */
STATE Processing_tc;
/* CIF INPUT (689, 237), (78, 35) */
INPUT timer1;
/* CIF PROCEDURECALL (632, 287), (193, 35) */
CALL writeln('TC1 completed');
/* CIF NEXTSTATE (675, 337), (106, 35) */
NEXTSTATE wait_for_tc;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE generic_tc_handler_2;
SUBSTRUCTURE
/* CIF TEXT (117, 155), (323, 140) */
-- Model a generic TC handler. The content of this
-- state can be copied several times, to manage
-- several TC in parallel.
/* CIF ENDTEXT */
/* CIF START (512, 84), (70, 35) */
START;
/* CIF NEXTSTATE (494, 134), (106, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (832, 164), (123, 35) */
STATE Processing_tc;
/* CIF INPUT (850, 219), (85, 35) */
INPUT timer2;
/* CIF PROCEDURECALL (793, 269), (200, 35) */
CALL writeln('TC2 completed');
/* CIF NEXTSTATE (840, 319), (106, 35) */
NEXTSTATE wait_for_tc;
ENDSTATE;
/* CIF STATE (494, 134), (106, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (507, 189), (79, 35) */
PROVIDED got_tc;
/* CIF TASK (484, 239), (126, 35) */
TASK got_tc := false;
/* CIF PROCEDURECALL (446, 289), (201, 35) */
CALL writeln('Processing TC 2');
/* CIF PROCEDURECALL (455, 339), (184, 35) */
CALL set_timer(5000, timer2);
/* CIF NEXTSTATE (484, 389), (126, 35) */
NEXTSTATE Processing_TC;
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 exception_handler;
SUBSTRUCTURE
/* CIF START (264, 78), (70, 35) */
START;
/* CIF NEXTSTATE (246, 128), (106, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (246, 128), (106, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (252, 183), (93, 38) */
PROVIDED got_tc;
priority 2;
/* CIF PROCEDURECALL (117, 236), (363, 35) */
CALL writeln('ERROR, all TC handlers are busy - discarding');
/* CIF TASK (225, 286), (147, 35) */
TASK exception := true;
/* CIF NEXTSTATE (264, 336), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF STATE (443, 507), (153, 35) */
STATE exception_handler;
ENDSTATE;
/* CIF STATE (476, 0), (113, 35) */
STATE tc_router;
ENDSTATE;
/* CIF STATE (381, 338), (169, 35) */
STATE generic_tc_handler_2;
ENDSTATE;
/* CIF STATE (370, 168), (182, 35) */
STATE generic_tc_handler_1;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF TEXT (0, 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 exception boolean_Type := false;
timer timer1, timer2;
/* CIF ENDTEXT */
/* CIF START (351, 297), (70, 35) */
START;
/* CIF NEXTSTATE (354, 348), (63, 35) */
NEXTSTATE wait;
/* CIF STATE (347, 583), (70, 35) */
STATE safe;
ENDSTATE;
/* CIF STATE (485, 344), (99, 35) */
STATE wait;
/* CIF PROVIDED (481, 399), (106, 35) */
PROVIDED exception;
/* CIF PROCEDURECALL (402, 449), (264, 35) */
CALL writeln('Going to SAFE mode');
/* CIF NEXTSTATE (499, 499), (70, 35) */
NEXTSTATE safe;
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
Supports Markdown
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