forked from sterlingbaldwin/acme_processflow
-
Notifications
You must be signed in to change notification settings - Fork 5
/
test
77 lines (70 loc) · 2.3 KB
/
test
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
#!/bin/bash
PASSED=0
TOTAL=0
SECONDS=0
pip install -e .
tests=( "tests/test_e3sm.py"
"tests/test_aprime.py"
"tests/test_amwg.py"
"tests/test_climo.py"
"tests/test_filemanager.py"
"tests/test_initialize.py"
"tests/test_mailer.py"
"tests/test_slurm.py"
"tests/test_finalize.py"
"tests/test_runmanager.py"
"tests/test_timeseries.py"
"tests/test_util.py"
"tests/test_verify_config.py"
#"tests/test_processflow.py"
)
if [ "$1" == "all" ]; then
echo "Running end to end tests"
tests+=("tests/test_processflow_run.py")
tests+=("tests/test_transfer.py")
elif [ "$1" == "globus" ]; then
tests+=("tests/test_transfer.py")
echo "Running with Globus transfer tests"
elif [ "$1" == "processflow_only" ]; then
tests=("tests/test_processflow_run.py")
echo "Only running end to end tests"
else
echo "Skipping end to end and file transfer tests"
fi
for test in "${tests[@]}"
do
if [ -d test.db ]; then
rm test.db
fi
(( TOTAL+=1 ))
tname=$(python -c "name='${test}';tname=name.split('/')[-1].split('.')[0];print tname")
echo "--- running ${tname} ---"
if COVERAGE_FILE=.coverage_$tname coverage run --source=processflow --omit="processflow/resources/*","tests/test_*","*__init__.py","setup.py" $test; then
echo "--- ${tname} passed ---"
(( PASSED+=1 ))
else
echo "==================================================="
echo "==================================================="
echo "${tname} failed"
echo "==================================================="
echo "==================================================="
fi
done
coverage combine .coverage_*
coverage report
coverage html
coverage xml
echo $PASSED "out of" $TOTAL "modules passed their tests"
duration=$SECONDS
echo "Tests ran in $(($duration / 60)) minutes and $(($duration % 60)) seconds."
if [ "$PASSED" != "$TOTAL" ]; then
echo "One or more tests failed"
exit 1
else
if [ -d /var/www/acme/acme-diags/baldwin32/htmlcov ]; then
rm -rf /var/www/acme/acme-diags/baldwin32/htmlcov
fi
mv htmlcov /var/www/acme/acme-diags/baldwin32
echo "tests done"
echo "report available at https://acme-viewer.llnl.gov/baldwin32/htmlcov/"
fi