Skip to content

Commit b2ce4a0

Browse files
authored
Merge pull request #33 from virtualcell/unit-tests
smoke tests on all platforms
2 parents 8b020bb + 68eb1f2 commit b2ce4a0

22 files changed

+1647
-58
lines changed

.github/workflows/cd.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
brew install llvm
6565
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/runner/.bash_profile
6666
source /Users/runner/.bash_profile
67+
ln -s $(which gfortran-14) /usr/local/bin/gfortran
6768
6869
gcc --version
6970
gfortran --version
@@ -218,7 +219,7 @@ jobs:
218219
mkdir build
219220
cd build
220221
221-
PATH="/c/Program\ Files/LLVM/bin:$PATH"
222+
export PATH="/c/Program\ Files/LLVM/bin:$PATH"
222223
223224
cmake \
224225
-G Ninja \
@@ -248,6 +249,9 @@ jobs:
248249
echo "working dir is $PWD"
249250
250251
cd build
252+
253+
export PATH="/d/a/_temp/msys64/clang64/bin:$PATH"
254+
pacman -Sy --noconfirm diffutils
251255
252256
ctest -VV
253257

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@
1919
/all_solvers/*
2020

2121
.DS_Store
22+
23+
NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat
24+
NFsim_v1.11/tests/smoke/SimID_273069657_0_.species
25+
26+
IDAWin/tests/smoke/SimID_1489333437_0_.ida

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ if (${OPTION_TARGET_DOCS})
127127
endif()
128128

129129
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
130-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
130+
if (APPLE)
131+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
132+
elseif (MINGW)
133+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
134+
else ()
135+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
136+
endif()
131137
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE STRING "Choose minimum deploy target for Macos machines")
132138
endif()
133139

Dockerfile

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
1-
FROM ubuntu:20.04 as build
1+
FROM python:3.9.7-slim AS build
22

33
RUN apt-get -y update && apt-get install -y apt-utils && \
44
apt-get install -y -qq -o=Dpkg::Use-Pty=0 build-essential gfortran zlib1g-dev \
5-
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python
6-
7-
#
8-
# build PETSc with mpich for static linking
9-
#
10-
RUN mkdir /usr/local/petsc && \
11-
cd /usr/local/petsc && \
12-
wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.7.7.tar.gz && \
13-
tar xzf petsc-3.7.7.tar.gz && \
14-
cd petsc-3.7.7 && \
15-
./configure --with-shared-libraries=0 --download-fblaslapack=1 --with-debugging=1 --download-mpich && \
16-
make PETSC_DIR=/usr/local/petsc/petsc-3.7.7 PETSC_ARCH=arch-linux2-c-debug all
17-
18-
ENV PETSC_DIR=/usr/local/petsc/petsc-3.7.7 \
19-
PETSC_ARCH=arch-linux2-c-debug
5+
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip
206

217
COPY . /vcellroot
228

23-
#
24-
# build most solvers, and FiniteVolume without PETSc (FiniteVolume_x64)
25-
#
269
RUN mkdir -p /vcellroot/build/bin
2710
WORKDIR /vcellroot/build
2811

@@ -41,33 +24,9 @@ RUN /usr/bin/cmake \
4124
-DOPTION_TARGET_HY3S_SOLVERS=OFF \
4225
.. && \
4326
make && \
44-
ctest
45-
46-
#
47-
# build FiniteVolume with PETSc (FiniteVolume_PETSc_x64)
48-
#
49-
RUN mkdir -p /vcellroot/build_PETSc/bin
50-
WORKDIR /vcellroot/build_PETSc
51-
52-
RUN /usr/bin/cmake \
53-
-DOPTION_TARGET_MESSAGING=ON \
54-
-DOPTION_TARGET_PARALLEL=OFF \
55-
-DOPTION_TARGET_PETSC=ON \
56-
-DOPTION_TARGET_CHOMBO2D_SOLVER=OFF \
57-
-DOPTION_TARGET_CHOMBO3D_SOLVER=OFF \
58-
-DOPTION_TARGET_SMOLDYN_SOLVER=OFF \
59-
-DOPTION_TARGET_FV_SOLVER=ON \
60-
-DOPTION_TARGET_STOCHASTIC_SOLVER=OFF \
61-
-DOPTION_TARGET_NFSIM_SOLVER=OFF \
62-
-DOPTION_TARGET_MOVINGBOUNDARY_SOLVER=OFF \
63-
-DOPTION_TARGET_SUNDIALS_SOLVER=OFF \
64-
-DOPTION_TARGET_HY3S_SOLVERS=OFF \
65-
.. && \
66-
make && \
67-
ctest
68-
27+
ctest -VV
6928

70-
FROM eclipse-temurin:17 as jre-build
29+
FROM eclipse-temurin:17 AS jre-build
7130

7231
# Create a custom Java runtime
7332
RUN $JAVA_HOME/bin/jlink \
@@ -81,22 +40,21 @@ RUN $JAVA_HOME/bin/jlink \
8140
# Define base image and copy in jlink created minimal Java 17 environment
8241
FROM python:3.9.7-slim
8342
ENV JAVA_HOME=/opt/java/openjdk
84-
ENV PATH "${JAVA_HOME}/bin:${PATH}"
43+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
8544
COPY --from=jre-build /javaruntime $JAVA_HOME
8645

8746
# now we have Java 17 and Python 3.9
88-
ENV DEBIAN_FRONTEND noninteractive
47+
ENV DEBIAN_FRONTEND=noninteractive
8948
ENV LANG=en_US.UTF-8
9049

91-
RUN apt-get update && \
50+
RUN apt-get -y update && \
9251
apt-get install -y apt-utils && \
9352
apt-get install -q -y --no-install-recommends curl dnsutils
9453

95-
RUN apt-get install -qq -y -o=Dpkg::Use-Pty=0 gcc gfortran zlib1g \
54+
RUN apt-get install -y -qq -o=Dpkg::Use-Pty=0 gcc gfortran zlib1g \
9655
libhdf5-103 libhdf5-cpp-103 libcurl4-openssl-dev zip
9756

9857
COPY --from=build /vcellroot/build/bin /vcellbin
99-
COPY --from=build /vcellroot/build_PETSc/bin/FiniteVolume_PETSc_x64 /vcellbin/
58+
10059
WORKDIR /vcellbin
10160
ENV PATH=/vcellbin:$PATH
102-

IDAWin/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ install(TARGETS IDAWin ARCHIVE DESTINATION bin)
3535

3636
enable_testing()
3737

38+
if (MINGW)
39+
set(test_sundials_exe ${CMAKE_BINARY_DIR}/bin/${EXE_FILE}.exe)
40+
set(python_cmd py)
41+
else (MINGW)
42+
set(test_sundials_exe ${CMAKE_BINARY_DIR}/bin/${EXE_FILE})
43+
set(python_cmd python3)
44+
endif (MINGW)
45+
set(test_dir ${CMAKE_CURRENT_SOURCE_DIR}/tests/smoke)
46+
47+
# smoke test as a python script, for bash test example, see NFsim/tests/smoke
48+
add_test(NAME ${EXE_FILE}_smoke COMMAND ${python_cmd} ${test_dir}/smoke.py ${test_sundials_exe} WORKING_DIRECTORY ${test_dir})
49+
50+
3851
add_executable(
3952
hello_test
4053
hello_test.cpp

IDAWin/SundialsSolverStandalone.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ int main(int argc, char *argv[]) {
194194
break;
195195
}
196196
}
197+
#ifdef USE_MESSAGING
198+
// should only happen during testing for solver compiled with messaging but run locally.
199+
if (SimulationMessaging::getInstVar() == nullptr) {
200+
SimulationMessaging::create();
201+
}
202+
#endif
197203

198204
if (solver.empty()) {
199205
throw "Solver not defined ";
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SOLVER CVODE
2+
STARTING_TIME 0.0
3+
ENDING_TIME 1.0
4+
RELATIVE_TOLERANCE 1.0E-9
5+
ABSOLUTE_TOLERANCE 1.0E-9
6+
MAX_TIME_STEP 1.0
7+
OUTPUT_TIMES 8
8+
0.0 1.0E-5 1.0E-4 0.001 0.01 0.1 0.5 1.0
9+
NUM_EQUATIONS 2
10+
ODE s2 INIT 4.0;
11+
RATE - ((2.0 * (-1.0 + (0.5 * s2)) * s2) - (4.0 * (3.5 - (0.5 * s2))));
12+
ODE s4 INIT 0.0;
13+
RATE 0.0;
14+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
##---------------------------------------------
2+
## /Users/jimschaff/.vcell/simdata/temp/SimID_1489333437_0_.functions
3+
##---------------------------------------------
4+
5+
Compartment::J_r0; ((2.0 * (-1.0 + (0.5 * s2)) * s2) - (4.0 * (3.5 - (0.5 * s2)))); ; Nonspatial_VariableType; false
6+
Compartment::J_r1; 0.0; ; Nonspatial_VariableType; false
7+
Compartment::s0; (2.0 * (-1.0 + (0.5 * s2))); ; Nonspatial_VariableType; false
8+
Compartment::s1; (2.0 * (3.5 - (0.5 * s2))); ; Nonspatial_VariableType; false
9+
Compartment::s3; - s4; ; Nonspatial_VariableType; false
10+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
t:s2:s4:
2+
0.00000000000000000E+00 4.00000000000000000E+00 0.00000000000000000E+00
3+
1.00000000000000008E-05 3.99998000095349759E+00 0.00000000000000000E+00
4+
1.00000000000000005E-04 3.99980008070643711E+00 0.00000000000000000E+00
5+
1.00000000000000002E-03 3.99800797408532871E+00 0.00000000000000000E+00
6+
1.00000000000000002E-02 3.98077784306128457E+00 0.00000000000000000E+00
7+
1.00000000000000006E-01 3.86170998966032331E+00 0.00000000000000000E+00
8+
5.00000000000000000E-01 3.74758417187014503E+00 0.00000000000000000E+00
9+
1.00000000000000000E+00 3.74179783773998942E+00 0.00000000000000000E+00
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
IDAData logfile
2+
IDAData text format version 1
3+
SimID_1489333437_0_.ida

0 commit comments

Comments
 (0)