Skip to content

Commit e489739

Browse files
lochelAndreas Heuermann
andauthored
Test cross-compiled mingw64 and msvc64 (#855)
All PRs will be tested on Windows with mingw and msvc. Updating test FMUs in testsuite - Updated mos scripts to use docker image for test FMU export - Updated Makefile for generating FMUs to clean up more - Updated FMUs for linux64 compiled with Bionic Docker image using omc version OMCompiler v1.17.0-dev.166+g6ef71eea6b. - Added cross-compiled win64 FMUs for mingw with Docker using omc version OMCompiler v1.17.0-dev.166+g6ef71eea6b. - Updated .gitignore to ignore created test files Co-authored-by: Andreas Heuermann <andreas.heuermann@liu.se>
1 parent 54e874f commit e489739

File tree

164 files changed

+1480
-4992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+1480
-4992
lines changed

Jenkinsfile

Lines changed: 132 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,11 @@ pipeline {
231231
! ls install/linux/bin/*.so 1> /dev/null 2>&1
232232
(cd install/linux && tar czf "../../OMSimulator-linux-arm32-`git describe --tags --abbrev=7 --match=v*.* --exclude=*-dev | sed \'s/-/.post/\'`.tar.gz" *)
233233
'''
234-
235234
archiveArtifacts "OMSimulator-linux-arm32-*.tar.gz"
236235
stash name: 'arm32-zip', includes: "OMSimulator-linux-arm32-*.tar.gz"
237236
stash name: 'arm32-install', includes: "install/linux/**"
238237
}
239238
}
240-
241239
stage('test') {
242240
/* when {
243241
beforeAgent true
@@ -308,7 +306,6 @@ pipeline {
308306
stash name: 'osx-install', includes: "install/mac/**"
309307
}
310308
}
311-
312309
stage('test') {
313310
/* when {
314311
beforeAgent true
@@ -327,36 +324,79 @@ pipeline {
327324
}
328325
}
329326
}
327+
330328
stage('mingw64-cross') {
331-
agent {
332-
docker {
333-
image 'docker.openmodelica.org/msyscross-omsimulator:v2.0'
334-
label 'linux'
335-
alwaysPull true
329+
stages {
330+
stage('cross-compile') {
331+
agent {
332+
docker {
333+
image 'docker.openmodelica.org/msyscross-omsimulator:v2.0'
334+
label 'linux'
335+
alwaysPull true
336+
}
337+
}
338+
environment {
339+
CROSS_TRIPLE = "x86_64-w64-mingw32"
340+
CC = "${env.CROSS_TRIPLE}-gcc-posix"
341+
CXX = "${env.CROSS_TRIPLE}-g++-posix"
342+
CPPFLAGS = '-I/opt/pacman/mingw64/include'
343+
LDFLAGS = '-L/opt/pacman/mingw64/lib'
344+
AR = "${env.CROSS_TRIPLE}-ar-posix"
345+
RANLIB = "${env.CROSS_TRIPLE}-ranlib-posix"
346+
detected_OS = 'MINGW64'
347+
VERBOSE = '1'
348+
BOOST_ROOT = '/opt/pacman/mingw64/'
349+
}
350+
steps {
351+
buildOMS()
352+
sh '''
353+
(cd install/mingw && zip -r "../../OMSimulator-mingw64-`git describe --tags --abbrev=7 --match=v*.* --exclude=*-dev | sed \'s/-/.post/\'`.zip" *)
354+
'''
355+
archiveArtifacts "OMSimulator-mingw64*.zip"
356+
stash name: 'mingw64-zip', includes: "OMSimulator-mingw64-*.zip"
357+
stash name: 'mingw64-install', includes: "install/mingw/**"
358+
}
336359
}
337-
}
338-
environment {
339-
CROSS_TRIPLE = "x86_64-w64-mingw32"
340-
CC = "${env.CROSS_TRIPLE}-gcc-posix"
341-
CXX = "${env.CROSS_TRIPLE}-g++-posix"
342-
CPPFLAGS = '-I/opt/pacman/mingw64/include'
343-
LDFLAGS = '-L/opt/pacman/mingw64/lib'
344-
AR = "${env.CROSS_TRIPLE}-ar-posix"
345-
RANLIB = "${env.CROSS_TRIPLE}-ranlib-posix"
346-
detected_OS = 'MINGW64'
347-
VERBOSE = '1'
348-
BOOST_ROOT = '/opt/pacman/mingw64/'
349-
}
360+
stage('test') {
361+
agent {
362+
label 'omsimulator-windows'
363+
}
364+
environment {
365+
PATH = "${env.PATH};C:\\bin\\git\\bin;C:\\bin\\git\\usr\\bin;C:\\OMDev\\tools\\msys\\mingw64\\bin\\"
366+
OMDEV = "/c/OMDev"
367+
MSYSTEM = "MINGW64"
368+
RUNTESTDB="${env.HOME}/jenkins-cache/runtest/"
369+
}
370+
steps {
371+
unstash name: 'mingw64-install'
350372

351-
steps {
352-
buildOMS()
353-
sh '''
354-
(cd install/mingw && zip -r "../../OMSimulator-mingw64-`git describe --tags --abbrev=7 --match=v*.* --exclude=*-dev | sed \'s/-/.post/\'`.zip" *)
355-
'''
373+
bat 'hostname'
374+
writeFile file: "testMingw64-install.sh", text:"""#!/bin/sh
375+
set -x -e
376+
cd "${env.WORKSPACE}"
377+
export PATH="/c/Program Files/TortoiseSVN/bin/:/c/bin/jdk/bin:/c/bin/nsis/:\$PATH:/c/bin/git/bin"
378+
make -C testsuite difftool resources
379+
cp -f "${env.RUNTESTDB}/"* testsuite/ || true
380+
find testsuite/ -name "*.lua" -exec sed -i /teardown_command/d {} ";"
381+
cd testsuite/partest
382+
./runtests.pl -j\$(nproc) -nocolour ${env.BRANCH_NAME == "master" ? "-notlm" : ""} -with-xml ${params.RUNTESTS_FLAG}
383+
"""
384+
bat """
385+
set BOOST_ROOT=C:\\local\\boost_1_64_0
386+
set PATH=C:\\bin\\cmake\\bin;%PATH%
387+
388+
C:\\OMDev\\tools\\msys\\usr\\bin\\sh --login -i '${env.WORKSPACE}/testMingw64-install.sh'
356389
357-
archiveArtifacts "OMSimulator-mingw64-*.zip"
358-
stash name: 'mingw64-zip', includes: "OMSimulator-mingw64-*.zip"
359-
stash name: 'mingw64-install', includes: "install/mingw/**"
390+
EXIT /b 0
391+
392+
:fail
393+
ECHO Something went wrong!
394+
EXIT /b 1
395+
"""
396+
397+
junit 'testsuite/partest/result.xml'
398+
}
399+
}
360400
}
361401
}
362402

@@ -402,29 +442,30 @@ pipeline {
402442
}
403443

404444
stage('msvc64') {
405-
when {
406-
expression { return params.MSVC64 }
407-
beforeAgent true
408-
}
409-
agent {
410-
label 'omsimulator-windows'
411-
}
412-
environment {
413-
PATH = "${env.PATH};C:\\bin\\git\\bin;C:\\bin\\git\\usr\\bin;C:\\OMDev\\tools\\msys\\mingw64\\bin\\"
414-
OMDEV = "/c/OMDev"
415-
MSYSTEM = "MINGW64"
416-
}
417-
418-
steps {
419-
bat 'hostname'
420-
writeFile file: "buildZip.sh", text: """#!/bin/sh
445+
stages {
446+
stage('build') {
447+
when {
448+
expression { return params.MSVC64 }
449+
beforeAgent true
450+
}
451+
agent {
452+
label 'omsimulator-windows'
453+
}
454+
environment {
455+
PATH = "${env.PATH};C:\\bin\\git\\bin;C:\\bin\\git\\usr\\bin;C:\\OMDev\\tools\\msys\\mingw64\\bin\\"
456+
OMDEV = "/c/OMDev"
457+
MSYSTEM = "MINGW64"
458+
}
459+
steps {
460+
bat 'hostname'
461+
writeFile file: "buildZip.sh", text: """#!/bin/sh
421462
set -x -e
422463
export PATH="/c/Program Files/TortoiseSVN/bin/:/c/bin/jdk/bin:/c/bin/nsis/:\$PATH:/c/bin/git/bin"
423464
cd "${env.WORKSPACE}/install/win"
424465
zip -r "../../OMSimulator-win64-`git describe --tags --abbrev=7 --match=v*.* --exclude=*-dev | sed \'s/-/.post/\'`.zip" *
425466
"""
426467

427-
retry(2) { bat """
468+
retry(2) { bat """
428469
set BOOST_ROOT=C:\\local\\boost_1_64_0
429470
set PATH=C:\\bin\\cmake\\bin;%PATH%
430471
@@ -446,8 +487,51 @@ ECHO Something went wrong!
446487
EXIT /b 1
447488
""" }
448489

449-
archiveArtifacts "OMSimulator-win64-*.zip"
450-
stash name: 'win64-zip', includes: "OMSimulator-win64-*.zip"
490+
archiveArtifacts "OMSimulator-win64-*.zip"
491+
stash name: 'win64-zip', includes: "OMSimulator-win64-*.zip"
492+
stash name: 'win64-install', includes: "install/win/**"
493+
}
494+
}
495+
stage('test') {
496+
agent {
497+
label 'omsimulator-windows'
498+
}
499+
environment {
500+
PATH = "${env.PATH};C:\\bin\\git\\bin;C:\\bin\\git\\usr\\bin;C:\\OMDev\\tools\\msys\\mingw64\\bin\\"
501+
OMDEV = "/c/OMDev"
502+
MSYSTEM = "MINGW64"
503+
RUNTESTDB="${env.HOME}/jenkins-cache/runtest/"
504+
}
505+
steps {
506+
unstash name: 'win64-install'
507+
508+
bat 'hostname'
509+
writeFile file: "testMSVC64-install.sh", text:"""#!/bin/sh
510+
set -x -e
511+
cd "${env.WORKSPACE}"
512+
export PATH="/c/Program Files/TortoiseSVN/bin/:/c/bin/jdk/bin:/c/bin/nsis/:\$PATH:/c/bin/git/bin"
513+
make -C testsuite difftool resources
514+
cp -f "${env.RUNTESTDB}/"* testsuite/ || true
515+
find testsuite/ -name "*.lua" -exec sed -i /teardown_command/d {} ";"
516+
cd testsuite/partest
517+
./runtests.pl -j\$(nproc) -platform=win -nocolour ${env.BRANCH_NAME == "master" ? "-notlm" : ""} -with-xml ${params.RUNTESTS_FLAG}
518+
"""
519+
bat """
520+
set BOOST_ROOT=C:\\local\\boost_1_64_0
521+
set PATH=C:\\bin\\cmake\\bin;%PATH%
522+
523+
C:\\OMDev\\tools\\msys\\usr\\bin\\sh --login -i '${env.WORKSPACE}/testMSVC64-install.sh'
524+
525+
EXIT /b 0
526+
527+
:fail
528+
ECHO Something went wrong!
529+
EXIT /b 1
530+
"""
531+
532+
junit 'testsuite/partest/result.xml'
533+
}
534+
}
451535
}
452536
}
453537

README.md

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ Note: Make sure to fetch the submodules, e.g., using `git submodule update --ini
4343

4444
### Linux / MacOS
4545

46-
1. install libxml2-dev
46+
1. Install libxml2-dev
4747

4848
```bash
4949
sudo apt-get install libxml2-dev
5050
```
5151

52-
1. configure OMSimulator
52+
1. Configure OMSimulator
5353

5454
```bash
5555
make config-3rdParty
@@ -58,20 +58,20 @@ Note: Make sure to fetch the submodules, e.g., using `git submodule update --ini
5858

5959
For the debug configuration add `BUILD_TYPE=Debug` to `make config-OMSimulator`.
6060

61-
1. build OMSimulator
61+
1. Build OMSimulator
6262

6363
```bash
6464
make OMSimulator -j4
6565
```
6666

6767
### Windows (OMDev mingw)
6868

69-
1. setup OMDev
69+
1. Setup OMDev
7070

7171
- Checkout OMDev (OpenModelica Development Environment): `git clone https://openmodelica.org/git/OMDev.git`
7272
- Follow the instructions in `OMDev/INSTALL.txt`
7373

74-
1. configure OMSimulator
74+
1. Configure OMSimulator
7575

7676
```bash
7777
make config-3rdParty
@@ -80,7 +80,7 @@ Note: Make sure to fetch the submodules, e.g., using `git submodule update --ini
8080

8181
For the debug configuration add `BUILD_TYPE=Debug` to `make config-OMSimulator`.
8282

83-
1. build OMSimulator
83+
1. Build OMSimulator
8484

8585
```bash
8686
make OMSimulator -j4
@@ -97,22 +97,71 @@ The following versions of Visual Studio are supported:
9797

9898
It is not strictly required to install the full Visual Studio IDE. The batch scripts only require *[Visual C++ Build Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools)*.
9999

100-
1. install boost (VS14: 1.63, VS15: 1.64)
100+
1. Install boost (VS14: 1.63, VS15: 1.64)
101101

102102
- Download and install precompiled boost libs, e.g. from [this](https://sourceforge.net/projects/boost/files/boost-binaries/) source
103103
- Set environment variable `BOOST_ROOT` to install path, e.g:
104104
- `BOOST_ROOT=C:\local\boost_1_64_0`
105105

106-
1. configure OMSimulator
106+
1. Configure OMSimulator
107107

108108
```bash
109-
configWinVS.bat VS15-Win64
109+
.\configWinVS.bat VS15-Win64
110110
```
111111

112112
To build the debug version change `CMAKE_BUILD_TYPE` to `Debug` or change the release type in Visual Studio to `debug`.
113113

114-
1. build OMSimulator
114+
1. Build OMSimulator
115115

116116
```bash
117-
buildWinVS.bat VS15-Win64
117+
.\buildWinVS.bat VS15-Win64
118118
```
119+
120+
## Test your build
121+
122+
The testsuite of OMSimulator is run on Jenkins for every commit and creating
123+
[test reports](https://test.openmodelica.org/jenkins/job/OMSimulator/job/master/lastSuccessfulBuild/testReport/).
124+
The project is tested for the following OS:
125+
- linux-arm32
126+
- linux64 without OMPython
127+
- cross-compiled mingw64
128+
- msvc64
129+
- cross-compiled OSX
130+
131+
In addition the [OpenModelica project](https://github.com/OpenModelica/OpenModelica) has a number of test cases using OMSimulator for FMU simulation that can be find in this [OpenModelica test reports](https://test.openmodelica.org/jenkins/job/OpenModelica/job/master/lastSuccessfulBuild/testReport/).
132+
133+
To verify your build is compiled and installed corrrectly see the following instructions.
134+
135+
### Linux / MacOS / Windows (OMDev mingw)
136+
137+
1. Build test dependencies
138+
```bash
139+
make -C testsuite/ difftool resources
140+
```
141+
142+
2. Run partest
143+
144+
```bash
145+
cd testsuite/partest/
146+
./runtests.pl -j4
147+
```
148+
Use `-jN` to test with `N` threads.
149+
To disable TLM tests add `-notlm`, to disable Python tests add `-asan`.
150+
151+
### Windows (Visual Studio)
152+
153+
We currently have no bat-Script to build and test with CMD, so you have to use OMDev mingw shell for the tests.
154+
155+
1. Build test dependencies
156+
```bash
157+
make -C testsuite/ difftool resources
158+
```
159+
160+
2. Run partest
161+
162+
```bash
163+
cd testsuite/partest/
164+
./runtests.pl -j4 -platform=win
165+
```
166+
Use `-jN` to test with `N` threads.
167+
To disable TLM tests add `-notlm`, to disable Python tests add `-asan`.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/*.fail_log
2+
/*.test_log

testsuite/AircraftVehicleDemonstrator/AircraftVehicleDemonstrator.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
-- status: correct
22
-- teardown_command: rm -rf AircraftVehicleDemonstrator_tmp/ AircraftVehicleDemonstrator.log AircraftVehicleDemonstrator*.dot AircraftVehicleDemonstrator_res.mat
33
-- linux: no
4-
-- mingw: yes
5-
-- win: yes
4+
-- mingw: no
5+
-- win: no
66

77
--oms_setLoggingLevel(0)
88
oms_setCommandLineOption("--suppressPath=true")

testsuite/OMSimulator/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*.fail_log
2+
/*.test_log
3+
/*.ssv
4+
/*.ssp
5+
/*.mat

testsuite/OMSimulator/PI_Controller.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- status: correct
22
-- teardown_command: rm -rf PI_Controller-lua/ PI_Controller_init.dot PI_Controller_sim.dot PI_Controller_res.mat PI_Controller.ssp
33
-- linux: yes
4-
-- mingw: yes
4+
-- mingw: no
55
-- win: no
66
-- mac: no
77

testsuite/OMSimulator/deleteConnector.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- status: correct
22
-- linux: yes
3-
-- mingw: yes
4-
-- win: yes
3+
-- mingw: no
4+
-- win: no
55
-- mac: yes
66

77
oms_setCommandLineOption("--suppressPath=true")

0 commit comments

Comments
 (0)