Permalink
Browse files

tests: check commands needed for running a test exist

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
  • Loading branch information...
1 parent 22c3c4f commit 2f791546395cb43f3f93de6c095c812c7cd5237f @kerolasa kerolasa committed with Feb 16, 2014
Showing with 373 additions and 30 deletions.
  1. +7 −2 tests/functions.sh
  2. +2 −0 tests/ts/bitops/swapbytes
  3. +1 −3 tests/ts/blkid/low-probe
  4. +1 −3 tests/ts/blkid/lowprobe-pt
  5. +4 −0 tests/ts/blkid/md-raid0-whole
  6. +4 −0 tests/ts/blkid/md-raid1-part
  7. +4 −0 tests/ts/blkid/md-raid1-whole
  8. +2 −0 tests/ts/cal/1m
  9. +2 −0 tests/ts/cal/1mw
  10. +2 −0 tests/ts/cal/3m
  11. +2 −0 tests/ts/cal/3mw
  12. +2 −0 tests/ts/cal/bigyear
  13. +2 −0 tests/ts/cal/bigyearw
  14. +2 −0 tests/ts/cal/color
  15. +2 −0 tests/ts/cal/colorw
  16. +2 −0 tests/ts/cal/sep1752
  17. +2 −0 tests/ts/cal/sep1752w
  18. +2 −0 tests/ts/cal/weekarg
  19. +3 −1 tests/ts/cal/weeknum
  20. +2 −0 tests/ts/cal/year
  21. +2 −0 tests/ts/cal/yearw
  22. +2 −0 tests/ts/col/multibyte
  23. +2 −0 tests/ts/colrm/rm2-2
  24. +2 −0 tests/ts/column/fillrow
  25. +3 −1 tests/ts/column/multi-file
  26. +2 −0 tests/ts/column/separator_table
  27. +5 −0 tests/ts/cramfs/doubles
  28. +4 −0 tests/ts/cramfs/fsck-endianness
  29. +6 −0 tests/ts/cramfs/mkfs
  30. +3 −0 tests/ts/cramfs/mkfs-endianness
  31. +2 −0 tests/ts/dmesg/console-levels
  32. +2 −0 tests/ts/dmesg/decode
  33. +2 −0 tests/ts/dmesg/delta
  34. +2 −0 tests/ts/dmesg/facilities
  35. +6 −2 tests/ts/eject/umount
  36. +3 −0 tests/ts/fdisk/align-512-4K
  37. +3 −0 tests/ts/fdisk/align-512-4K-63
  38. +3 −0 tests/ts/fdisk/align-512-4K-md
  39. +3 −0 tests/ts/fdisk/align-512-512
  40. +3 −0 tests/ts/fdisk/align-512-512-topology
  41. +3 −1 tests/ts/fdisk/bsd
  42. +3 −1 tests/ts/fdisk/gpt
  43. +2 −0 tests/ts/fdisk/id
  44. +2 −0 tests/ts/fdisk/mbr-dos-mode
  45. +4 −2 tests/ts/fdisk/mbr-nondos-mode
  46. +2 −0 tests/ts/fdisk/oddinput
  47. +2 −0 tests/ts/fdisk/sunlabel
  48. +4 −0 tests/ts/fsck/ismounted
  49. +1 −1 tests/ts/hexdump/format-strings
  50. +3 −0 tests/ts/hwclock/systohc
  51. +2 −0 tests/ts/ipcs/headers
  52. +3 −0 tests/ts/ipcs/limits
  53. +3 −0 tests/ts/ipcs/limits2
  54. +4 −0 tests/ts/ipcs/mk-rm-msg
  55. +4 −0 tests/ts/ipcs/mk-rm-sem
  56. +4 −0 tests/ts/ipcs/mk-rm-shm
  57. +2 −0 tests/ts/isosize/print-size
  58. +1 −1 tests/ts/last/ipv6
  59. +1 −1 tests/ts/last/last
  60. +6 −1 tests/ts/libmount/context
  61. +6 −0 tests/ts/libmount/context-py
  62. +4 −0 tests/ts/libmount/context-utab
  63. +5 −0 tests/ts/libmount/context-utab-py
  64. +2 −0 tests/ts/login/islocal
  65. +2 −0 tests/ts/login/logindefs
  66. +2 −0 tests/ts/look/separator
  67. +3 −0 tests/ts/losetup/losetup
  68. +3 −1 tests/ts/lscpu/lscpu
  69. +3 −2 tests/ts/minix/fsck
  70. +3 −2 tests/ts/minix/mkfs
  71. +2 −0 tests/ts/misc/fallocate
  72. +2 −0 tests/ts/misc/getopt
  73. +2 −0 tests/ts/misc/ionice
  74. +1 −3 tests/ts/misc/line
  75. +2 −0 tests/ts/misc/mcookie
  76. +2 −0 tests/ts/misc/rev
  77. +2 −0 tests/ts/misc/setarch
  78. +2 −0 tests/ts/misc/setsid
  79. +2 −0 tests/ts/misc/ul
  80. +2 −0 tests/ts/misc/whereis
  81. +2 −0 tests/ts/more/regexp
  82. +2 −0 tests/ts/more/squeeze
  83. +4 −0 tests/ts/mount/devname
  84. +5 −0 tests/ts/mount/fstab-broken
  85. +4 −0 tests/ts/mount/fstab-devname
  86. +4 −0 tests/ts/mount/fstab-devname2label
  87. +4 −0 tests/ts/mount/fstab-devname2uuid
  88. +4 −0 tests/ts/mount/fstab-label
  89. +4 −0 tests/ts/mount/fstab-label2devname
  90. +4 −0 tests/ts/mount/fstab-label2uuid
  91. +5 −0 tests/ts/mount/fstab-none
  92. +4 −0 tests/ts/mount/fstab-symlink
  93. +4 −0 tests/ts/mount/fstab-uuid
  94. +4 −0 tests/ts/mount/fstab-uuid2devname
  95. +4 −0 tests/ts/mount/fstab-uuid2label
  96. +4 −0 tests/ts/mount/label
  97. +5 −0 tests/ts/mount/move
  98. +3 −0 tests/ts/mount/noncanonical
  99. +3 −0 tests/ts/mount/paths
  100. +4 −0 tests/ts/mount/regfile
  101. +4 −0 tests/ts/mount/remount
  102. +4 −0 tests/ts/mount/rlimit
  103. +5 −0 tests/ts/mount/shared-subtree
  104. +3 −0 tests/ts/mount/special
  105. +5 −0 tests/ts/mount/umount-alltargets
  106. +5 −0 tests/ts/mount/umount-recursive
  107. +4 −0 tests/ts/mount/uuid
  108. +2 −0 tests/ts/namei/logic
  109. +5 −2 tests/ts/partx/partx
  110. +2 −0 tests/ts/schedutils/cpuset
  111. +2 −0 tests/ts/script/race
  112. +5 −0 tests/ts/swapon/devname
  113. +5 −0 tests/ts/swapon/fixpgsz
  114. +5 −0 tests/ts/swapon/fixsig
  115. +5 −0 tests/ts/swapon/label
  116. +5 −0 tests/ts/swapon/uuid
  117. +2 −0 tests/ts/tailf/simple
  118. +2 −0 tests/ts/utmpdump/ipv6tobin
  119. +2 −0 tests/ts/utmpdump/ipv6totxt
  120. +2 −0 tests/ts/utmpdump/to-binary
  121. +2 −0 tests/ts/utmpdump/to-text
  122. +2 −0 tests/ts/wipefs/wipefs
View
@@ -37,7 +37,12 @@ function ts_report {
else
echo "$1"
fi
+}
+function ts_check_test_command {
+ if [ ! -x "$1" ]; then
+ ts_skip "${1##*/} not found"
+ fi
}
function ts_skip_subtest {
@@ -371,7 +376,7 @@ function ts_die {
ts_log "$1"
if [ -n "$2" ] && [ -b "$2" ]; then
ts_device_deinit "$2"
- ts_fstab_clean # for sure...
+ ts_fstab_clean # for sure...
fi
ts_finalize
}
@@ -384,7 +389,7 @@ function ts_image_md5sum {
function ts_image_init {
local mib=${1:-"5"} # size in MiBs
local img=${2:-"$TS_OUTDIR/${TS_TESTNAME}.img"}
-
+
dd if=/dev/zero of="$img" bs=1M count=$mib &> /dev/null
echo "$img"
return 0
@@ -21,6 +21,8 @@ TS_DESC="swap bytes"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_HELPER_BYTESWAP"
+
$TS_HELPER_BYTESWAP >> $TS_OUTPUT
ts_finalize
@@ -23,9 +23,7 @@ TS_DESC="low-level superblocks probing"
ts_init "$*"
-if [ ! -x "$TS_CMD_BLKID" ]; then
- ts_skip "blkid disabled"
-fi
+ts_check_test_command "$TS_CMD_BLKID"
mkdir -p $TS_OUTDIR/images-fs
@@ -23,9 +23,7 @@ TS_DESC="partitions probing"
ts_init "$*"
-if [ ! -x "$TS_HELPER_PARTITIONS" ]; then
- ts_skip "blkid disabled"
-fi
+ts_check_test_command "$TS_HELPER_PARTITIONS"
mkdir -p $TS_OUTDIR/images-pt
@@ -21,6 +21,10 @@ TS_DESC="MD raid0 (whole-disks)"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
+ts_check_test_command "$TS_CMD_FDISK"
+ts_check_test_command "$TS_CMD_BLKID"
+
ts_skip_nonroot
[ -x /sbin/mdadm ] || ts_skip "missing mdadm"
@@ -21,6 +21,10 @@ TS_DESC="MD raid1 (last partition)"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
+ts_check_test_command "$TS_CMD_FDISK"
+ts_check_test_command "$TS_CMD_BLKID"
+
ts_skip_nonroot
DEVICE=$(ts_scsi_debug_init dev_size_mb=51 sector_size=512)
@@ -21,6 +21,10 @@ TS_DESC="MD raid1 (whole-disks)"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
+ts_check_test_command "$TS_CMD_FDISK"
+ts_check_test_command "$TS_CMD_BLKID"
+
ts_skip_nonroot
[ -x /sbin/mdadm ] || ts_skip "missing mdadm"
View
@@ -22,6 +22,8 @@ TS_DESC="1 month"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
View
@@ -22,6 +22,8 @@ TS_DESC="1 month with week numbers"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
View
@@ -21,6 +21,8 @@ TS_DESC="3 months"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
View
@@ -21,6 +21,8 @@ TS_DESC="3 months with week numbers"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
USETERM=$( ts_has_option "useterm" "$*" )
@@ -18,6 +18,8 @@ TS_DESC="Year 2147483646"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
@@ -18,6 +18,8 @@ TS_DESC="Year 2147483646 with week numbers"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
View
@@ -20,6 +20,8 @@ TS_DESC="color"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
# --color output depends on terminal type
export TERM=linux
View
@@ -20,6 +20,8 @@ TS_DESC="color with week numbers"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
# --color output depends on terminal type
export TERM=linux
@@ -18,6 +18,8 @@ TS_DESC="September 1752"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
@@ -18,6 +18,8 @@ TS_DESC="September 1752 with week numbers"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
@@ -21,6 +21,8 @@ TS_DESC="week number given as argument"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
@@ -21,6 +21,8 @@ TS_DESC="week number corner cases"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
@@ -29,7 +31,7 @@ USETERM=$( ts_has_option "useterm" "$*" )
[ "$USETERM" == "yes" ] && TS_VERBOSE="yes"
ts_log ""
-for x in 2001 2002 2003 2009 2010 2011 2012 ; do
+for x in 2001 2002 2003 2009 2010 2011 2012 ; do
MYTIME="1 $x"
ts_log "Gregorian - Monday-based week with week numbers - year $x"
View
@@ -21,6 +21,8 @@ TS_DESC="year"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
View
@@ -21,6 +21,8 @@ TS_DESC="year with week numbers"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_CAL"
+
set -o pipefail
export TERM=linux
@@ -21,6 +21,8 @@ TS_DESC="multibyte input"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_COL"
+
cat $TS_SELF/multibyte.data | $TS_CMD_COL > /dev/null 2> $TS_OUTPUT
ts_finalize
@@ -21,6 +21,8 @@ TS_DESC="basic check"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_COLRM"
+
printf "a b\nc\td\nef\b\tg\n" | $TS_CMD_COLRM 2 2 > $TS_OUTPUT 2>&1
ts_finalize
@@ -21,6 +21,8 @@ TS_DESC="fill row"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_COLUMN"
+
cd $TS_OUTDIR
$TS_CMD_COLUMN -x -c 50 $TS_SELF/input >> $TS_OUTPUT 2>&1
@@ -2,7 +2,7 @@
#
# Copyright (C) 2011 Sami Kerola <kerolasa@iki.fi>
-# 2011 Karel Zak <kzak@redhat.com>
+# 2011 Karel Zak <kzak@redhat.com>
#
# This file is part of util-linux.
#
@@ -22,6 +22,8 @@ TS_DESC="multiple files"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_COLUMN"
+
cd $TS_OUTDIR
$TS_CMD_COLUMN -x -c 50 $TS_SELF/input \
@@ -21,6 +21,8 @@ TS_DESC="separator & table"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_COLUMN"
+
cd $TS_OUTDIR
$TS_CMD_COLUMN -s 2 -t $TS_SELF/input >> $TS_OUTPUT 2>&1
@@ -20,6 +20,11 @@ TS_DESC="mkfs doubles"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
+ts_check_test_command "$TS_CMD_MKCRAMFS"
+ts_check_test_command "$TS_CMD_MOUNT"
+ts_check_test_command "$TS_CMD_UMOUNT"
+
ts_skip_nonroot
set -o pipefail
@@ -20,6 +20,10 @@ TS_DESC="fsck endianness"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
+ts_check_test_command "$TS_CMD_MKCRAMFS"
+ts_check_test_command "$TS_CMD_FSCKCRAMFS"
+
ts_skip_nonroot
set -o pipefail
@@ -20,6 +20,12 @@ TS_DESC="mkfs checksums"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
+ts_check_test_command "$TS_CMD_MKCRAMFS"
+ts_check_test_command "$TS_CMD_MOUNT"
+ts_check_test_command "$TS_CMD_UMOUNT"
+ts_check_test_command "$TS_CMD_LOSETUP"
+
ts_skip_nonroot
set -o pipefail
@@ -20,6 +20,9 @@ TS_DESC="mkfs endianness"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
+ts_check_test_command "$TS_CMD_MKCRAMFS"
+
ts_skip_nonroot
set -o pipefail
@@ -18,6 +18,8 @@ TS_DESC="levels"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_DMESG"
+
for I in {-1..8}; do
$TS_CMD_DMESG -F $TS_SELF/input -l $I >> $TS_OUTPUT 2>/dev/null
done
@@ -18,6 +18,8 @@ TS_DESC="decode"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_DMESG"
+
$TS_CMD_DMESG -x -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null
ts_finalize
@@ -18,6 +18,8 @@ TS_DESC="delta"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_DMESG"
+
$TS_CMD_DMESG -d -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null
ts_finalize
@@ -18,6 +18,8 @@ TS_DESC="facilities"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_CMD_DMESG"
+
for I in {-1..12}; do
$TS_CMD_DMESG -F $TS_SELF/input -f $I >> $TS_OUTPUT 2>/dev/null
done
@@ -5,10 +5,14 @@ TS_DESC="umount"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
+ts_check_test_command "$TS_CMD_FDISK"
+ts_check_test_command "$TS_CMD_EJECT"
+
ts_skip_nonroot
#
-# Note that eject --force is required because scsi_debug is
+# Note that eject --force is required because scsi_debug is
# not removable device.
#
@@ -35,7 +39,7 @@ p
w
EOF
udevadm settle
- mkfs.ext2 -q ${dev}1
+ mkfs.ext2 -q ${dev}1
mkfs.ext2 -q ${dev}2
udevadm settle
}
Oops, something went wrong. Retry.

0 comments on commit 2f79154

Please sign in to comment.