summaryrefslogtreecommitdiff
path: root/lib/parse-test.sh
blob: 291211a9844cc865b3e6844ce55ae2c01c183f16 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44

parse_test_deps()
{
    export ktest_crashdump
    export ktest_out

    eval $( "$ktest_test" deps $ktest_testargs )

    parse_arch "$ktest_arch"

    if [ -z "$ktest_mem" ]; then
	echo "test must specify config-mem"
	exit 1
    fi

    if [ -z "$ktest_timeout" ]; then
	ktest_timeout=6000
    fi

    ktest_tests=$("$ktest_test" list-tests)
    ktest_tests=$(echo $ktest_tests)

    if [[ -z $ktest_tests ]] && ! $ktest_tests_unknown; then
	echo "No tests found"
	echo "TEST FAILED"
	exit 1
    fi

    local t

    # Ensure specified tests exist:
    if [[ -n $ktest_testargs ]]; then
	if ! $ktest_tests_unknown; then
	    for t in $ktest_testargs; do
		if ! echo "$ktest_tests"|grep -wq "$t"; then
		    echo "Test $t not found"
		    exit 1
		fi
	    done
	fi

	ktest_tests="$ktest_testargs"
    fi
}