Commit 8da97961 authored by Maxime Perrotin's avatar Maxime Perrotin

Setup test environment

parent 2c4ef76e
......@@ -43,7 +43,10 @@ edit:
ADA_PROJECT_PATH=`ocarina-config --prefix`/lib/gnat:$$ADA_PROJECT_PATH \
gps aadl_parser.gpr
test:
@$(MAKE) -C test
clean:
rm -rf obj $(exec) *~
.PHONY: install clean build edit
.PHONY: install clean build edit test
......@@ -1411,7 +1411,6 @@ procedure AADL_Parser is
IV_Root : Node_Id;
AST : Complete_Interface_View;
pragma Unreferenced (AST);
begin
Banner;
......@@ -1428,11 +1427,11 @@ begin
Get_String_Name ("interfaceview.others");
IV_Root := Root_System (Instantiate_Model (Root => Interface_Root));
-- AST := AADL_to_Ada_IV (IV_Root);
-- for each of AST.Flat_Functions loop
-- Put_Line ("AST: " & To_String (Each.Prefix.Value_Or (US ("")))
-- & " " & To_String (Each.Name));
-- end loop;
AST := AADL_to_Ada_IV (IV_Root);
for each of AST.Flat_Functions loop
Put_Line ("AST: " & To_String (Each.Prefix.Value_Or (US ("")))
& " " & To_String (Each.Name));
end loop;
Process_Interface_View (IV_Root);
-- (Root_System (Instantiate_Model (Root => Interface_Root)));
......
package Parser_Version is
Parser_Release : constant String :=
"c7895aa ; Commit Date: Sat Jul 15 17:54:36 2017 ";
"2c4ef76 ; Commit Date: Sat Jul 15 18:25:37 2017 ";
Ocarina_Version : constant String :=
"Ocarina 2017.x (Working Copy from r0338d89)";
end Parser_Version;
\ No newline at end of file
DISABLED_TESTS=common/
TEST_CASES=$(filter-out $(DISABLED_TESTS), $(sort $(dir $(wildcard */))))
test-parse:
@python3 test.py test-parse $(TEST_CASES)
clean:
@for v in $(TEST_CASES) ; \
do $(MAKE) -s -C $$v clean ; \
done
.PHONY: test-parse clean
#!/usr/bin/env python3
import subprocess
import sys
import time
import signal
import os
from functools import partial
from multiprocessing import cpu_count
from concurrent import futures
def colorMe(result, msg):
if sys.stdout.isatty():
code = "1" if result else "2"
msg = chr(27) + "[3" + code + "m" + msg + chr(27) + "[0m"
return msg
def main():
''' Run the test cases in parallel on all available CPUs '''
start = time.time()
results = []
rule = sys.argv[1]
paths = sys.argv[2:]
with futures.ProcessPoolExecutor(max_workers=cpu_count()) as executor:
for result in executor.map(partial(make, rule), paths):
print("%40s: %s" % (result[3], colorMe(result[0],
'[OK]' if result[0]==0 else '[FAILED]')))
results.append(result)
executor.map(partial(make, 'clean'), paths)
sys.stdout.write('\n')
elapsed = time.time() - start
return summarize(results, elapsed)
def make(rule, path):
''' Call a Makefile with the required rule (e.g. build or clean) '''
proc = subprocess.Popen(
['make', '-C', path, rule],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
stdout, stderr = proc.communicate()
errcode = proc.wait()
return (errcode, stdout, stderr, path, rule)
def summarize(results, elapsed):
''' At the end display the errors of project that failed '''
failed = 0
for errcode, stdout, stderr, path, rule in results:
if errcode == 0:
continue
failed += 1
print("=" * 80)
print("ERROR: %s %s" % (path, rule))
if stdout:
print("-- stdout " + "-" * 70)
print(stdout)
if stderr:
print("-- stderr " + "-" * 70)
print(stderr)
print("-" * 80)
print("Finished in %.3fs" % elapsed)
print("%s tests, %s errors" % (len(results), failed))
return 0 if not failed else 1
if __name__ == '__main__':
# Catch Ctrl-C to stop the app from the console
signal.signal(signal.SIGINT, signal.SIG_DFL)
ret = main()
sys.stdout.write('\033[0m\n')
sys.stdout.flush()
sys.exit(ret)
../aadl_parser -glue -i test1/interfaceview.aadl -c test1/deploymentview.aadl -d test1/dataview.aadl ocarina_components.aadl TASTE_DV_Properties.aadl
../aadl_parser -gw -i test2/InterfaceView.aadl -d test2/DataView.aadl TASTE_IV_Properties.aadl
AADL_PARSER=../../aadl_parser
all: build
test-parse:
$(AADL_PARSER) -glue -i interfaceview.aadl -c deploymentview.aadl -d dataview.aadl ../common/ocarina_components.aadl ../common/TASTE_DV_Properties.aadl
clean:
rm -rf obj $(exec) *~
.PHONY: clean test-parse
AADL_PARSER=../../aadl_parser
all: build
test-parse:
$(AADL_PARSER) -gw -i InterfaceView.aadl -d DataView.aadl ../common/TASTE_IV_Properties.aadl
clean:
rm -rf obj $(exec) *~
.PHONY: clean test-parse
--------------------------------------------------------
--! File generated by asn2aadl v2.1.2: DO NOT EDIT !
--------------------------------------------------------
package DataView
public
with Data_Model;
with Taste;
with Base_Types;
with Deployment;
DATA Simulink_Tunable_Parameter
PROPERTIES
TASTE::Ada_Package_Name => "TASTE_Directives";
Type_Source_Name => "Simulink-Tunable-Parameter";
Deployment::ASN1_Module_Name => "TASTE-Directives";
TASTE::Forbid_in_PI => true;
END Simulink_Tunable_Parameter;
DATA Timer
PROPERTIES
TASTE::Ada_Package_Name => "TASTE_Directives";
Type_Source_Name => "Timer";
Deployment::ASN1_Module_Name => "TASTE-Directives";
TASTE::Forbid_in_PI => true;
END Timer;
DATA Taste_directive
PROPERTIES
TASTE::Ada_Package_Name => "TASTE_Directives";
Type_Source_Name => "Taste-directive";
Deployment::ASN1_Module_Name => "TASTE-Directives";
TASTE::Forbid_in_PI => true;
END Taste_directive;
data Stream_Element_Buffer
-- Root type for buffer elements
properties
Data_Model::Data_Representation => Character;
end Stream_Element_Buffer;
DATA T_Int32
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => ASN1;
-- Size of a buffer to cover all forms of message representation:
-- Real message size is 8; suggested aligned message buffer is...
Source_Data_Size => 8 Bytes;
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-Int32";
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_Int32;
DATA T_Int32_Buffer_Max
END T_Int32_Buffer_Max;
DATA IMPLEMENTATION T_Int32_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_Int32
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Dimension => (8); -- Size of the buffer
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_Int32_Buffer_Max.impl;
DATA T_Int32_Buffer
END T_Int32_Buffer;
DATA IMPLEMENTATION T_Int32_Buffer.impl
-- Buffer to hold a marshalled data of type T_Int32
SUBCOMPONENTS
Buffer : data T_Int32_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_Int32_Buffer.impl;
DATA T_UInt32
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => ASN1;
-- Size of a buffer to cover all forms of message representation:
-- Real message size is 8; suggested aligned message buffer is...
Source_Data_Size => 8 Bytes;
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-UInt32";
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_UInt32;
DATA T_UInt32_Buffer_Max
END T_UInt32_Buffer_Max;
DATA IMPLEMENTATION T_UInt32_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_UInt32
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Dimension => (8); -- Size of the buffer
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_UInt32_Buffer_Max.impl;
DATA T_UInt32_Buffer
END T_UInt32_Buffer;
DATA IMPLEMENTATION T_UInt32_Buffer.impl
-- Buffer to hold a marshalled data of type T_UInt32
SUBCOMPONENTS
Buffer : data T_UInt32_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_UInt32_Buffer.impl;
DATA T_UInt8
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => ASN1;
-- Size of a buffer to cover all forms of message representation:
-- Real message size is 8; suggested aligned message buffer is...
Source_Data_Size => 8 Bytes;
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-UInt8";
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_UInt8;
DATA T_UInt8_Buffer_Max
END T_UInt8_Buffer_Max;
DATA IMPLEMENTATION T_UInt8_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_UInt8
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Dimension => (8); -- Size of the buffer
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_UInt8_Buffer_Max.impl;
DATA T_UInt8_Buffer
END T_UInt8_Buffer;
DATA IMPLEMENTATION T_UInt8_Buffer.impl
-- Buffer to hold a marshalled data of type T_UInt8
SUBCOMPONENTS
Buffer : data T_UInt8_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_UInt8_Buffer.impl;
DATA T_Int8
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => ASN1;
-- Size of a buffer to cover all forms of message representation:
-- Real message size is 8; suggested aligned message buffer is...
Source_Data_Size => 8 Bytes;
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-Int8";
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_Int8;
DATA T_Int8_Buffer_Max
END T_Int8_Buffer_Max;
DATA IMPLEMENTATION T_Int8_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_Int8
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Dimension => (8); -- Size of the buffer
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_Int8_Buffer_Max.impl;
DATA T_Int8_Buffer
END T_Int8_Buffer;
DATA IMPLEMENTATION T_Int8_Buffer.impl
-- Buffer to hold a marshalled data of type T_Int8
SUBCOMPONENTS
Buffer : data T_Int8_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_Int8_Buffer.impl;
DATA T_Boolean
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => ASN1;
-- Size of a buffer to cover all forms of message representation:
-- Real message size is 1; suggested aligned message buffer is...
Source_Data_Size => 8 Bytes;
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-Boolean";
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aBOOLEAN;
END T_Boolean;
DATA T_Boolean_Buffer_Max
END T_Boolean_Buffer_Max;
DATA IMPLEMENTATION T_Boolean_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_Boolean
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Dimension => (8); -- Size of the buffer
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_Boolean_Buffer_Max.impl;
DATA T_Boolean_Buffer
END T_Boolean_Buffer;
DATA IMPLEMENTATION T_Boolean_Buffer.impl
-- Buffer to hold a marshalled data of type T_Boolean
SUBCOMPONENTS
Buffer : data T_Boolean_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_Boolean_Buffer.impl;
DATA MyInteger
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-src/testSuites/Demo_C/DataView.asn");
TASTE::Ada_Package_Name => "DataView";
Deployment::ASN1_Module_Name => "DataView";
Source_Language => ASN1;
-- Size of a buffer to cover all forms of message representation:
-- Real message size is 8; suggested aligned message buffer is...
Source_Data_Size => 8 Bytes;
-- name of the corresponding data type in the source file:
Type_Source_Name => "MyInteger";
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END MyInteger;
DATA MyInteger_Buffer_Max
END MyInteger_Buffer_Max;
DATA IMPLEMENTATION MyInteger_Buffer_Max.impl
-- Buffer to hold a marshalled data of type MyInteger
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Dimension => (8); -- Size of the buffer
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END MyInteger_Buffer_Max.impl;
DATA MyInteger_Buffer
END MyInteger_Buffer;
DATA IMPLEMENTATION MyInteger_Buffer.impl
-- Buffer to hold a marshalled data of type MyInteger
SUBCOMPONENTS
Buffer : data MyInteger_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END MyInteger_Buffer.impl;
end DataView;
---------------------------------------------------
-- AADL2.0
-- TASTE
--
--
---------------------------------------------------
PACKAGE interfaceview::FV::Simple_C_Function
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_cyclic_operation
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_cyclic_operation;
SUBPROGRAM IMPLEMENTATION PI_cyclic_operation.others
END PI_cyclic_operation.others;
END interfaceview::FV::Simple_C_Function;
PACKAGE interfaceview::IV
PUBLIC
WITH interfaceview::FV::Simple_C_Function;
WITH interfaceview::FV;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SYSTEM Simple_C_Function
FEATURES
PI_cyclic_operation : PROVIDES SUBPROGRAM ACCESS interfaceview::FV::Simple_C_Function::PI_cyclic_operation.others {
Taste::coordinates => "1042 584";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 2000 ms;
Taste::Deadline => 2000 ms;
Taste::InterfaceName => "cyclic_operation";
};
PROPERTIES
Source_Language => (C);
END Simple_C_Function;
SYSTEM IMPLEMENTATION Simple_C_Function.others
SUBCOMPONENTS
cyclic_operation_impl : SUBPROGRAM interfaceview::FV::Simple_C_Function::PI_cyclic_operation.others {
Compute_Execution_Time => 0 ms .. 2000 ms;
};
CONNECTIONS
OpToPICnx_cyclic_operation_impl : SUBPROGRAM ACCESS cyclic_operation_impl -> PI_cyclic_operation;
END Simple_C_Function.others;
SYSTEM interfaceview
END interfaceview;
SYSTEM IMPLEMENTATION interfaceview.others
SUBCOMPONENTS
Simple_C_Function : SYSTEM interfaceview::IV::Simple_C_Function.others {
Taste::coordinates => "1042 432 1706 1121";
};
END interfaceview.others;
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
Taste::coordinates => "0 0 2970 2100";
Taste::version => "1.3.18";
END interfaceview::IV;
PACKAGE interfaceview::FV
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
END interfaceview::FV;
AADL_PARSER=../../aadl_parser
all: test-parse
test-parse:
$(AADL_PARSER) -i InterfaceView.aadl -d DataView.aadl ../common/TASTE_IV_Properties.aadl
clean:
rm -rf obj $(exec) *~
.PHONY: clean test-parse
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