Skip to content

Commit

Permalink
- added a test for the OMEdit-flags to the cpp-runtime-testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Walther committed Aug 28, 2015
1 parent f3d6c3a commit 708894f
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile
Expand Up @@ -24,6 +24,7 @@ cppruntimeFMU1.log \
cppruntimeFMU2.log \
cppruntimeUmfpack.log \
cppruntimeStaticLinking.log \
cppruntimeOMEdit.log \
taskGraph.log \
debugDumps.log \
dumpCruntime.log \
Expand Down Expand Up @@ -373,6 +374,9 @@ cppruntime.log: omc-diff
cppruntimeHpcom.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/hpcom -f Makefile test > $@
@echo $@ done
cppruntimeOMEdit.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/omedit -f Makefile test > $@
@echo $@ done
cppruntimeFMU1.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/fmu/modelExchange/1.0 -f Makefile test > $@
@echo $@ done
Expand Down Expand Up @@ -587,6 +591,7 @@ clean_g_2 :
$(MAKE) -C metamodelica/meta -f Makefile clean
$(MAKE) -C openmodelica/cppruntime -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/hpcom -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/omedit -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/fmu/modelExchange/1.0 -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/fmu/modelExchange/2.0 -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/umfpack -f Makefile clean
Expand Down
7 changes: 6 additions & 1 deletion openmodelica/cppruntime/Makefile
Expand Up @@ -44,7 +44,9 @@ genDebugSymbols \
outputFormat \
ReferenceFiles \
outputFormat \
libraries
libraries \
peer \
omedit

CLEAN = `ls | grep -w -v -f deps.tmp`
HPCOM_DIR = hpcom/
Expand All @@ -55,6 +57,7 @@ FMI_2_0_DIR = fmu/modelExchange/2.0
STATIC_LINKING_DIR = staticLinking
DEBUG_SYMBOLS_DIR = genDebugSymbols
OUTPUT_FORMAT_DIR = outputFormat
OMEDIT_DIR = omedit

.PHONY : test clean getdeps failingtest

Expand All @@ -72,6 +75,7 @@ test:
@$(MAKE) -C $(STATIC_LINKING_DIR)
@$(MAKE) -C $(DEBUG_SYMBOLS_DIR)
@$(MAKE) -C $(OUTPUT_FORMAT_DIR)
@$(MAKE) -C $(OMEDIT_DIR)


# Cleans all files that are not listed as dependencies
Expand All @@ -86,6 +90,7 @@ clean :
@$(MAKE) -C $(STATIC_LINKING_DIR) clean
@$(MAKE) -C $(DEBUG_SYMBOLS_DIR) clean
@$(MAKE) -C $(OUTPUT_FORMAT_DIR) clean
@$(MAKE) -C $(OMEDIT_DIR) clean


# Run this if you want to list out the files (dependencies).
Expand Down
29 changes: 29 additions & 0 deletions openmodelica/cppruntime/omedit/BouncingBall_OMEdit_flags.mos
@@ -0,0 +1,29 @@
// name: BouncingBall_OMEdit_flags
// keywords: events
// status: correct
// teardown_command: rm -rf BouncingBall.log libModelica.dll BouncingBall.cpp BouncingBall.libs BouncingBall.h BouncingBall.makefile output.log Functions.h Functions.cpp
// cflags: +simCodeTarget=Cpp
//
// Event handling
//

loadFile("../BouncingBall.mo");
setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
simulate(BouncingBall,method="dassl",stopTime=1.0, tolerance=1e-10, numberOfIntervals=100,outputFormat="mat",simflags="-port=41442 -logFormat=xml -override=startTime=0,stopTime=4,stepSize=0.008,tolerance=0.0001,solver=dassl,outputFormat=mat,variableFilter=.* -r=BouncingBall_res.mat -dasslJacobian=coloredNumerical -emit_protected -w -lv=LOG_STATS");
res := OpenModelica.Scripting.compareSimulationResults("BouncingBall_res.mat",
"ReferenceFiles/BouncingBall.mat",
"BouncingBall_diff.csv",0.01,0.0001,
{"h","v"});


// Result:
// true
// true
// ""
// record SimulationResult
// resultFile = "BouncingBall_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 100, tolerance = 1e-10, method = 'dassl', fileNamePrefix = 'BouncingBall', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-port=41442 -logFormat=xml -override=startTime=0,stopTime=4,stepSize=0.008,tolerance=0.0001,solver=dassl,outputFormat=mat,variableFilter=.* -r=BouncingBall_res.mat -dasslJacobian=coloredNumerical -emit_protected -w -lv=LOG_STATS'",
// messages = ""
// end SimulationResult;
// {"Files Equal!"}
// endResult
47 changes: 47 additions & 0 deletions openmodelica/cppruntime/omedit/Makefile
@@ -0,0 +1,47 @@
TEST = ../../../rtest -v

TESTFILES = \
BouncingBall_OMEdit_flags.mos

FAILINGTESTFILES=

# Dependency files that are not .mo .mos or Makefile
# Add them here or they will be cleaned.
DEPENDENCIES = \
*.mo \
*.mos \
Makefile

CLEAN = `ls | grep -w -v -f deps.tmp`

.PHONY : test clean getdeps failingtest

test:
@echo
@echo Running tests...
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)

# Run this if you want to list out the files (dependencies).
# do it after cleaning and updating the folder
# then you can get a list of file names (which must be dependencies
# since you got them from repository + your own new files)
# then add them to the DEPENDENCIES. You can find the
# list in deps.txt
getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt
@echo Dependency list saved in deps.txt.
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

failingtest :
@echo
@echo Running failing tests...
@echo
@$(TEST) $(FAILINGTESTFILES)

0 comments on commit 708894f

Please sign in to comment.