-
Notifications
You must be signed in to change notification settings - Fork 5
/
run_tests.sh
65 lines (56 loc) · 1.35 KB
/
run_tests.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
#!/usr/bin/env bash
red=$(tput setaf 1)
green=$(tput setaf 2)
reset=$(tput sgr0)
export NXF_VER=24.04.4
rundir=$(pwd)
export repodir=$(dirname "$(realpath -s "$0")")
export testdir="${repodir}/tests/"
export testdata="${rundir}/static-resources/test-data/ddamsproteomics"
if [ -e "${testdata}" ]
then
cd "${testdata}" && git checkout ddamsproteomics_test_data && cd "${rundir}"
else
git clone --single-branch --branch ddamsproteomics_test_data https://github.com/lehtiolab/static-resources
fi
[ -e test_output ] && rm -r test_output
mkdir test_output
declare -A results
test_names=(
labelfree
labelfree_phos
tmt16
tmt18
tmt16_18
tims
)
if [ -z "$1" ]
then
# Run all tests, do not exit with failures
# Manual runs
for testname in ${test_names[@]}
do
bash "${testdir}/${testname}.sh"
results["$testname"]="$?"
done
for testname in ${test_names[@]}
do
if [[ ${results["$testname"]} == 0 ]]
then
echo ${green}"$testname" - SUCCESS ${reset}
else
echo ${red}"$testname" - FAIL ${reset}
fi
done
else
# Single test, exit with error when failing
# Used in github actions
bash "${testdir}/$1.sh"
if [[ "$?" == 0 ]]
then
echo ${green}"$1" - SUCCESS ${reset}
else
echo ${red}"$1" - FAIL ${reset}
exit 1
fi
fi