Skip to content

Commit aa2ef6e

Browse files
authored
add more tests to sanity check (#85)
* add more tests to sanity check * add more logging Signed-off-by: Adrian Pop <adrian.pop@liu.se> --------- Signed-off-by: Adrian Pop <adrian.pop@liu.se>
1 parent d306bd3 commit aa2ef6e

File tree

3 files changed

+59
-5
lines changed

3 files changed

+59
-5
lines changed

configs/sanityCheck.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,20 @@
88
"referenceFileExtension": "csv",
99
"referenceFileNameDelimiter": ".",
1010
"referenceFiles": "sanityCheck/ReferenceFiles"
11+
},
12+
{
13+
"library": "MyOtherLibrary",
14+
"libraryVersion": "1.0.0",
15+
"loadFileCommands": [
16+
"loadFile(\"sanityCheck/MyOtherLibrary/package.mo\")"
17+
],
18+
"referenceFileExtension": "csv",
19+
"referenceFileNameDelimiter": ".",
20+
"referenceFiles":{
21+
"giturl":"https://github.com/OpenModelica/OMLibraryTestingTests",
22+
"destination":"ReferenceFiles/MyOtherLibrary",
23+
"git-ref": "main",
24+
"git-directory": "ReferenceResults"
25+
}
1126
}
1227
]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package MyOtherLibrary "My other awesome Modelica library"
2+
package Mechanics
3+
package MultiBody
4+
package Examples
5+
model Pendulum
6+
extends Modelica.Mechanics.MultiBody.Examples.Elementary.Pendulum;
7+
annotation(
8+
experiment(StopTime=5)
9+
);
10+
end Pendulum;
11+
end Examples;
12+
end MultiBody;
13+
end Mechanics;
14+
package Blocks
15+
package Examples
16+
model PID_Controller
17+
extends Modelica.Blocks.Examples.PID_Controller;
18+
annotation(
19+
experiment(StopTime=4)
20+
);
21+
end PID_Controller;
22+
end Examples;
23+
end Blocks;
24+
annotation(
25+
uses(Modelica(version = "4.0.0")),
26+
version = "1.0.0");
27+
end MyOtherLibrary;

test.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ def fflush():
9090

9191
def check_output_log(*popenargs, **kwargs):
9292
if DEBUG:
93-
fflush()
9493
print("run: check_output", popenargs, kwargs)
9594
print("\n")
95+
fflush()
9696
return subprocess.check_output(*popenargs, **kwargs)
9797

9898
def check_call_log(*popenargs, **kwargs):
9999
if DEBUG:
100-
fflush()
101100
print("run: check_call", popenargs, kwargs)
102101
print("\n")
102+
fflush()
103103
return subprocess.check_call(*popenargs, **kwargs)
104104

105105
def rmtree(f):
@@ -119,8 +119,8 @@ def runCommand(cmd, prefix, timeout):
119119
process = [None]
120120
def target():
121121
if DEBUG:
122-
fflush()
123122
print("run: Popen %s, %s, %d\n" %(cmd, prefix, timeout))
123+
fflush()
124124
with open(os.devnull, 'w') as FNULL:
125125
if isWin:
126126
process[0] = subprocess.Popen(cmd, shell=True, stdin=FNULL, stdout=FNULL, stderr=FNULL)
@@ -413,8 +413,20 @@ def testHelloWorld(cmd):
413413
(c["referenceFiles"],c["referenceFilesURL"]) = preparedReferenceDirs[destination]
414414
continue
415415
giturl = c["referenceFiles"]["giturl"]
416-
destination = os.path.normpath(c["referenceFiles"]["destination"])
417-
destinationReal = os.path.normpath(os.path.realpath(destination))
416+
destination = c["referenceFiles"]["destination"]
417+
if DEBUG:
418+
print("destination %s" % destination)
419+
destination = os.path.normpath(destination)
420+
if DEBUG:
421+
print("normalized destination %s" % destination)
422+
print("not os.path.isdir(destination): %s" % (not os.path.isdir(destination)))
423+
destinationReal = os.path.realpath(destination)
424+
if DEBUG:
425+
print("destinationReal %s" % destinationReal)
426+
destinationReal = os.path.normpath(destinationReal)
427+
if DEBUG:
428+
print("normalized destinationReal %s" % destinationReal)
429+
print("referenceFiles:", c["referenceFiles"])
418430

419431
if not os.path.isdir(destination):
420432
if "git-directory" in c["referenceFiles"]:

0 commit comments

Comments
 (0)