Commit fe30fcc0 authored by Maxime Perrotin's avatar Maxime Perrotin

Add test case for optional fields

parent 312aa166
TASTE-Dataview DEFINITIONS ::= BEGIN
-- In this ACN model, you can specify custom binary encoding rules for
-- your data types. For example if you require a specific memory layout
-- for a record, or need to add padding fields, define endianness, etc.
-- you can do that with ACN. Refer to the ACN user manual for details.
-- TASTE-Boolean []
END
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
TASTE-Boolean ::= BOOLEAN
MyInt ::= INTEGER (0..255)
MySeqOf ::= SEQUENCE (SIZE (0..2)) OF BOOLEAN
MySeq ::= SEQUENCE { foo BOOLEAN, bar BOOLEAN OPTIONAL }
MyChoice ::= CHOICE { hop BOOLEAN }
Seq-With-Optional ::= SEQUENCE {
a BOOLEAN,
b BOOLEAN OPTIONAL,
c INTEGER (0..255) OPTIONAL,
d MyInt OPTIONAL,
e SEQUENCE (SIZE (2)) OF MyInt OPTIONAL,
f MySeq,
g SEQUENCE { huhu BOOLEAN OPTIONAL, b BOOLEAN },
h MySeqOf,
ii CHOICE { x BOOLEAN, y BOOLEAN } OPTIONAL,
jj CHOICE { uiop BOOLEAN },
k MyChoice
}
-- ASN.1 Type definitions must start with an uppercase
-- Field names in records (SEQUENCE) must start with a lowercase
-- Underscores are not allowed: use dash (hyphen)
-- Simple types:
-- MyInteger ::= INTEGER (0..255)
-- MyReal ::= REAL (0.0 .. 1000.0)
-- MyBool ::= BOOLEAN
-- MyEnum ::= ENUMERATED { hello, world, how-are-you }
-- Complex types:
-- MySeq ::= SEQUENCE {
-- input-data MyInteger,
-- output-data MyInteger,
-- validity ENUMERATED { valid, invalid }
-- }
--
-- MyChoice ::= CHOICE {
-- a BOOLEAN,
-- b MySeq
-- }
--
-- MySeqOf ::= SEQUENCE (SIZE (2)) OF MyEnum
--
-- MyOctStr ::= OCTET STRING (SIZE (3))
--
-- -- You can also declare constants
-- myVar MySeqOf ::= { hello, world }
END
---------------------------------------------------
-- AADL2.1
-- TASTE type deploymentview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE deploymentview::DV::Node1
PUBLIC
WITH Taste;
WITH Deployment;
WITH TASTE_DV_Properties;
PROCESS demo
END demo;
PROCESS IMPLEMENTATION demo.others
END demo.others;
END deploymentview::DV::Node1;
PACKAGE deploymentview::DV
PUBLIC
WITH interfaceview::IV::ground;
WITH interfaceview::IV::flight;
WITH ocarina_processors_x86;
WITH deploymentview::DV::Node1;
WITH Taste;
WITH Deployment;
WITH interfaceview::IV;
WITH TASTE_DV_Properties;
SYSTEM Node1
END Node1;
SYSTEM IMPLEMENTATION Node1.others
SUBCOMPONENTS
IV_ground : SYSTEM interfaceview::IV::ground::ground.others {
Taste::FunctionName => "ground";
};
IV_flight : SYSTEM interfaceview::IV::flight::flight.others {
Taste::FunctionName => "flight";
};
demo : PROCESS deploymentview::DV::Node1::demo.others {
Taste::coordinates => "120916 76357 144904 98117";
Deployment::Port_Number => 0;
};
x86_linux : PROCESSOR ocarina_processors_x86::x86.linux {
Taste::coordinates => "117918 70140 147902 101225";
};
PROPERTIES
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_ground;
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_flight;
Actual_Processor_Binding => (reference (x86_linux)) APPLIES TO demo;
END Node1.others;
SYSTEM deploymentview
END deploymentview;
SYSTEM IMPLEMENTATION deploymentview.others
SUBCOMPONENTS
Node1 : SYSTEM Node1.others {
Taste::coordinates => "114170 61258 151650 105666";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.0";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("/home/taste/tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
---------------------------------------------------
-- AADL2.1
-- TASTE type interfaceview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE interfaceview::IV::ground
PUBLIC
WITH interfaceview::IV::flight;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_gone
FEATURES
a : IN PARAMETER DataView::Seq_With_Optional {
Taste::encoding => NATIVE;
};
END PI_gone;
SUBPROGRAM IMPLEMENTATION PI_gone.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_gone.others;
SUBPROGRAM RI_go
FEATURES
a : IN PARAMETER DataView::Seq_With_Optional {
Taste::encoding => NATIVE;
};
END RI_go;
SUBPROGRAM IMPLEMENTATION RI_go.others
END RI_go.others;
SYSTEM ground
FEATURES
PI_gone : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::ground::PI_gone.others {
Taste::coordinates => "112599 85195";
Taste::RCMoperationKind => sporadic;
Taste::InterfaceName => "gone";
};
RI_go : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::flight::PI_go.others {
Taste::coordinates => "104724 85195";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "go";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (GUI);
Taste::Active_Interfaces => any;
END ground;
SYSTEM IMPLEMENTATION ground.others
END ground.others;
END interfaceview::IV::ground;
PACKAGE interfaceview::IV::flight
PUBLIC
WITH interfaceview::IV::ground;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_go
FEATURES
a : IN PARAMETER DataView::Seq_With_Optional {
Taste::encoding => NATIVE;
};
END PI_go;
SUBPROGRAM IMPLEMENTATION PI_go.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_go.others;
SUBPROGRAM RI_gone
FEATURES
a : IN PARAMETER DataView::Seq_With_Optional {
Taste::encoding => NATIVE;
};
END RI_gone;
SUBPROGRAM IMPLEMENTATION RI_gone.others
END RI_gone.others;
SYSTEM flight
FEATURES
PI_go : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::flight::PI_go.others {
Taste::coordinates => "108973 67085";
Taste::RCMoperationKind => sporadic;
Taste::InterfaceName => "go";
};
RI_gone : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::ground::PI_gone.others {
Taste::coordinates => "113697 67085";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "gone";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (SDL);
Taste::Active_Interfaces => any;
END flight;
SYSTEM IMPLEMENTATION flight.others
END flight.others;
END interfaceview::IV::flight;
PACKAGE interfaceview::IV
PUBLIC
WITH interfaceview::IV::ground;
WITH interfaceview::IV::flight;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SYSTEM interfaceview
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
END interfaceview;
SYSTEM IMPLEMENTATION interfaceview.others
SUBCOMPONENTS
ground : SYSTEM interfaceview::IV::ground::ground.others {
Taste::coordinates => "92124 85195 139209 104880";
};
flight : SYSTEM interfaceview::IV::flight::flight.others {
Taste::coordinates => "93856 50235 129130 67085";
};
CONNECTIONS
ground_PI_gone_flight_RI_gone : SUBPROGRAM ACCESS ground.PI_gone -> flight.RI_gone {
Taste::coordinates => "113697 67085 113697 76140 112599 76140 112599 85195";
};
flight_PI_go_ground_RI_go : SUBPROGRAM ACCESS flight.PI_go -> ground.RI_go {
Taste::coordinates => "104724 85195 104724 76140 108973 76140 108973 67085";
};
END interfaceview.others;
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.0";
END interfaceview::IV;
#!/bin/bash -e
# This script will build your TASTE system.
# You should not change this file as it was automatically generated.
# If you need additional preprocessing, there are three hook files
# that you can provide and that are called dring the build:
# user_init_pre.sh, user_init_post.sh and user_init_last.sh
# These files will never get overwritten by TASTE.'
# Inside these files you may set some environment variables:
# C_INCLUDE_PATH=/usr/include/xenomai/analogy/:${C_INCLUDE_PATH}
# unset USE_POHIC
CWD=$(pwd)
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
COLOROFF="\e[0m"
else
COLORON=""
COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"
if [ -f user_init_pre.sh ]
then
echo -e "${INFO} Executing user-defined init script"
source user_init_pre.sh
fi
# Set up the cache to limit the calls to ASN1SCC in DMT tools
mkdir -p .cache
export PROJECT_CACHE=$(pwd)/.cache
# Use PolyORB-HI-C runtime
USE_POHIC=1
# Set Debug mode by default
DEBUG_MODE=--debug
# Detect models from Ellidiss tools v2, and convert them to 1.3
INTERFACEVIEW=InterfaceView.aadl
grep "version => \"2" InterfaceView.aadl >/dev/null && {
echo -e "${INFO} Converting interface view from V2 to V1.3"
TASTE --load-interface-view InterfaceView.aadl --export-interface-view-to-1_3 __iv_1_3.aadl
INTERFACEVIEW=__iv_1_3.aadl
};
if [ -z "$DEPLOYMENTVIEW" ]
then
DEPLOYMENTVIEW=DeploymentView.aadl
fi
# Detect models from Ellidiss tools v2, and convert them to 1.3
grep "version => \"2" "$DEPLOYMENTVIEW" >/dev/null && {
echo -e "${INFO} Converting deployment view from V2 to V1.3"
TASTE --load-deployment-view "$DEPLOYMENTVIEW" --export-deployment-view-to-1_3 __dv_1_3.aadl
DEPLOYMENTVIEW=__dv_1_3.aadl
};
SKELS="./"
# Check if Dataview references existing files
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -j /tmp/dv.asn
# Generate code for OpenGEODE function flight
cd "$SKELS"/flight && opengeode --toAda flight.pr system_structure.pr && cd $OLDPWD || exit -1
cd "$SKELS" && rm -f flight.zip && zip -r flight flight/* && cd $OLDPWD || exit -1
[ ! -z "$CLEANUP" ] && rm -rf binary*
if [ -f ConcurrencyView.pro ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
elif [ -f ConcurrencyView_Properties.aadl ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView_Properties.aadl "
fi
if [ -f user_init_post.sh ]
then
echo -e "${INFO} Executing user-defined post-init script"
source user_init_post.sh
fi
if [ -f additionalCommands.sh ]
then
source additionalCommands.sh
fi
if [ ! -z "$USE_POHIC" ]
then
OUTPUTDIR=binary.c
ORCHESTRATOR_OPTIONS+=" -p "
elif [ ! -z "$USE_POHIADA" ]
then
OUTPUTDIR=binary.ada
else
OUTPUTDIR=binary
fi
cd "$CWD" && assert-builder-ocarina.py \
--fast \
$DEBUG_MODE \
--aadlv2 \
--keep-case \
--interfaceView "$INTERFACEVIEW" \
--deploymentView "$DEPLOYMENTVIEW" \
-o "$OUTPUTDIR" \
--subAda flight:"$SKELS"/flight.zip \
$ORCHESTRATOR_OPTIONS
if [ -f user_init_last.sh ]
then
echo -e "${INFO} Executing user-defined post-build script"
source user_init_last.sh
fi
TASTE-BasicTypes DEFINITIONS ::=
BEGIN
-- Set of TASTE predefined basic types
T-Int32 ::= INTEGER (-2147483648 .. 2147483647)
T-UInt32 ::= INTEGER (0 .. 4294967295)
T-Int8 ::= INTEGER (-128 .. 127)
T-UInt8 ::= INTEGER (0 .. 255)
T-Boolean ::= BOOLEAN
END
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
TASTE-Boolean ::= BOOLEAN
MyInt ::= INTEGER (0..255)
MySeqOf ::= SEQUENCE (SIZE (0..2)) OF BOOLEAN
MySeq ::= SEQUENCE { foo BOOLEAN, bar BOOLEAN OPTIONAL }
MyChoice ::= CHOICE { hop BOOLEAN }
Seq-With-Optional ::= SEQUENCE {
a BOOLEAN,
b BOOLEAN OPTIONAL,
c INTEGER (0..255) OPTIONAL,
d MyInt OPTIONAL,
e SEQUENCE (SIZE (2)) OF MyInt OPTIONAL,
f MySeq,
g SEQUENCE { huhu BOOLEAN OPTIONAL, b BOOLEAN },
h MySeqOf,
ii CHOICE { x BOOLEAN, y BOOLEAN } OPTIONAL,
jj CHOICE { uiop BOOLEAN },
k MyChoice
}
-- ASN.1 Type definitions must start with an uppercase
-- Field names in records (SEQUENCE) must start with a lowercase
-- Underscores are not allowed: use dash (hyphen)
-- Simple types:
-- MyInteger ::= INTEGER (0..255)
-- MyReal ::= REAL (0.0 .. 1000.0)
-- MyBool ::= BOOLEAN
-- MyEnum ::= ENUMERATED { hello, world, how-are-you }
-- Complex types:
-- MySeq ::= SEQUENCE {
-- input-data MyInteger,
-- output-data MyInteger,
-- validity ENUMERATED { valid, invalid }
-- }
--
-- MyChoice ::= CHOICE {
-- a BOOLEAN,
-- b MySeq
-- }
--
-- MySeqOf ::= SEQUENCE (SIZE (2)) OF MyEnum
--
-- MyOctStr ::= OCTET STRING (SIZE (3))
--
-- -- You can also declare constants
-- myVar MySeqOf ::= { hello, world }
END
/* CIF PROCESS (250, 150), (150, 75) */
process flight;
/* CIF TEXT (616, 307), (270, 133) */
-- Text area for declarations and comments
dcl val Seq_With_Optional;
/* CIF ENDTEXT */
/* CIF START (950, 108), (70, 35) */
START;
/* CIF NEXTSTATE (950, 158), (70, 35) */
NEXTSTATE Wait;
/* CIF state (950, 158), (70, 35) */
state Wait;
/* CIF input (950, 213), (70, 35) */
input go(val);
/* CIF PROCEDURECALL (900, 268), (169, 35) */
call writeln('b: ', exist(val.b));
/* CIF PROCEDURECALL (898, 323), (173, 35) */
call writeln('c: ', exist(val.c));
/* CIF PROCEDURECALL (896, 373), (177, 35) */
call writeln('d: ', exist(val.d));
/* CIF PROCEDURECALL (897, 423), (175, 35) */
call writeln('e: ', exist(val.e));
/* CIF PROCEDURECALL (881, 478), (207, 35) */
call writeln('f.bar: ', exist(val.f.bar));
/* CIF PROCEDURECALL (855, 533), (259, 35) */
call writeln('g.huhu: ', exist(val.g.huhu));
/* CIF PROCEDURECALL (900, 583), (169, 35) */
call writeln('ii: ', exist(val.ii));
/* CIF output (945, 633), (80, 35) */
output gone(val);
/* CIF NEXTSTATE (950, 688), (70, 35) */
NEXTSTATE -;
endstate;
endprocess flight;
\ No newline at end of file
/* CIF Keep Specific Geode ASNFilename 'dataview-uniq.asn' */
USE Datamodel;
SYSTEM flight;
/* CIF Keep Specific Geode PARAMNAMES a */
SIGNAL go (Seq_With_Optional);
/* CIF Keep Specific Geode PARAMNAMES a */
SIGNAL gone (Seq_With_Optional);
CHANNEL c
FROM ENV TO flight WITH go;
FROM flight TO ENV WITH gone;
ENDCHANNEL;
BLOCK flight;
SIGNALROUTE r
FROM ENV TO flight WITH go;
FROM flight TO ENV WITH gone;
CONNECT c and r;
PROCESS flight REFERENCED;
ENDBLOCK;
ENDSYSTEM;
\ No newline at end of file
#!/bin/bash
taste-update-data-view
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