@@ -14,24 +14,26 @@ TEST_FILE=$(mktemp)
14
14
15
15
# This represents
16
16
#
17
- # TEST_ID:TEST_COUNT:ENABLED:TARGET
17
+ # TEST_ID:TEST_COUNT:ENABLED:TARGET:SKIP_NO_TARGET
18
18
#
19
19
# TEST_ID: is the test id number
20
20
# TEST_COUNT: number of times we should run the test
21
21
# ENABLED: 1 if enabled, 0 otherwise
22
22
# TARGET: test target file required on the test_sysctl module
23
+ # SKIP_NO_TARGET: 1 skip if TARGET not there
24
+ # 0 run eventhough TARGET not there
23
25
#
24
26
# Once these are enabled please leave them as-is. Write your own test,
25
27
# we have tons of space.
26
- ALL_TESTS=" 0001:1:1:int_0001"
27
- ALL_TESTS=" $ALL_TESTS 0002:1:1:string_0001"
28
- ALL_TESTS=" $ALL_TESTS 0003:1:1:int_0002"
29
- ALL_TESTS=" $ALL_TESTS 0004:1:1:uint_0001"
30
- ALL_TESTS=" $ALL_TESTS 0005:3:1:int_0003"
31
- ALL_TESTS=" $ALL_TESTS 0006:50:1:bitmap_0001"
32
- ALL_TESTS=" $ALL_TESTS 0007:1:1:boot_int"
33
- ALL_TESTS=" $ALL_TESTS 0008:1:1:match_int"
34
- ALL_TESTS=" $ALL_TESTS 0009:1:1:unregister_error"
28
+ ALL_TESTS=" 0001:1:1:int_0001:1 "
29
+ ALL_TESTS=" $ALL_TESTS 0002:1:1:string_0001:1 "
30
+ ALL_TESTS=" $ALL_TESTS 0003:1:1:int_0002:1 "
31
+ ALL_TESTS=" $ALL_TESTS 0004:1:1:uint_0001:1 "
32
+ ALL_TESTS=" $ALL_TESTS 0005:3:1:int_0003:1 "
33
+ ALL_TESTS=" $ALL_TESTS 0006:50:1:bitmap_0001:1 "
34
+ ALL_TESTS=" $ALL_TESTS 0007:1:1:boot_int:1 "
35
+ ALL_TESTS=" $ALL_TESTS 0008:1:1:match_int:1 "
36
+ ALL_TESTS=" $ALL_TESTS 0009:1:1:unregister_error:0 "
35
37
36
38
function allow_user_defaults()
37
39
{
@@ -614,7 +616,6 @@ target_exists()
614
616
TEST_ID=" $2 "
615
617
616
618
if [ ! -f ${TARGET} ] ; then
617
- echo " Target for test $TEST_ID : $TARGET not exist, skipping test ..."
618
619
return 0
619
620
fi
620
621
return 1
@@ -902,16 +903,36 @@ function get_test_target()
902
903
echo ${TEST_DATA} | awk -F" :" ' {print $4}'
903
904
}
904
905
906
+ function get_test_skip_no_target()
907
+ {
908
+ test_num $1
909
+ awk_field=$( remove_leading_zeros $1 )
910
+ TEST_DATA=$( echo $ALL_TESTS | awk ' {print $' $awk_field ' }' )
911
+ echo ${TEST_DATA} | awk -F" :" ' {print $5}'
912
+ }
913
+
914
+ function skip_test()
915
+ {
916
+ TEST_ID=$1
917
+ TEST_TARGET=$2
918
+ if target_exists $TEST_TARGET $TEST_ID ; then
919
+ TEST_SKIP=$( get_test_skip_no_target $TEST_ID )
920
+ if [[ $TEST_SKIP -eq " 1" ]]; then
921
+ echo " Target for test $TEST_ID : $TEST_TARGET not exist, skipping test ..."
922
+ return 0
923
+ fi
924
+ fi
925
+ return 1
926
+ }
927
+
905
928
function run_all_tests()
906
929
{
907
930
for i in $ALL_TESTS ; do
908
- TEST_ID=${i%:*:*:* }
931
+ TEST_ID=${i%:*:*:*:* }
909
932
ENABLED=$( get_test_enabled $TEST_ID )
910
933
TEST_COUNT=$( get_test_count $TEST_ID )
911
934
TEST_TARGET=$( get_test_target $TEST_ID )
912
- if target_exists $TEST_TARGET $TEST_ID ; then
913
- continue
914
- fi
935
+
915
936
if [[ $ENABLED -eq " 1" ]]; then
916
937
test_case $TEST_ID $TEST_COUNT $TEST_TARGET
917
938
fi
@@ -946,18 +967,19 @@ function watch_case()
946
967
947
968
function test_case()
948
969
{
970
+ TEST_ID=$1
949
971
NUM_TESTS=$2
972
+ TARGET=$3
950
973
951
- i=0
952
-
953
- if target_exists $3 $1 ; then
954
- continue
974
+ if skip_test $TEST_ID $TARGET ; then
975
+ return
955
976
fi
956
977
978
+ i=0
957
979
while [ $i -lt $NUM_TESTS ]; do
958
- test_num $1
959
- watch_log $i ${TEST_NAME} _test_$1 noclear
960
- RUN_TEST=${TEST_NAME} _test_$1
980
+ test_num $TEST_ID
981
+ watch_log $i ${TEST_NAME} _test_${TEST_ID} noclear
982
+ RUN_TEST=${TEST_NAME} _test_${TEST_ID}
961
983
$RUN_TEST
962
984
let i=$i +1
963
985
done
0 commit comments