aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/run.sh
blob: 0835d9a898fbe7a18f468bffa81e73cc622b6f92 (plain)
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
set -e

export ducc="../../../build/$BIN"

export testcase=$1
export tmp_dir="tests/tmp/$testcase"

c_test_file="tests/$testcase.c"
sh_test_file="tests/$testcase.sh"

if [[ -f "$c_test_file" ]]; then
    source tests/helpers.sh

    echo "$c_test_file"
    mkdir -p "$tmp_dir"
    cd "$tmp_dir"
    test_exit_code < "../../../$c_test_file"
    cd "../../.."
elif [[ -f "$sh_test_file" ]]; then
    source tests/helpers.sh

    echo "$sh_test_file"
    mkdir -p "$tmp_dir"
    cd "$tmp_dir"
    source "../../../$sh_test_file"
    cd "../../.."
else
    echo "no test $testcase" >&2
    exit 1
fi