|
@@ -7,33 +7,44 @@ tf_enum_subtests() {
|
7
|
7
|
# Stub: enumerate subtests
|
8
|
8
|
#
|
9
|
9
|
tf_warn "implement tf_enum_subtests()!"
|
10
|
|
- return $TF_ES_ERROR
|
|
10
|
+ return "$TF_ES_ERROR"
|
11
|
11
|
}
|
12
|
12
|
|
13
|
|
-tf_name2cmd() {
|
|
13
|
+tf_do_subtest() {
|
14
|
14
|
#
|
15
|
|
- # Stub: expand test name to test command
|
|
15
|
+ # Stub: perform test named $1
|
16
|
16
|
#
|
17
|
|
- tf_warn "implement tf_name2cmd()!"
|
18
|
|
- return $TF_ES_ERROR
|
|
17
|
+ tf_warn "implement tf_do_subtest()!"
|
|
18
|
+ return "$TF_ES_ERROR"
|
19
|
19
|
}
|
20
|
20
|
|
21
|
|
-tf_do_subtest() {
|
|
21
|
+_tf_do_subtest() {
|
22
|
22
|
#
|
23
|
23
|
# Run single subtest inc. setup/cleanup if present
|
24
|
24
|
#
|
25
|
25
|
local subtname="$1" # this subtest name
|
26
|
26
|
local ses=0 # subtest exit status
|
27
|
|
- local tcmd="" # test command
|
28
|
27
|
local setup=true # setup command
|
29
|
28
|
local cleanup=true # cleanup command
|
30
|
|
- test -f TF_SETUP && setup=". TF_SETUP"
|
31
|
|
- test -f TF_CLEANUP && cleanup=". TF_CLEANUP"
|
|
29
|
+ if test -f TF_SETUP;
|
|
30
|
+ then
|
|
31
|
+ setup=". TF_SETUP"
|
|
32
|
+ bash -n TF_SETUP || {
|
|
33
|
+ tf_warn "synax errors in TF_SETUP, skipping"
|
|
34
|
+ return "$TF_ES_ERROR"
|
|
35
|
+ }
|
|
36
|
+ fi
|
|
37
|
+ if test -f TF_CLEANUP;
|
|
38
|
+ then
|
|
39
|
+ setup=". TF_CLEANUP"
|
|
40
|
+ bash -n TF_CLEANUP || {
|
|
41
|
+ tf_warn "synax errors in TF_CLEANUP, skipping"
|
|
42
|
+ return "$TF_ES_ERROR"
|
|
43
|
+ }
|
|
44
|
+ fi
|
32
|
45
|
if $setup;
|
33
|
46
|
then
|
34
|
|
- tcmd="$(tf_name2cmd "$subtname")"
|
35
|
|
- tf_debug "tcmd='$tcmd'"
|
36
|
|
- $tcmd; ses=$?
|
|
47
|
+ tf_do_subtest "$subtname"; ses=$?
|
37
|
48
|
else
|
38
|
49
|
tf_warn "setup phase failed, skipping: $subtname"
|
39
|
50
|
ses=$TF_ES_ERROR
|
|
@@ -43,7 +54,7 @@ tf_do_subtest() {
|
43
|
54
|
tf_warn "cleanup phase failed: $subtname"
|
44
|
55
|
ses=$TF_ES_PANIC
|
45
|
56
|
fi
|
46
|
|
- return $ses
|
|
57
|
+ return "$ses"
|
47
|
58
|
}
|
48
|
59
|
|
49
|
60
|
tf_do_subtests() {
|
|
@@ -55,19 +66,20 @@ tf_do_subtests() {
|
55
|
66
|
local tes="" # one subtest exit status
|
56
|
67
|
local enumd=TF_ENUMERATED_SUBTESTS
|
57
|
68
|
local fltrd=TF_FILTERED_SUBTESTS
|
58
|
|
- tf_enum_subtests >$enumd || { tf_warn "error enumerating subtests"; return $TF_ES_BAILOUT; }
|
59
|
|
- test -s $enumd || { tf_warn "no subtests enumerated"; return $TF_ES_BAILOUT; }
|
|
69
|
+ tf_enum_subtests >$enumd || { tf_warn "error enumerating subtests"; return "$TF_ES_BAILOUT"; }
|
|
70
|
+ test -s $enumd || { tf_warn "no subtests enumerated"; return "$TF_ES_BAILOUT"; }
|
60
|
71
|
grep -e "$TF_FILTER_SUBTEST" $enumd > $fltrd
|
61
|
72
|
test -s $fltrd || tf_debug "TF_FILTER_SUBTEST ate everything: $TF_FILTER_SUBTEST"
|
|
73
|
+
|
62
|
74
|
for subtname in $(<$fltrd);
|
63
|
75
|
do
|
64
|
76
|
export TF_SUBTNAME=$subtname
|
65
|
77
|
tf_think "::: $TF_TNAME::$TF_SUBTNAME"
|
66
|
|
- tf_do_subtest "$TF_SUBTNAME";
|
|
78
|
+ _tf_do_subtest "$TF_SUBTNAME";
|
67
|
79
|
tes=$?
|
68
|
|
- test $tes -gt $es && es=$tes
|
69
|
|
- test $tes -gt $TF_ES_OK && tf_warn "!!! $TF_TNAME::$TF_SUBTNAME ($tes)"
|
70
|
|
- test $tes -gt $TF_ES_BAILOUT && break
|
|
80
|
+ test $tes -gt $es && es=$tes
|
|
81
|
+ test $tes -gt "$TF_ES_OK" && tf_warn "!!! $TF_TNAME::$TF_SUBTNAME ($tes)"
|
|
82
|
+ test $tes -gt "$TF_ES_BAILOUT" && break
|
71
|
83
|
done
|
72
|
84
|
return $es
|
73
|
85
|
}
|