forked from ECP-WarpX/WarpX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_test.sh
executable file
·79 lines (66 loc) · 2.57 KB
/
run_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Copyright 2018-2020 Axel Huebl, David Grote, Edoardo Zoni
# Luca Fedeli, Maxence Thevenet, Remi Lehe
#
#
# This file is part of WarpX.
#
# License: BSD-3-Clause-LBNL
# This script runs some of WarpX's standard regression tests, but
# without comparing the output to previously run simulations.
# This checks that:
# - The code compiles and runs without error
# - For some of the tests, a Python script checks that the results are
# physically correct.
# The tests can be influenced by environment variables:
# Use `export WARPX_CI_DIM=3` or `export WARPX_CI_DIM=2` in order to
# select only the tests that correspond to this dimension
# Use `export WARPX_TEST_ARCH=CPU` or `export WARPX_TEST_ARCH=GPU` in order
# to run the tests on CPU or GPU respectively.
set -eu -o pipefail
# Parse command line arguments: if test names are given as command line arguments,
# store them in variable tests_arg and define new command line argument to call
# regtest.py with option --tests (works also for single test)
tests_arg=$*
tests_run=${tests_arg:+--tests=${tests_arg}}
# Remove contents and link to a previous test directory (intentionally two arguments)
rm -rf test_dir/* test_dir
# Create a temporary test directory
tmp_dir=$(mktemp --help >/dev/null 2>&1 && mktemp -d -t ci-XXXXXXXXXX || mktemp -d "${TMPDIR:-/tmp}"/ci-XXXXXXXXXX)
if [ $? -ne 0 ]; then
echo "Cannot create temporary directory"
exit 1
fi
# Copy WarpX into current test directory
mkdir ${tmp_dir}/warpx
cp -r ./* ${tmp_dir}/warpx
# Link the test directory
ln -s ${tmp_dir} test_dir
# Switch to the test directory
cd test_dir
echo "cd $PWD"
# Clone PICSAR and AMReX
git clone https://github.com/AMReX-Codes/amrex.git
cd amrex && git checkout e5b06d59e3a6cf55c40c6498e42eafe940203cb9 && cd -
# Use QED brach for QED tests
git clone https://github.com/ECP-WarpX/picsar.git
cd picsar && git checkout b35f07243c51ac35d47857fe36f0aafb6b517955 && cd -
# Clone the AMReX regression test utility
git clone https://github.com/ECP-WarpX/regression_testing.git
# Prepare regression tests
mkdir -p rt-WarpX/WarpX-benchmarks
cd warpx/Regression
echo "cd $PWD"
python prepare_file_travis.py
cp travis-tests.ini ../../rt-WarpX
cp -r Checksum ../../regression_testing/
# Run tests
cd ../../regression_testing/
echo "cd $PWD"
# run only tests specified in variable tests_arg (single test or multiple tests)
if [[ ! -z "${tests_arg}" ]]; then
python regtest.py ../rt-WarpX/travis-tests.ini --no_update all "${tests_run}"
# run all tests (variables tests_arg and tests_run are empty)
else
python regtest.py ../rt-WarpX/travis-tests.ini --no_update all
fi