Skip to content

Commit

Permalink
More tests for MDD library
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhard-thiele authored and OpenModelica-Hudson committed May 31, 2017
1 parent d51c142 commit ed569e2
Show file tree
Hide file tree
Showing 10 changed files with 250 additions and 1 deletion.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 18 additions & 1 deletion simulation/libraries/3rdParty/Modelica_DeviceDrivers/Makefile
Expand Up @@ -4,12 +4,23 @@ TEST = ../../../../rtest -v

TESTFILES = \
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager.mos \

Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String.mos \
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_ExternalTrigger.mos \

# test that currently fail. Move up when fixed.
# Run make testfailing
FAILINGTESTFILES= \

# 2017-05-31 bthiele: MDD specific manual tests
# The problem with the cases below is, that they open sockets and if
# executed in parallel, this will fail due to the same address being already in use.
# There is also a source of indeterminism due to UDP communication delays.
# Don't know yet how to provide good automatic regression tests for these and for
# similar guys (the hardware related tests of MDD are difficult to automatize).
MANUALTESTFILES= \
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP.mos \
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPExternalTrigger.mos \
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPAutoBufferSize.mos \


# Dependency files that are not .mo .mos or Makefile
Expand Down Expand Up @@ -59,3 +70,9 @@ failingtest :
@echo Running failing tests...
@echo
@$(TEST) $(FAILINGTESTFILES) \

manualtest :
@echo
@echo Running manual tests...
@echo
@$(TEST) $(MANUALTESTFILES) \
@@ -0,0 +1,48 @@
// name: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_ExternalTrigger
// keywords: simulation Modelica_Synchronous examples
// status: correct
//
// Simulation Results
// Modelica_Synchronous
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

echo(false);
modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_ExternalTrigger);
compareVars :=
{"getInteger.y[1]"};

runScript("common.mos");getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_ExternalTrigger', options = '', outputFormat = 'mat', variableFilter = 'time|getInteger.y.1.', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_ExternalTrigger_res.mat
// Files Equal!
// Warning: Alias equations of external objects are not Modelica compliant as in:
// getInteger.pkgIn.pkg = unpackInt1.pkgOut[1].pkg
// unpackInt.pkgOut[1].pkg = unpackInt1.pkgIn.pkg
// resetPointer.pkgOut[1].pkg = unpackInt.pkgIn.pkg
// addInteger.pkgOut[1].pkg = resetPointer.pkgIn.pkg
// addInteger.pkgIn.pkg = packInt1.pkgOut[1].pkg
// packInt.pkgOut[1].pkg = packInt1.pkgIn.pkg
// packInt.pkgIn.pkg = packager.pkgOut.pkg
// unpackInt1.pkgOut[1].pkg = unpackInt1.pkgIn.pkg
// unpackInt.pkgOut[1].pkg = unpackInt.pkgIn.pkg
// resetPointer.pkgOut[1].pkg = resetPointer.pkgIn.pkg
// packInt1.pkgOut[1].pkg = packInt1.pkgIn.pkg
// addInteger.pkgOut[1].pkg = addInteger.pkgIn.pkg
// packInt.pkgOut[1].pkg = packInt.pkgIn.pkg
// Warning: Assuming fixed start value for the following 1 variables:
// iExp.y:DISCRETE(min = 0 fixed = false ) "Value of Integer output" type: Integer
//
// "true
// "
// ""
// endResult
@@ -0,0 +1,52 @@
// name: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String
// keywords: simulation Modelica_DeviceDrivers examples
// status: correct
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String);
compareVars :=
{"findString.y"};

runScript("common.mos");getErrorString();
runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String
// {"findString.y"}
// "Modelica_DeviceDrivers
// \"\"
// true
// \"Modelica_DeviceDrivers\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String', options = '', outputFormat = 'mat', variableFilter = 'time|findString.y', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String_res.mat
// Files Equal!
// Warning: Alias equations of external objects are not Modelica compliant as in:
// addInteger.pkgOut[1].pkg = resetPointer.pkgIn.pkg
// getInteger.pkgIn.pkg = getString.pkgOut[1].pkg
// getString.pkgIn.pkg = unpackInt.pkgOut[1].pkg
// addString.pkgIn.pkg = packInt.pkgOut[1].pkg
// addInteger.pkgIn.pkg = addString.pkgOut[1].pkg
// resetPointer.pkgOut[1].pkg = unpackInt.pkgIn.pkg
// packInt.pkgIn.pkg = packager.pkgOut.pkg
// getString.pkgOut[1].pkg = getString.pkgIn.pkg
// addString.pkgOut[1].pkg = addString.pkgIn.pkg
// unpackInt.pkgOut[1].pkg = unpackInt.pkgIn.pkg
// resetPointer.pkgOut[1].pkg = resetPointer.pkgIn.pkg
// addInteger.pkgOut[1].pkg = addInteger.pkgIn.pkg
// packInt.pkgOut[1].pkg = packInt.pkgIn.pkg
// Warning: Assuming fixed start value for the following 1 variables:
// getString.data:DISCRETE() "Output string (read from package)" type: String
//
// "true
// "
// ""
// endResult
@@ -0,0 +1,45 @@
// name: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP
// keywords: simulation Modelica_DeviceDrivers examples
// status: correct
//
// Simulation Results
// Modelica_DeviceDrivers
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

echo(false);
modelTestingType := OpenModelicaModelTesting.Kind.SuppressedVerifiedSimulation;
modelName := $TypeName(Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP);
simflags := "-rt=1";
compareVars :=
{"getInteger.y[1]"};

runScript("common.mos");getErrorString();
runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP', options = '', outputFormat = 'mat', variableFilter = 'time|getInteger.y.1.', cflags = '', simflags = '-rt=1 -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP_res.mat
// Files Equal!
// Warning: Alias equations of external objects are not Modelica compliant as in:
// getFloat.pkgOut[1].pkg = getInteger.pkgIn.pkg
// getFloat.pkgIn.pkg = getReal.pkgOut[1].pkg
// addInteger.pkgOut[1].pkg = uDPSend.pkgIn.pkg
// addFloat.pkgOut[1].pkg = addInteger.pkgIn.pkg
// addFloat.pkgIn.pkg = addReal.pkgOut[1].pkg
// getReal.pkgIn.pkg = uDPReceive.pkgOut.pkg
// addReal.pkgIn.pkg = packager.pkgOut.pkg
// getFloat.pkgOut[1].pkg = getFloat.pkgIn.pkg
// addFloat.pkgOut[1].pkg = addFloat.pkgIn.pkg
// getReal.pkgOut[1].pkg = getReal.pkgIn.pkg
// addInteger.pkgOut[1].pkg = addInteger.pkgIn.pkg
// addReal.pkgOut[1].pkg = addReal.pkgIn.pkg
//
// "true
// "
// ""
// endResult
@@ -0,0 +1,45 @@
// name: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPAutoBufferSize
// keywords: simulation Modelica_DeviceDrivers examples
// status: correct
//
// Simulation Results
// Modelica_DeviceDrivers
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

echo(false);
modelTestingType := OpenModelicaModelTesting.Kind.SuppressedVerifiedSimulation;
modelName := $TypeName(Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPAutoBufferSize);
simflags := "-rt=1";
compareVars :=
{"getReal.y[1]", "getFloat.y[1]", "getInteger.y[1]"};

runScript("common.mos");getErrorString();
runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPAutoBufferSize', options = '', outputFormat = 'mat', variableFilter = 'time|getReal.y.1.|getFloat.y.1.|getInteger.y.1.', cflags = '', simflags = '-rt=1 -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPAutoBufferSize_res.mat
// Files Equal!
// Warning: Alias equations of external objects are not Modelica compliant as in:
// getFloat.pkgOut[1].pkg = getInteger.pkgIn.pkg
// getFloat.pkgIn.pkg = getReal.pkgOut[1].pkg
// addInteger.pkgOut[1].pkg = uDPSend.pkgIn.pkg
// addFloat.pkgOut[1].pkg = addInteger.pkgIn.pkg
// addFloat.pkgIn.pkg = addReal.pkgOut[1].pkg
// getReal.pkgIn.pkg = uDPReceive.pkgOut.pkg
// addReal.pkgIn.pkg = packager.pkgOut.pkg
// getFloat.pkgOut[1].pkg = getFloat.pkgIn.pkg
// addFloat.pkgOut[1].pkg = addFloat.pkgIn.pkg
// getReal.pkgOut[1].pkg = getReal.pkgIn.pkg
// addInteger.pkgOut[1].pkg = addInteger.pkgIn.pkg
// addReal.pkgOut[1].pkg = addReal.pkgIn.pkg
//
// "true
// "
// ""
// endResult
@@ -0,0 +1,42 @@
// name: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPExternalTrigger
// keywords: simulation Modelica_DeviceDrivers examples
// status: correct
//
// Simulation Results
// Modelica_DeviceDrivers
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

echo(false);
modelTestingType := OpenModelicaModelTesting.Kind.SuppressedSimulation;
modelName := $TypeName(Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPExternalTrigger);

runScript("common.mos");getErrorString();
runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPExternalTrigger', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ' -abortSlowSimulation -alarm=360'
// Result file: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPExternalTrigger_res.mat
// Note: Reference file /home/bernhard/data/workspace/openmodelica/testsuite/ReferenceFiles/Modelica_DeviceDrivers/Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPExternalTrigger.mat does not exist. Cannot determine if the result improved!
// Warning: Alias equations of external objects are not Modelica compliant as in:
// getFloat.pkgOut[1].pkg = getInteger.pkgIn.pkg
// getFloat.pkgIn.pkg = getReal.pkgOut[1].pkg
// addInteger.pkgOut[1].pkg = uDPSend.pkgIn.pkg
// addFloat.pkgOut[1].pkg = addInteger.pkgIn.pkg
// addFloat.pkgIn.pkg = addReal.pkgOut[1].pkg
// getReal.pkgIn.pkg = uDPReceive.pkgOut.pkg
// addReal.pkgIn.pkg = packager.pkgOut.pkg
// getFloat.pkgOut[1].pkg = getFloat.pkgIn.pkg
// addFloat.pkgOut[1].pkg = addFloat.pkgIn.pkg
// getReal.pkgOut[1].pkg = getReal.pkgIn.pkg
// addInteger.pkgOut[1].pkg = addInteger.pkgIn.pkg
// addReal.pkgOut[1].pkg = addReal.pkgIn.pkg
//
// "true
// "
// ""
// endResult

0 comments on commit ed569e2

Please sign in to comment.