forked from idaholab/FORCE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests
executable file
·103 lines (89 loc) · 2.79 KB
/
run_tests
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
echo 'Running FORCE tests ...'
SCRIPT_NAME=`readlink $0`
if test -x "$SCRIPT_NAME";
then
SCRIPT_DIRNAME=`dirname $SCRIPT_NAME`
else
SCRIPT_DIRNAME=`dirname $0`
fi
SCRIPT_DIR=`(cd $SCRIPT_DIRNAME; pwd)`
TEST_SET=2 # 0 for unit tests, 1 for integration tests, 2 for both
# source read ravenrc script
RAVEN_RC_SCRIPT=$SCRIPT_DIR/raven/scripts/read_ravenrc.sh
RAVEN_RC_SCRIPT="${RAVEN_RC_SCRIPT//\\//}"
source $RAVEN_RC_SCRIPT
# set up installation manager
INSTALLATION_MANAGER=$(read_ravenrc "INSTALLATION_MANAGER")
# read command-line arguments
ARGS=()
for A in "$@"; do
case $A in
--unit-tests)
TEST_SET=0
;;
--integration-tests)
TEST_SET=1
;;
--all-tests)
TEST_SET=2
;;
*)
ARGS+=("$A")
;;
esac
done
echo 'Loading libraries ...'
if [[ "$INSTALLATION_MANAGER" == "CONDA" ]];
then
source $SCRIPT_DIR/raven/scripts/establish_conda_env.sh --load
elif [[ "$INSTALLATION_MANAGER" == "PIP" ]];
then
source $SCRIPT_DIR/scripts/establish_conda_env.sh --load --installation-manager PIP
else
echo No installation: $INSTALLATION_MANAGER
if [ -z $PYTHON_COMMAND ];
then
# check the RC file
PYTHON_COMMAND=$(read_ravenrc "PYTHON_COMMAND")
fi
fi
#Note that this is from the perspective of python, otherwise would be
# identical to $SCRIPT_DIR (which matters on windows, but not elsewhere)
RAVEN_DIR=`$PYTHON_COMMAND $SCRIPT_DIR/raven/scripts/plugin_handler.py -r`
# run the tests
# success/fail storage
# Names of successful test sets are stored in "PASSED"
# Names of failed test sets are stored in "FAILED"
# Success of most recent test stored in "rc"
# Total number of failed test sets stored in "ALL_PASS"
# initialize vars in case no tests get run
ALL_PASS=0
PASSED=()
FAILED=()
echo
echo "********************************************************************************"
echo
case $TEST_SET in
0)
TEST_DIR=$SCRIPT_DIR/tests/unit_tests
echo Running FORCE unit tests from $TEST_DIR directory ...
;;
1)
TEST_DIR=$SCRIPT_DIR/tests/integration_tests
echo Running FORCE integration tests from $TEST_DIR directory ...
;;
2)
TEST_DIR=$SCRIPT_DIR/tests
echo Running FORCE unit and integration tests from $TEST_DIR directory ...
;;
esac
$PYTHON_COMMAND $SCRIPT_DIR/raven/rook/main.py --config-file=$SCRIPT_DIR/developer_tools/rook.ini --test-dir $TEST_DIR --testers-dir $RAVEN_DIR/scripts/TestHarness/testers,$RAVEN_DIR/../HERON/src/Testers "${ARGS[@]}"
# store return codes individually (rc) and combined (ALL_PASS)
rc=$?
ALL_PASS=$rc
if [[ $rc != 0 ]]; then
echo ' ... there were failed tests!'
else
echo ' ... tests passed successfully.'
fi # end "if passed"