Skip to content

Commit

Permalink
Merge pull request #39 from AFD-Illinois/feature/ci
Browse files Browse the repository at this point in the history
Add CI
  • Loading branch information
Ben Prather authored Apr 27, 2020
2 parents 1509696 + fc7974e commit 0d61df0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build:
before_script:
- cd tests
- bash download_tests.sh

script:
- bash run_tests.sh
3 changes: 3 additions & 0 deletions machines/lmc.make
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# LMC has this, so prevent problems with Anaconda
CC=h5pcc
# Prevent a bunch of compiler warnings
CFLAGS_CUSTOM = -D_DEFAULT_SOURCE
5 changes: 5 additions & 0 deletions scripts/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@ def dssim(imageI, imageK):
evpatot2 = 180./3.14159*0.5*np.arctan2(U2.sum(),Q2.sum())
print("Diff EVPA [deg]: {:g}".format(evpatot2 - evpatot1))

# Return code for automated testing. Adjust stringency to taste
if rdiffI > 0.01 or rdiffQ > 0.01 or rdiffU > 0.01 or rdiffV > 0.01:
exit(1)
else:
exit(0)
File renamed without changes.
9 changes: 8 additions & 1 deletion tests/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# Run all the ipole tests
# Tests have the form test_name/test_name.par
# Different compilation options are usually not necessary,
# except thin_disk, special-cased here

# TODO download the reference files if necessary?
# TODO could update test dumps with rsync here
# TODO option for linear propagation test soon

if [[ $(hostname) == "bh"* ]]; then
module load gnu hdf5
fi

for folder in */
do
Expand Down
4 changes: 3 additions & 1 deletion tests/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

folder=$(basename $PWD)

# Note these return nonzero exit code for most test runs...
echo "Pixels different by >1% absolute"
h5diff -d 1.e-2 ../test-resources/${folder}_image.h5 image.h5 /pol
echo "Pixels different by >1% relative"
h5diff -p 1.e-2 ../test-resources/${folder}_image.h5 iamge.h5 /pol
h5diff -p 1.e-2 ../test-resources/${folder}_image.h5 image.h5 /pol

# ...but we should only fail if this one returns nonzero
python ../../scripts/compare.py ../test-resources/${folder}_image.h5 image.h5

0 comments on commit 0d61df0

Please sign in to comment.