-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_examples.sh
executable file
·67 lines (62 loc) · 1.63 KB
/
check_examples.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
#!/bin/bash
#
# Runs examples in LIST
#
script_dir=$(dirname "$0")
pushd $script_dir
path=$(pwd)
function cleanup() {
rm -f check-*.txt
rm -f make-fail.txt
rm -f failing-tests.txt
rm -f passing-tests.txt
}
echo ""
echo -e "$ORG"RUNNING ALL TESTS IN: $path"$BLK"
echo ""
echo "************************************************************************************"
echo " A non-zero exit code means a failure occured."
echo "************************************************************************************"
#Loop over all directories and run the check script
if [ "$#" -ne 0 ]; then
LIST="$@"
elif [ "$EPSDB" != "1" ]; then
LIST="fortran hip openmp cloc"
else
LIST="fortran openmp"
fi
echo LIST: $LIST
for directory in $LIST; do
pushd $directory > /dev/null
cleanup
echo "====== $directory ======" >> check-"$directory".txt
for testdir in ./*/; do
pushd $testdir > /dev/null
testdir=$(echo $testdir | sed 's/.\///; s/\///')
make clean
make
if [ $? -ne 0 ]; then
echo "$testdir" >> ../make-fail.txt
echo " Return Code for $testdir: Make Failed" >> ../check-"$directory".txt
else
make run
result=$?
if [ $result -ne 0 ]; then
echo "$testdir" >> ../failing-tests.txt
else
echo "$testdir" >> ../passing-tests.txt
fi
echo " Return Code for $testdir: $result" >> ../check-"$directory".txt
fi
popd > /dev/null
done
echo "" >> check-"$directory".txt
popd > /dev/null
done
echo -e "$ORG"FINAL RESULTS:"$BLK"
for directory in $LIST ; do
(cd "$directory" && path=$(pwd) && base=$(basename $path)
cat check-$base.txt
)
done
popd