Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors committed Jul 9, 2015
2 parents 9b29383 + e68c990 commit 5d1ef5b
Show file tree
Hide file tree
Showing 449 changed files with 3,348 additions and 8,041 deletions.
31 changes: 30 additions & 1 deletion Makefile
Expand Up @@ -20,6 +20,10 @@ flatteningPlanarMechanics.log \
TestMedia.log \
cppruntime.log \
cppruntimeHpcom.log \
cppruntimeFMU1.log \
cppruntimeFMU2.log \
cppruntimeUmfpack.log \
cppruntimeStaticLinking.log \
taskGraph.log \
debugDumps.log \
dumpCruntime.log \
Expand Down Expand Up @@ -144,7 +148,8 @@ fmi_cs_st.log \
uncertainties.log \
scodeinst.log \
xml.log \
xogeny.log
xogeny.log \
openmodelicadiff.log

.PHONY : all omc-diff ReferenceFiles failingtest test fast fast.logs $(FASTLOGS) $(SLOWLOGS) $(SIMULATIONLOGS) slow.logs threaded

Expand Down Expand Up @@ -368,6 +373,18 @@ cppruntime.log: omc-diff
cppruntimeHpcom.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/hpcom -f Makefile test > $@
@echo $@ done
cppruntimeFMU1.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/fmu/modelExchange/1.0 -f Makefile test > $@
@echo $@ done
cppruntimeFMU2.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/fmu/modelExchange/2.0 -f Makefile test > $@
@echo $@ done
cppruntimeUmfpack.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/umfpack -f Makefile test > $@
@echo $@ done
cppruntimeStaticLinking.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/staticLinking -f Makefile test > $@
@echo $@ done
linearization.log: omc-diff
$(MAKE) -C openmodelica/linearization -f Makefile test > $@
@echo $@ done
Expand Down Expand Up @@ -516,6 +533,9 @@ modelica3d.log: omc-diff
hummod.log: omc-diff
$(MAKE) -C simulation/libraries/3rdParty/HumMod -f Makefile test > $@
@echo $@ done
openmodelicadiff.log: omc-diff
$(MAKE) -C openmodelica/diff -f Makefile test > $@
@echo $@ done

failingtest: omc-diff
cd mofiles; $(MAKE) -f Makefile failingtest; \
Expand Down Expand Up @@ -567,6 +587,10 @@ 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/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
$(MAKE) -C openmodelica/cppruntime/staticLinking -f Makefile clean
$(MAKE) -C openmodelica/cruntime/optimization/basic -f Makefile clean
$(MAKE) -C openmodelica/cruntime/xmlFiles -f Makefile clean
$(MAKE) -C openmodelica/debugDumps -f Makefile clean
Expand Down Expand Up @@ -643,8 +667,13 @@ git-sanity-check: git-clean
find -name "*.a" >> invalid-files.log
find -name "*.mat" >> invalid-files.log
find -name "*.csv" >> invalid-files.log
(find -type f -executable -exec file -i '{}' ";" | grep -s charset=binary >> invalid-files.log) || true
sort invalid-files.log > invalid-files.sorted
sort .gitvalidfiles > .gitvalidfiles.sorted
comm --check-order -23 invalid-files.sorted .gitvalidfiles.sorted > invalid-files.log
cat invalid-files.log
test ! -s invalid-files.log
for commit in `git rev-list origin/master..HEAD`; do \
test 50 -ge "`git log --format="%s" $$commit~1..$$commit | wc -c`" || (echo "$$commit has a too long commit summary (leave an empty line after the first if it is not part of the summary)"; git log $$commit~1..$$commit; false);\
test 72 -ge "`git log --format="%b" $$commit~1..$$commit | wc -L`" || (echo "$$commit has too long commit lines (max 72 characters per line)"; git log $$commit~1..$$commit; false);\
done
21 changes: 11 additions & 10 deletions flattening/modelica/algorithms-functions/Makefile
Expand Up @@ -98,6 +98,7 @@ TestGravityAcceleration.mo \
TupleSingleAssign.mo \
tupleSubset.mo \
UnusedInput.mo \
UnknownDimensionFunctionCall.mo \
Vectorizable1.mo \
Vectorizable3.mo \
Vectorizable5.mo \
Expand All @@ -109,9 +110,9 @@ WhenPriority.mo \
WhenStatement1.mo \
WhenStatement2.mo \
WhenStatement3.mo \
While.mo
While.mo

# test that currently fail. Move up when fixed.
# test that currently fail. Move up when fixed.
# Run make testfailing
FAILINGTESTFILES=\
AssignmentFunctionMultiple2.mo \
Expand All @@ -131,7 +132,7 @@ Vectorizable2.mo
# Add them here or they will be cleaned.
DEPENDENCIES = \
*.mo \
Makefile
Makefile

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

Expand All @@ -156,7 +157,7 @@ test :
@echo
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)
Expand All @@ -165,14 +166,14 @@ clean :
# 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:
# 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 $(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
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

failingtest :
@echo
@echo Running failing tests:
Expand Down
@@ -0,0 +1,117 @@
// status: correct

package Modelica_Noise
package Math
package Random
package Generators
package Xorshift64star
extends Interfaces.PartialGenerator(final nState = 2);

redeclare function extends initialState
protected
Real r;
constant Integer p = 10;
algorithm
if localSeed == 0 and globalSeed == 0 then
state := {126247697, globalSeed};
else
state := {localSeed, globalSeed};
end if;
for i in 1:p loop
(r, state) := random(state);
end for;
end initialState;

redeclare function extends random
external "C" ModelicaRandom_xorshift64star(stateIn, stateOut, result) annotation(Include = "
#include <stdint.h>
#define ModelicaRandom_INVM64 5.42101086242752217004e-20 /* = 2^(-64) */
#define ModelicaRandom_RAND(INT64) ( (int64_t)(INT64) * ModelicaRandom_INVM64 + 0.5 )
void ModelicaRandom_xorshift64star(int state_in[], int state_out[], double* y) {
union s_tag {
int32_t s32[2];
uint64_t s64;
} s;
int i;
uint64_t x;
for (i=0; i<sizeof(s)/sizeof(uint32_t); i++) {
s.s32[i] = state_in[i];
}
x = s.s64;
/* The actual algorithm */
x ^= x >> 12; /* a */
x ^= x << 25; /* b */
x ^= x >> 27; /* c */
#if defined(_MSC_VER)
x = x * 2685821657736338717i64;
#else
x = x * 2685821657736338717LL;
#endif
/* Convert outputs */
s.s64 = x;
for (i=0; i<sizeof(s)/sizeof(uint32_t); i++) {
state_out[i] = s.s32[i];
}
*y = ModelicaRandom_RAND(x);
}
");
end random;
end Xorshift64star;
end Generators;

package Interfaces
partial package PartialGenerator
constant Integer nState = 1;

replaceable partial function initialState
input Integer localSeed;
input Integer globalSeed;
output Integer[nState] state;
end initialState;

replaceable partial function random
input Integer[nState] stateIn;
output Real result;
output Integer[nState] stateOut;
end random;
end PartialGenerator;
end Interfaces;
end Random;
end Math;
end Modelica_Noise;

function f
input Integer i[2];
output Real r;
protected
Integer io[:]; // : here is the culprit
algorithm
(r,io) := Modelica_Noise.Math.Random.Generators.Xorshift64star.random(i);
end f;

model M
constant Real r = f({1,2});
end M;

// Result:
// function Modelica_Noise.Math.Random.Generators.Xorshift64star.random
// input Integer[2] stateIn;
// output Real result;
// output Integer[2] stateOut;
//
// external "C" ModelicaRandom_xorshift64star(stateIn, stateOut, result);
// end Modelica_Noise.Math.Random.Generators.Xorshift64star.random;
//
// function f
// input Integer[2] i;
// output Real r;
// protected Integer[:] io;
// algorithm
// (r, io) := Modelica_Noise.Math.Random.Generators.Xorshift64star.random({i[1], i[2]});
// end f;
//
// class M
// constant Real r = 0.2575342903011664;
// end M;
// endResult
4 changes: 3 additions & 1 deletion metamodelica/meta/Makefile
Expand Up @@ -17,6 +17,7 @@ BuiltinString.mos \
CheckPatternScope.mo \
ComplicatedInteractive.mos \
Continue.mo \
cref.mos \
Equality.mos \
EqPatternm.mos \
ErrorInteractiveCallFunctionPtr.mos \
Expand Down Expand Up @@ -120,7 +121,8 @@ Uniontype11.mos \
Uniontype12.mos \
Uniontype13.mos \
Uniontype14.mos \
Uniontype15.mos
Uniontype15.mos \
UniontypeFunc1.mos

# test that currently fail. Move up when fixed.
# Run make testfailing
Expand Down
20 changes: 20 additions & 0 deletions metamodelica/meta/UniontypeFunc1.mo
@@ -0,0 +1,20 @@
uniontype UT
record R
Real r;
end R;

function f
input UT ut;
output Real r;
algorithm
R(r = r) := ut;
end f;
end UT;

function test
output Real x;
protected
UT ut = R(1.0);
algorithm
x := UT.f(ut);
end test;
17 changes: 17 additions & 0 deletions metamodelica/meta/UniontypeFunc1.mos
@@ -0,0 +1,17 @@
// name: UniontypeFunc1
// keywords: uniontype function
// status: correct
// cflags: -g=MetaModelica
//
// Tests functions inside of uniontypes.
//

loadFile("UniontypeFunc1.mo"); getErrorString();
test(); getErrorString();

// Result:
// true
// ""
// 1.0
// ""
// endResult
44 changes: 44 additions & 0 deletions metamodelica/meta/cref.mos
@@ -0,0 +1,44 @@
// status: correct

setCommandLineOptions("-g=MetaModelica");
loadString("
package TestCref

uniontype U
record R
Real r;
end R;
end U;
uniontype U2
record R2
array<U> u;
end R2;
end U2;
function f
output Real r1,r2,r3;
protected
array<U> a;
array<U2> au2;
U u;
U2 u2;
algorithm
a := arrayCreate(10, R(1.0));
au2 := arrayCreate(3, R2(a));
r1 := a[1].r;
u := au2[2].u[8];
r2 := au2[2].u[8].r;
u2 := R2(a);
r3 := u2.u[1].r;
end f;

end TestCref;
");getErrorString();
TestCref.f();getErrorString();

// Result:
// true
// true
// ""
// (1.0,1.0,1.0)
// ""
// endResult

0 comments on commit 5d1ef5b

Please sign in to comment.