[Fuego] [PATCH 15/18] LTP: skip tests that depend on unavailable commands

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Tue Jan 30 09:59:33 UTC 2018


Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
 engine/tests/Functional.LTP/fuego_test.sh | 35 +++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/engine/tests/Functional.LTP/fuego_test.sh b/engine/tests/Functional.LTP/fuego_test.sh
index 43d007d..2a6f7d7 100755
--- a/engine/tests/Functional.LTP/fuego_test.sh
+++ b/engine/tests/Functional.LTP/fuego_test.sh
@@ -93,6 +93,20 @@ function skip_tests {
     done
 }
 
+# $1: command/program to look for
+# $2: string with LTP test names separated by spaces
+function skip_if_command_unavailable {
+    local PROGRAM="$1"
+    local TESTS="$2"
+    export FOUND=""
+
+    is_on_target ${PROGRAM} FOUND /bin:/usr/bin:/usr/sbin:/usr/local/bin
+    if [ -z "${FOUND}" ]; then
+        echo "WARNING: ${PROGRAM} is not installed on the target."
+        skip_tests "${TESTS}"
+    fi
+}
+
 # $1: string with kernel config options separated by spaces
 # $2: string with LTP test names separated by spaces
 function skip_if_kconfig_differs {
@@ -178,6 +192,27 @@ function test_pre_check {
     skip_tests "inotify06" # will loop/crash kernels that dont have commit 8f2f3eb59dff (<4.2)
     skip_tests "ptrace03" # Only works for <2.6.26, above that the kernel allows to trace init
 
+    # Tests skipped depending on the availability of a command on the target
+    # FIXTHIS: only check the necessary ones
+    skip_if_command_unavailable bash "rwtest01 rwtest02 rwtest04 rwtest05 iogen01 fs_inod01 fs_di BindMounts"
+    skip_if_command_unavailable expect "su01"
+    skip_if_command_unavailable at "at_deny01 at_allow01"
+    skip_if_command_unavailable cron "cron cron02 cron_deny01 cron_allow01 cron_dirs_checks01"
+    skip_if_command_unavailable ar "ar"
+    skip_if_command_unavailable ld "ld01"
+    skip_if_command_unavailable ldd "ldd01"
+    skip_if_command_unavailable nm "nm01"
+    skip_if_command_unavailable file "file01"
+    skip_if_command_unavailable tar "tar01"
+    skip_if_command_unavailable logrotate "logrotate01"
+    skip_if_command_unavailable mkfs.ext3 "ext4-nsec-timestamps"
+    skip_if_command_unavailable mkfs.ext4 "ext4-nsec-timestamps"
+    skip_if_command_unavailable tune2fs "ext4-nsec-timestamps"
+    skip_if_command_unavailable mount "ext4-nsec-timestamps"
+    skip_if_command_unavailable umount "ext4-nsec-timestamps"
+    skip_if_command_unavailable touch "ext4-nsec-timestamps"
+    skip_if_command_unavailable quotacheck "quotactl01"
+
     # Tests skipped depending on the configuration of the target kernel
     skip_if_kconfig_differs "CONFIG_INOTIFY_USER=y" "inotify_init1_01 inotify_init1_02 inotify01 inotify02 inotify03 inotify04 inotify05 inotify06"
     skip_if_kconfig_differs "CONFIG_FANOTIFY=y CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y" "fanotify01 fanotify02 fanotify03 fanotify04 fanotify05 fanotify06"
-- 
2.7.4




More information about the Fuego mailing list