-
Notifications
You must be signed in to change notification settings - Fork 31
/
run_gw_ci.sh
executable file
·80 lines (77 loc) · 2.49 KB
/
run_gw_ci.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
80
#!/bin/bash
set -u
# ==============================================================================
usage() {
set +x
echo
echo "Usage: $0 -d <directory> -o <output> -h"
echo
echo " -d Run build and ctest for clone in <directory>"
echo " -o Path to output message detailing results of CI tests"
echo " -h display this message and quit"
echo
exit 1
}
# ==============================================================================
while getopts "d:o:h" opt; do
case $opt in
d)
repodir=$OPTARG
;;
o)
outfile=$OPTARG
;;
h|\?|:)
usage
;;
esac
done
# ==============================================================================
# start output file
echo "Automated GW GDASApp Testing Results:" > $outfile
echo "Machine: ${TARGET}" >> $outfile
echo '```' >> $outfile
echo "Start: $(date) on $(hostname)" >> $outfile
echo "---------------------------------------------------" >> $outfile
# ==============================================================================
# run build and link as part of the workflow
export WORKFLOW_BUILD="ON"
cd $repodir/sorc
module purge
rm -rf log.build
./build_all.sh -u &>> log.build
build_status=$?
if [ $build_status -eq 0 ]; then
echo "Build: *SUCCESS*" >> $outfile
echo "Build: Completed at $(date)" >> $outfile
else
echo "Build: *FAILED*" >> $outfile
echo "Build: Failed at $(date)" >> $outfile
echo "Build: see output at $repodir/sorc/log.build" >> $outfile
echo '```' >> $outfile
exit $build_status
fi
./link_workflow.sh
# ==============================================================================
# run ctests
cd $repodir/sorc/gdas.cd/build
module use $repodir/sorc/gdas.cd/modulefiles
module load GDAS/$TARGET
echo "---------------------------------------------------" >> $outfile
rm -rf log.ctest
ctest -j${NTASKS_TESTS} -R gdasapp --output-on-failure &>> log.ctest
ctest_status=$?
npassed=$(cat log.ctest | grep "tests passed")
if [ $ctest_status -eq 0 ]; then
echo "Tests: *SUCCESS*" >> $outfile
echo "Tests: Completed at $(date)" >> $outfile
echo "Tests: $npassed" >> $outfile
else
echo "Tests: *Failed*" >> $outfile
echo "Tests: Failed at $(date)" >> $outfile
echo "Tests: $npassed" >> $outfile
cat log.ctest | grep "(Failed)" >> $outfile
echo "Tests: see output at $repodir/sorc/gdas.cd/build/log.ctest" >> $outfile
fi
echo '```' >> $outfile
exit $ctest_status