Rename tst_test_* to tst_require_*
Hi,
these patches rename tst_test_* to tst_require_*, to better describe their use. There is also tst_require_root, that has the same
behavior: It also calls tst_brk in case of a failing requirement.
You can also get this patch from the following repo:
https://github.com/MofX/ltp/commits/rename_tst_test-tst_require
J?rg
doc/test-writing-guidelines.txt | 2 +- testcases/commands/mkfs/mkfs01.sh | 2 +- testcases/kernel/containers/netns/netns_breakns.sh | 2 +- testcases/kernel/containers/netns/netns_helper.sh | 4 ++-- testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 2 +- testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 4 ++-- testcases/kernel/device-drivers/zram/zram01.sh | 2 +- testcases/kernel/device-drivers/zram/zram_lib.sh | 6 +++--- testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/ext4-alloc-test.sh | 2 +- testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh | 2 +- testcases/kernel/fs/ext4-new-features/ext4-online-defrag/ext4_online_defrag_test.sh | 4 ++-- testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh | 2 +- testcases/kernel/fs/iso9660/isofs.sh | 2 +- testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 2 +- testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 2 +- testcases/kernel/io/stress_floppy/stress_floppy | 2 +- testcases/kernel/power_management/runpwtests05.sh | 2 +- testcases/kernel/power_management/runpwtests_exclusive01.sh | 2 +- testcases/kernel/power_management/runpwtests_exclusive02.sh | 2 +- testcases/kernel/power_management/runpwtests_exclusive03.sh | 2 +- testcases/kernel/power_management/runpwtests_exclusive04.sh | 2 +- testcases/kernel/power_management/runpwtests_exclusive05.sh | 2 +- testcases/lib/test.sh | 2 +- testcases/lib/tst_net.sh | 10 +++++----- testcases/lib/tst_test.sh | 12 ++++++------ testcases/network/multicast/mc_commo/mc_commo.sh | 2 +- testcases/network/multicast/mc_member/mc_member.sh | 2 +- testcases/network/stress/dns/dns-stress.sh | 2 +- testcases/network/stress/ftp/ftp-download-stress.sh | 2 +- testcases/network/stress/ftp/ftp-download-stress01-rmt.sh | 2 +- testcases/network/stress/ftp/ftp-download-stress02-rmt.sh | 2 +- testcases/network/stress/ftp/ftp-upload-stress.sh | 4 ++-- testcases/network/stress/ftp/ftp-upload-stress01-rmt.sh | 2 +- testcases/network/stress/ftp/ftp-upload-stress02-rmt.sh | 2 +- testcases/network/stress/http/http-stress01-rmt.sh | 2 +- testcases/network/stress/http/http-stress02-rmt.sh | 2 +- testcases/network/stress/interface/if-lib.sh | 2 +- testcases/network/stress/ns-tools/tst_net_stress.sh | 2 +- testcases/network/stress/ssh/ssh-stress.sh | 2 +- testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 2 +- testcases/network/tcp_cmds/ping/ping01.sh | 2 +- testcases/network/tcp_cmds/ping/ping02.sh | 2 +- testcases/network/tcp_cmds/rlogin/rlogin01.sh | 2 +- testcases/network/tcp_cmds/sendfile/sendfile01.sh | 2 +- testcases/network/tcp_cmds/tcpdump/tcpdump01.sh | 2 +- testcases/network/tcp_cmds/telnet/telnet01.sh | 2 +- testcases/network/tcp_cmds/tracepath/tracepath01.sh | 2 +- testcases/network/virt/virt_lib.sh | 4 ++-- testcases/network/xinetd/xinetd_tests.sh | 2 +- 49 files changed, 65 insertions(+), 65 deletions(-)
PATCH 1/2 shell: Rename s/tst_test_cmds/tst_require_cmds/
From: Joerg Vehlow <[email protected]>
This require describes the function of the command better than test. "tst_require_root" is also a well established name in ltp api with the same semantic.
--- doc/test-writing-guidelines.txt | 2 +- testcases/commands/mkfs/mkfs01.sh | 2 +- testcases/kernel/containers/netns/netns_breakns.sh | 2 +- testcases/kernel/containers/netns/netns_helper.sh | 4 ++-- .../kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 2 +- .../kernel/controllers/memcg/functional/memcg_lib.sh | 4 ++-- testcases/kernel/device-drivers/zram/zram01.sh | 2 +- testcases/kernel/device-drivers/zram/zram_lib.sh | 6 +++--- .../ext4-delalloc-mballoc/ext4-alloc-test.sh | 2 +- .../ext4-journal-checksum/ext4_journal_checksum.sh | 2 +- .../ext4-online-defrag/ext4_online_defrag_test.sh | 4 ++-- .../ext4-uninit-groups/ext4_uninit_groups_test.sh | 2 +- testcases/kernel/fs/iso9660/isofs.sh | 2 +- .../hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 2 +- .../hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 2 +- testcases/kernel/io/stress_floppy/stress_floppy | 2 +- testcases/kernel/power_management/runpwtests05.sh | 2 +- .../kernel/power_management/runpwtests_exclusive01.sh | 2 +- .../kernel/power_management/runpwtests_exclusive02.sh | 2 +- .../kernel/power_management/runpwtests_exclusive03.sh | 2 +- .../kernel/power_management/runpwtests_exclusive04.sh | 2 +- .../kernel/power_management/runpwtests_exclusive05.sh | 2 +- testcases/lib/test.sh | 2 +- testcases/lib/tst_net.sh | 10 +++++----- testcases/lib/tst_test.sh | 8 ++++---- testcases/network/multicast/mc_commo/mc_commo.sh | 2 +- testcases/network/multicast/mc_member/mc_member.sh | 2 +- testcases/network/stress/dns/dns-stress.sh | 2 +- testcases/network/stress/ftp/ftp-download-stress.sh | 2 +- .../network/stress/ftp/ftp-download-stress01-rmt.sh | 2 +- .../network/stress/ftp/ftp-download-stress02-rmt.sh | 2 +- testcases/network/stress/ftp/ftp-upload-stress.sh | 4 ++-- .../network/stress/ftp/ftp-upload-stress01-rmt.sh | 2 +- .../network/stress/ftp/ftp-upload-stress02-rmt.sh | 2 +- testcases/network/stress/http/http-stress01-rmt.sh | 2 +- testcases/network/stress/http/http-stress02-rmt.sh | 2 +- testcases/network/stress/interface/if-lib.sh | 2 +- testcases/network/stress/ns-tools/tst_net_stress.sh | 2 +- testcases/network/stress/ssh/ssh-stress.sh | 2 +- testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 2 +- testcases/network/tcp_cmds/ping/ping01.sh | 2 +- testcases/network/tcp_cmds/ping/ping02.sh | 2 +- testcases/network/tcp_cmds/rlogin/rlogin01.sh | 2 +- testcases/network/tcp_cmds/sendfile/sendfile01.sh | 2 +- testcases/network/tcp_cmds/tcpdump/tcpdump01.sh | 2 +- testcases/network/tcp_cmds/telnet/telnet01.sh | 2 +- testcases/network/tcp_cmds/tracepath/tracepath01.sh | 2 +- testcases/network/virt/virt_lib.sh | 4 ++-- testcases/network/xinetd/xinetd_tests.sh | 2 +- 49 files changed, 63 insertions(+), 63 deletions(-)
doc/test-writing-guidelines.txt +1 -1
@@ -2150,7 +2150,7 @@ TST_NEEDS_CMDS="modinfo modprobe" Setting '$TST_NEEDS_CMDS' to a string listing required commands will check for existence each of them and exits the test with 'TCONF' on first missing. -Alternatively the 'tst_test_cmds()' function can be used to do the same on +Alternatively the 'tst_require_cmds()' function can be used to do the same on runtime, since sometimes we need to the check at runtime too. 'tst_check_cmds()' can be used for requirements just for a particular test
testcases/commands/mkfs/mkfs01.sh +1 -1
@@ -37,7 +37,7 @@ parse_args() setup() { if [ -n "$TST_FS_TYPE" ]; then - tst_test_cmds mkfs.${TST_FS_TYPE} + tst_require_cmds mkfs.${TST_FS_TYPE} fi ROD_SILENT mkdir -p mntpoint
testcases/kernel/containers/netns/netns_breakns.sh +1 -1
@@ -61,7 +61,7 @@ fi # TEST CASE #2 -tst_test_cmds ifconfig +tst_require_cmds ifconfig $NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK 2>/dev/null if [ $? -ne 0 ]; then tst_resm TPASS "controlling device over ioctl"
testcases/kernel/containers/netns/netns_helper.sh +2 -2
@@ -110,7 +110,7 @@ tst_check_iproute() netns_setup() { tst_require_root - tst_test_cmds ip modprobe + tst_require_cmds ip modprobe modprobe veth > /dev/null 2>&1
@@ -139,7 +139,7 @@ netns_setup() ;; ioctl) USE_IFCONFIG=1 - tst_test_cmds ifconfig + tst_require_cmds ifconfig ;; *) tst_brkm TBROK \
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +1 -1
@@ -83,7 +83,7 @@ create_subgroup() setup() { tst_require_root - tst_test_cmds killall + tst_require_cmds killall if [ ! -f /proc/cgroups ]; then tst_brkm TCONF "Kernel does not support for control groups"
testcases/kernel/controllers/memcg/functional/memcg_lib.sh +2 -2
@@ -35,7 +35,7 @@ if [ $? -ne 0 ]; then fi # Check for dependencies -tst_test_cmds killall +tst_require_cmds killall # Post 4.16 kernel updates stat in batch (> 32 pages) every time PAGESIZES=$(( $PAGESIZE * 33 ))
@@ -83,7 +83,7 @@ TST_CLEANUP=cleanup shmmax_setup() { - tst_test_cmds bc + tst_require_cmds bc shmmax=`cat /proc/sys/kernel/shmmax` if [ $(echo "$shmmax < $HUGEPAGESIZE" |bc) -eq 1 ]; then
testcases/kernel/device-drivers/zram/zram01.sh +1 -1
@@ -58,7 +58,7 @@ TST_CLEANUP="zram_cleanup" zram_fill_fs() { - tst_test_cmds awk bc dd free + tst_require_cmds awk bc dd free local mem_free0=$(free -m | awk 'NR==2 {print $4}') for i in $(seq 0 $(($dev_num - 1))); do
testcases/kernel/device-drivers/zram/zram_lib.sh +3 -3
@@ -155,7 +155,7 @@ zram_set_memlimit() zram_makeswap() { tst_resm TINFO "make swap with zram device(s)" - tst_test_cmds mkswap swapon swapoff + tst_require_cmds mkswap swapon swapoff local i=0 for i in $(seq 0 $(($dev_num - 1))); do mkswap /dev/zram$i > err.log 2>&1
@@ -179,7 +179,7 @@ zram_makeswap() zram_swapoff() { - tst_test_cmds swapoff + tst_require_cmds swapoff local i= for i in $(seq 0 $dev_makeswap); do swapoff /dev/zram$i > err.log 2>&1
@@ -195,7 +195,7 @@ zram_swapoff() zram_makefs() { - tst_test_cmds mkfs + tst_require_cmds mkfs local i=0 for fs in $zram_filesystems; do # if requested fs not supported default it to ext2
testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/ext4-alloc-test.sh +1 -1
@@ -117,7 +117,7 @@ ext4_test_delalloc_mballoc() # main ext4_setup -tst_test_cmds ffsb +tst_require_cmds ffsb DELALLOC=( "delalloc" "nodelalloc" ) DIRECT_IO=( 0 1 )
testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh +1 -1
@@ -94,7 +94,7 @@ ext4_test_journal_checksum() # main ext4_setup -tst_test_cmds ffsb +tst_require_cmds ffsb DATA=( "writeback" "ordered" "journal" ) COMMIT=( 1 100 )
testcases/kernel/fs/ext4-new-features/ext4-online-defrag/ext4_online_defrag_test.sh +2 -2
@@ -35,7 +35,7 @@ FILE=1 DIR=2 FILESYSTEM=3 -tst_test_cmds e4defrag +tst_require_cmds e4defrag E4DEFRAG=`which e4defrag` age_filesystem()
@@ -161,7 +161,7 @@ ext4_test_online_defrag() # main ext4_setup -tst_test_cmds ffsb +tst_require_cmds ffsb DEFRAG=( $FILE $DIR $FILESYSTEM ) AGING=( $EMPTY $SMALL $LARGE )
testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh +1 -1
@@ -114,7 +114,7 @@ ext4_test_uninit_groups() # main ext4_setup -tst_test_cmds ffsb +tst_require_cmds ffsb ORLOV=( "orlov" "oldalloc" ) DELALLOC=( "delalloc" "nodelalloc" )
testcases/kernel/fs/iso9660/isofs.sh +1 -1
@@ -102,7 +102,7 @@ gen_fs_tree "$MAKE_FILE_SYS_DIR" 1 # Make ISO9660 file system with different options. # Mount the ISO9660 file system with different mount options. -tst_test_cmds mkisofs +tst_require_cmds mkisofs for mkisofs_opt in \ " " \
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +1 -1
@@ -109,7 +109,7 @@ done LOOP_COUNT=1 -tst_test_cmds perl +tst_require_cmds perl if [ $(get_present_cpus_num) -lt 2 ]; then tst_brkm TCONF "system doesn't have required CPU hotplug support"
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh +1 -1
@@ -59,7 +59,7 @@ done LOOP_COUNT=1 -tst_test_cmds sar +tst_require_cmds sar if [ $(get_present_cpus_num) -lt 2 ]; then tst_brkm TCONF "system doesn't have required CPU hotplug support"
testcases/kernel/io/stress_floppy/stress_floppy +1 -1
@@ -40,7 +40,7 @@ setup() { tst_tmpdir - tst_test_cmds fdformat tar dump cpio dd mkfs mkdosfs + tst_require_cmds fdformat tar dump cpio dd mkfs mkdosfs TCtmp=$(pwd) }
testcases/kernel/power_management/runpwtests05.sh +1 -1
@@ -35,7 +35,7 @@ else max_sched_smt=1 fi -tst_test_cmds python3 +tst_require_cmds python3 if ! grep sched_debug -qw /proc/cmdline ; then tst_brkm TCONF "Kernel cmdline parameter 'sched_debug' needed," \
testcases/kernel/power_management/runpwtests_exclusive01.sh +1 -1
@@ -35,7 +35,7 @@ else max_sched_smt=1 fi -tst_test_cmds python3 +tst_require_cmds python3 hyper_threaded=$(is_hyper_threaded) multi_socket=$(is_multi_socket)
testcases/kernel/power_management/runpwtests_exclusive02.sh +1 -1
@@ -33,7 +33,7 @@ else max_sched_smt=1 fi -tst_test_cmds python3 +tst_require_cmds python3 hyper_threaded=$(is_hyper_threaded) multi_socket=$(is_multi_socket)
testcases/kernel/power_management/runpwtests_exclusive03.sh +1 -1
@@ -35,7 +35,7 @@ else max_sched_smt=1 fi -tst_test_cmds python3 +tst_require_cmds python3 hyper_threaded=$(is_hyper_threaded) multi_socket=$(is_multi_socket)
testcases/kernel/power_management/runpwtests_exclusive04.sh +1 -1
@@ -27,7 +27,7 @@ export TST_TOTAL=2 # Checking test environment check_kervel_arch -tst_test_cmds python3 +tst_require_cmds python3 hyper_threaded=$(is_hyper_threaded) multi_socket=$(is_multi_socket)
testcases/kernel/power_management/runpwtests_exclusive05.sh +1 -1
@@ -35,7 +35,7 @@ else max_sched_smt=1 fi -tst_test_cmds python3 +tst_require_cmds python3 hyper_threaded=$(is_hyper_threaded) multi_socket=$(is_multi_socket)
testcases/lib/test.sh +1 -1
@@ -151,7 +151,7 @@ tst_rmdir() # # Checks if commands passed as arguments exists # -tst_test_cmds() +tst_require_cmds() { local cmd for cmd in $*; do
testcases/lib/tst_net.sh +5 -5
@@ -108,7 +108,7 @@ tst_require_root_() init_ltp_netspace() { - tst_test_cmds ip + tst_require_cmds ip tst_require_root_ local pid=
@@ -318,7 +318,7 @@ tst_get_hwaddrs() # LINK: link number starting from 0. Default value is '0'. tst_hwaddr() { - tst_test_cmds awk + tst_require_cmds awk local type="${1:-lhost}" local link_num="${2:-0}"
@@ -334,7 +334,7 @@ tst_hwaddr() # LINK: link number starting from 0. Default value is '0'. tst_iface() { - tst_test_cmds awk + tst_require_cmds awk local type="${1:-lhost}" local link_num="${2:-0}"
@@ -481,7 +481,7 @@ tst_add_ipaddr() # LINK: link number starting from 0. Default value is '0'. tst_restore_ipaddr() { - tst_test_cmds ip + tst_require_cmds ip tst_require_root_ local type="${1:-lhost}"
@@ -651,7 +651,7 @@ tst_ping() local ret=0 echo "$dst_addr" | grep -q ':' && cmd="ping6" - tst_test_cmds $cmd + tst_require_cmds $cmd # ping cmd use 56 as default message size for size in ${msg_sizes:-"56"}; do
testcases/lib/tst_test.sh +4 -4
@@ -284,7 +284,7 @@ tst_mkfs() tst_brk TBROK "No device specified" fi - tst_test_cmds mkfs.$fs_type + tst_require_cmds mkfs.$fs_type tst_res TINFO "Formatting $device with $fs_type extra opts='$fs_opts'" ROD_SILENT mkfs.$fs_type $fs_opts $device
@@ -306,7 +306,7 @@ tst_cmd_available() fi } -tst_test_cmds() +tst_require_cmds() { local cmd for cmd in $*; do
@@ -448,7 +448,7 @@ tst_run() [ "$TST_DISABLE_APPARMOR" = 1 ] && tst_disable_apparmor [ "$TST_DISABLE_SELINUX" = 1 ] && tst_disable_selinux - tst_test_cmds $TST_NEEDS_CMDS + tst_require_cmds $TST_NEEDS_CMDS tst_test_drivers $TST_NEEDS_DRIVERS if [ -n "$TST_MIN_KVER" ]; then
@@ -513,7 +513,7 @@ tst_run() #TODO check that test reports some results for each test function call while [ $TST_ITERATIONS -gt 0 ]; do if [ -n "$TST_TEST_DATA" ]; then - tst_test_cmds cut tr wc + tst_require_cmds cut tr wc _tst_max=$(( $(echo $TST_TEST_DATA | tr -cd "$TST_TEST_DATA_IFS" | wc -c) +1)) for _tst_i in $(seq $_tst_max); do _tst_data="$(echo "$TST_TEST_DATA" | cut -d"$TST_TEST_DATA_IFS" -f$_tst_i)"
testcases/network/multicast/mc_commo/mc_commo.sh +1 -1
@@ -36,7 +36,7 @@ TST_USE_LEGACY_API=1 do_setup() { - tst_test_cmds netstat pgrep + tst_require_cmds netstat pgrep OCTET=$(ps -ewf | grep [m]c_commo | wc -l | awk '{print $1}') GROUP_ADDR=224.0.0.$OCTET
testcases/network/multicast/mc_member/mc_member.sh +1 -1
@@ -38,7 +38,7 @@ TST_USE_LEGACY_API=1 setup() { - tst_test_cmds netstat + tst_require_cmds netstat tst_tmpdir }
testcases/network/stress/dns/dns-stress.sh +1 -1
@@ -43,7 +43,7 @@ cleanup() common_setup() { tst_require_root - tst_test_cmds named dig + tst_require_cmds named dig if [ "$TST_IPV6" ]; then record="AAAA"
testcases/network/stress/ftp/ftp-download-stress.sh +1 -1
@@ -42,7 +42,7 @@ cleanup() setup() { tst_require_root - tst_test_cmds pkill vsftpd + tst_require_cmds pkill vsftpd tst_tmpdir tst_resm TINFO "run FTP over IPv$TST_IPVER"
testcases/network/stress/ftp/ftp-download-stress01-rmt.sh +1 -1
@@ -28,7 +28,7 @@ server_ipaddr="$1" filename="$2" filesize="$3" -tst_test_cmds curl +tst_require_cmds curl echo $server_ipaddr | grep ':' > /dev/null if [ $? -eq 0 ]; then
testcases/network/stress/ftp/ftp-download-stress02-rmt.sh +1 -1
@@ -24,7 +24,7 @@ TST_TOTAL=1 . test.sh -tst_test_cmds awk killall +tst_require_cmds awk killall server_ipaddr="$1" filename="$2"
testcases/network/stress/ftp/ftp-upload-stress.sh +2 -2
@@ -42,7 +42,7 @@ cleanup() setup() { tst_require_root - tst_test_cmds pkill vsftpd + tst_require_cmds pkill vsftpd tst_tmpdir tst_resm TINFO "run FTP over IPv$TST_IPVER"
@@ -57,7 +57,7 @@ setup() getenforce 2> /dev/null | grep -q Enforcing if [ $? -eq 0 ]; then tst_resm TINFO "configuring SELinux FTP parameters" - tst_test_cmds chcon setsebool + tst_require_cmds chcon setsebool setsebool allow_ftpd_anon_write 1 || \ tst_brkm TBROK "Failed to allow ftpd anonymous write" chcon -R -t public_content_rw_t $FTP_UPLOAD_DIR || \
testcases/network/stress/ftp/ftp-upload-stress01-rmt.sh +1 -1
@@ -30,7 +30,7 @@ urldir="$2" filename="$3" filesize="$4" -tst_test_cmds curl +tst_require_cmds curl cleanup() {
testcases/network/stress/ftp/ftp-upload-stress02-rmt.sh +1 -1
@@ -25,7 +25,7 @@ TST_CLEANUP="cleanup" . test.sh -tst_test_cmds killall +tst_require_cmds killall server_ipaddr="$1" urldir="$2"
testcases/network/stress/http/http-stress01-rmt.sh +1 -1
@@ -24,7 +24,7 @@ TST_TOTAL=1 . test.sh -tst_test_cmds awk curl +tst_require_cmds awk curl # Check the arguments [ $# -ne 3 ] && tst_brkm TBROK "Usage: $0 server_ipaddr filename filesize"
testcases/network/stress/http/http-stress02-rmt.sh +1 -1
@@ -24,7 +24,7 @@ TST_TOTAL=1 . test.sh -tst_test_cmds awk curl +tst_require_cmds awk curl if [ $# -ne 5 ]; then tst_brkm TBROK "Usage: $0 server_addr fname fsize duration connections"
testcases/network/stress/interface/if-lib.sh +1 -1
@@ -30,7 +30,7 @@ if_setup() tst_brk TBROK "Missing or wrong -c parameter: '$CMD', use 'ip' or '$IF_CMD'" fi - tst_test_cmds "$CMD" + tst_require_cmds "$CMD" netstress_setup TST_CLEANUP="${TST_CLEANUP:-netstress_cleanup}" }
testcases/network/stress/ns-tools/tst_net_stress.sh +1 -1
@@ -26,7 +26,7 @@ MCAST_IPV6_ADDR="${MCAST_IPV6_ADDR_PREFIX}:1" netstress_setup() { TST_NEEDS_ROOT=1 - tst_test_cmds pgrep pkill + tst_require_cmds pgrep pkill } # Cleanup for tests using netstress.
testcases/network/stress/ssh/ssh-stress.sh +1 -1
@@ -46,7 +46,7 @@ setup() trap "tst_brkm TBROK 'test interrupted'" INT tst_require_root - tst_test_cmds pkill sshd ssh od + tst_require_cmds pkill sshd ssh od # Get the sshd command with absolute path SSHD=$(which sshd)
testcases/network/tcp_cmds/ipneigh/ipneigh01.sh +1 -1
@@ -34,7 +34,7 @@ do_setup() ;; esac - tst_test_cmds $CMD ping$TST_IPV6 + tst_require_cmds $CMD ping$TST_IPV6 } usage()
testcases/network/tcp_cmds/ping/ping01.sh +1 -1
@@ -23,7 +23,7 @@ do_setup() PING_CMD=ping${TST_IPV6} - tst_test_cmds $PING_CMD + tst_require_cmds $PING_CMD } do_test()
testcases/network/tcp_cmds/ping/ping02.sh +1 -1
@@ -15,7 +15,7 @@ do_setup() PING=ping${TST_IPV6} - tst_test_cmds $PING + tst_require_cmds $PING } do_test()
testcases/network/tcp_cmds/rlogin/rlogin01.sh +1 -1
@@ -25,7 +25,7 @@ TST_USE_LEGACY_API=1 setup() { - tst_test_cmds rlogin expect + tst_require_cmds rlogin expect if [ -z $RUSER ]; then RUSER=root
testcases/network/tcp_cmds/sendfile/sendfile01.sh +1 -1
@@ -47,7 +47,7 @@ do_setup() FILES=${FILES:-"ascii.sm ascii.med ascii.lg ascii.jmb"} - tst_test_cmds diff stat + tst_require_cmds diff stat tst_tmpdir }
testcases/network/tcp_cmds/tcpdump/tcpdump01.sh +1 -1
@@ -29,7 +29,7 @@ TST_CLEANUP=do_cleanup do_setup() { ping_cmd=ping$TST_IPV6 - tst_test_cmds tcpdump kill $ping_cmd + tst_require_cmds tcpdump kill $ping_cmd outfile="tcpdump_out" numloops=20 tst_tmpdir
testcases/network/tcp_cmds/telnet/telnet01.sh +1 -1
@@ -25,7 +25,7 @@ TST_USE_LEGACY_API=1 setup() { - tst_test_cmds telnet expect + tst_require_cmds telnet expect if [ -z $RUSER ]; then RUSER=root
testcases/network/tcp_cmds/tracepath/tracepath01.sh +1 -1
@@ -16,7 +16,7 @@ setup() cmd="tracepath$TST_IPVER" tst_cmd_available $cmd || cmd="tracepath -6" fi - tst_test_cmds $(echo $cmd | cut -f 1 -d' ') + tst_require_cmds $(echo $cmd | cut -f 1 -d' ') if $cmd -V >/dev/null 2>&1; then tst_res TINFO "traceroute version:"
testcases/network/virt/virt_lib.sh +2 -2
@@ -50,7 +50,7 @@ virt_lib_setup() ;; esac - tst_test_cmds "ip" + tst_require_cmds "ip" virt_add ltp_v0 || \ tst_brk TCONF "iproute2 or kernel doesn't support $virt_type"
@@ -256,7 +256,7 @@ vxlan_setup_subnet_uni() vxlan_setup_subnet_multi() { - tst_test_cmds "od" + tst_require_cmds "od" local b1=$(($(od -An -d -N1 /dev/urandom) % 254 + 1)) local b2=$(($(od -An -d -N1 /dev/urandom) % 254 + 1)) local b3=$(($(od -An -d -N1 /dev/urandom) % 254 + 1))
testcases/network/xinetd/xinetd_tests.sh +1 -1
@@ -30,7 +30,7 @@ setup() tst_tmpdir - tst_test_cmds xinetd diff telnet + tst_require_cmds xinetd diff telnet check_addr="127.0.0.1" ip a | grep -q inet6 && check_addr="$check_addr ::1"
Signature · 1 line
2.20.1
PATCH 2/2 shell: Rename s/tst_test_drivers/tst_require_drivers/
In reply to Joerg VehlowFrom: Joerg Vehlow <[email protected]>
This require describes the function of the command better than test. "tst_require_root" is also a well established name in ltp api with the same semantic.
--- testcases/lib/tst_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/lib/tst_test.sh +2 -2
@@ -326,7 +326,7 @@ tst_check_cmds() return 0 } -tst_test_drivers() +tst_require_drivers() { [ $# -eq 0 ] && return 0
@@ -449,7 +449,7 @@ tst_run() [ "$TST_DISABLE_SELINUX" = 1 ] && tst_disable_selinux tst_require_cmds $TST_NEEDS_CMDS - tst_test_drivers $TST_NEEDS_DRIVERS + tst_require_drivers $TST_NEEDS_DRIVERS if [ -n "$TST_MIN_KVER" ]; then tst_kvcmp -lt "$TST_MIN_KVER" && \
Signature · 1 line
2.20.1
Hi,
Quoted 6 lines
these patches rename tst_test_* to tst_require_*, to better describe their use. There is also
tst_require_root, that has the same
behavior: It also callstst_brkin case of a failing requirement.You can also get this patch from the following repo:
https://github.com/MofX/ltp/commits/rename_tst_test-tst_require
sorry for not thinking first, I wonder if we want to sync tst_test_* (function name) vs $TST_NEEDS_* (test API variable name), e.g.: tst_require_drivers $TST_NEEDS_DRIVERS
i.e. either of these:
s/tst_test_/tst_needs_/
s/TST_NEEDS_/TST_REQUIRE_/
I consider *require* as more descriptive than *needs*, but changing to *require* would require more work :).
Kind regards,
Petr
Hi!
Quoted 7 lines
Quoted 6 lines
these patches rename tst_test_* to tst_require_*, to better describe their use. There is also
tst_require_root, that has the same
behavior: It also callstst_brkin case of a failing requirement.You can also get this patch from the following repo:
https://github.com/MofX/ltp/commits/rename_tst_test-tst_require
Quoted 7 lines
sorry for not thinking first, I wonder if we want to sync tst_test_* (function name) vs $TST_NEEDS_* (test API variable name), e.g.:
tst_require_drivers$TST_NEEDS_DRIVERSi.e. either of these:
s/tst_test_/tst_needs_/
s/TST_NEEDS_/TST_REQUIRE_/
I guess that I started bike-shedding here, I should have been silent I guess...
I do consider this names to mean something different in the contexts, i.e. "needs" is something that is expressed in metadata, while "require" is part of a function name. But hey I'm by no means native speaker, so who know, and also I would prefer to work on the actual code, which is more fruitful than API renames.
Signature · 2 lines
Cyril Hrubis [email protected]
Quoted 11 lines · Petr Vorel
Hi,
Cc Li and ClemensQuoted 6 lines
these patches rename tst_test_* to tst_require_*, to better describe
their use. There is alsotst_require_root, that has the same
behavior: It also callstst_brkin case of a failing requirement. You can also get this patch from the following repo:
https://github.com/MofX/ltp/commits/rename_tst_test-tst_require
Quoted 3 lines
sorry for not thinking first, I wonder if we want to sync tst_test_* (function name) vs $TST_NEEDS_* (test API variable name), e.g.:
tst_require_drivers$TST_NEEDS_DRIVERS
I fully agree with Petr that we must be consistent in naming between variable- and function-name.
Quoted 7 lines
i.e. either of these:
s/tst_test_/tst_needs_/
s/TST_NEEDS_/TST_REQUIRE_/I consider *require* as more descriptive than *needs*, but changing to *require* would require more work :).
If we use needs or require ? Hard question - when I search for synonyms from one or the other, I don't see a big different. Without looking on the impact, require sounds also more descriptive.
thx, Clemens
Hi!
Quoted 3 lines
If we use needs or require ? Hard question - when I search for synonyms from one or the other, I don't see a big different. Without looking on the impact, require sounds also more descriptive.
There is about thousand of uses of *NEEDS_FOO and *needs_foo in the new library tests, so renaming to tst_needs_foo would be the least painful.
Signature · 2 lines
Cyril Hrubis [email protected]
Hi,
Quoted 6 lines
Quoted 3 lines
If we use needs or require ? Hard question - when I search for synonyms from one or the other, I don't see a big different. Without looking on the impact, require sounds also more descriptive.
There is about thousand of uses of
*NEEDS_FOOand*needs_fooin the new library tests, so renaming totst_needs_foowould be the least painful.
+1.
Sorry for starting such a big discussion just about API naming. I care about these things, because good docs and consistent API are less important than good quality code, but helps new users.
Thank you for all your input, I agree with points other raised, but getting it right would be to intrusive change (touching every test is a bit too much).
Kind regards,
Petr
Hi!
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
If we use needs or require ? Hard question - when I search for synonyms from one or the other, I don't see a big different. Without looking on the impact, require sounds also more descriptive.
There is about thousand of uses of
*NEEDS_FOOand*needs_fooin the new library tests, so renaming totst_needs_foowould be the least painful.
Quoted 8 lines
+1.
Sorry for starting such a big discussion just about API naming. I care about these things, because good docs and consistent API are less important than good quality code, but helps new users.
Thank you for all your input, I agree with points other raised, but getting it right would be to intrusive change (touching every test is a bit too much).
I would like to end the bikeshedding now and also get the tests fixed so here is the proposal. If anyone wants to send a patch that unifies the API on tst_needs_* please do so. If no one starts at least working on that in a week or two, let's merge this patchset. Does that sound reasonable to everyone?
Signature · 2 lines
Cyril Hrubis [email protected]
Hi,
Quoted 5 lines
I would like to end the bikeshedding now and also get the tests fixed so here is the proposal. If anyone wants to send a patch that unifies the API on tst_needs_* please do so. If no one starts at least working on that in a week or two, let's merge this patchset. Does that sound reasonable to everyone?
+1
Kind regards,
Petr
Hi!
Quoted 5 lines
Quoted 5 lines
I would like to end the bikeshedding now and also get the tests fixed so here is the proposal. If anyone wants to send a patch that unifies the API on tst_needs_* please do so. If no one starts at least working on that in a week or two, let's merge this patchset. Does that sound reasonable to everyone?
Gentle reminder, this timeouts tomorrow when I will apply the original patches, unless someone steps in.
Signature · 2 lines
Cyril Hrubis [email protected]
Hi,
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
I would like to end the bikeshedding now and also get the tests fixed so here is the proposal. If anyone wants to send a patch that unifies the API on tst_needs_* please do so. If no one starts at least working on that in a week or two, let's merge this patchset. Does that sound reasonable to everyone?
Gentle reminder, this timeouts tomorrow when I will apply the original patches, unless someone steps in.
OK, if nobody objects, tomorrow I'll modify Joerg's patchset to be "Rename tst_test_* to tst_needs_*" and push it on his behalf.
I like *require* more, but it's better to have the same name for variables and functions.
Kind regards,
Petr
Hi,
Quoted 7 lines
Quoted 2 lines
Gentle reminder, this timeouts tomorrow when I will apply the original patches, unless someone steps in.
OK, if nobody objects, tomorrow I'll modify Joerg's patchset to be "Rename tst_test_* to tst_needs_*" and push it on his behalf.
I like *require* more, but it's better to have the same name for variables and functions.
Actually thinking about it twice, I'm going to apply the original patch. *require* is really more descriptive.
Kind regards,
Petr
Hi,
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
I would like to end the bikeshedding now and also get the tests fixed so here is the proposal. If anyone wants to send a patch that unifies the API on tst_needs_* please do so. If no one starts at least working on that in a week or two, let's merge this patchset. Does that sound reasonable to everyone?
Gentle reminder, this timeouts tomorrow when I will apply the original patches, unless someone steps in.
Merged this patch (rebased).
Thanks all for their input.
Kind regards,
Petr
Quoted 12 lines · Clemens Famulla-Conrad
Quoted 11 lines · Petr Vorel
Hi,
Cc Li and ClemensQuoted 6 lines
these patches rename tst_test_* to tst_require_*, to better describe
their use. There is alsotst_require_root, that has the same
behavior: It also callstst_brkin case of a failing requirement. You can also get this patch from the following repo:
https://github.com/MofX/ltp/commits/rename_tst_test-tst_require
Quoted 7 lines
Quoted 3 lines
sorry for not thinking first, I wonder if we want to sync tst_test_* (function name) vs $TST_NEEDS_* (test API variable name), e.g.:
tst_require_drivers$TST_NEEDS_DRIVERSI fully agree with Petr that we must be consistent in naming between variable- and function-name.
+1
Quoted 6 lines
Quoted 6 lines
i.e. either of these:
s/tst_test_/tst_needs_/
s/TST_NEEDS_/TST_REQUIRE_/
Quoted 7 lines
Quoted 2 lines
I consider *require* as more descriptive than *needs*, but changing to *require* would require more work :).
If we use needs or require ? Hard question - when I search for synonyms from one or the other, I don't see a big different. Without looking on the impact, require sounds also more descriptive.
Yes, I have the same feeling here.
FYI:
needs: because it's important
require: because it's a necessity
https://www.englishcurrent.com/grammar/difference-need-require-verbs/
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20191011/f0a81006/attachment-0001.htm>
Quoted 12 lines · Petr Vorel
Quoted 10 lines
Hi,
Cc Li and ClemensQuoted 6 lines
these patches rename tst_test_* to tst_require_*, to better describe
their use. There is alsotst_require_root, that has the same
behavior: It also callstst_brkin case of a failing requirement. You can also get this patch from the following repo:
https://github.com/MofX/ltp/commits/rename_tst_test-tst_require
Quoted 5 lines
Quoted 3 lines
sorry for not thinking first, I wonder if we want to sync tst_test_* (function name) vs $TST_NEEDS_* (test API variable name), e.g.:
tst_require_drivers$TST_NEEDS_DRIVERSI fully agree with Petr that we must be consistent in naming between variable- and function-name.
Actually I am more with cyril's reasoning, that one is metadata and one is function call here.
It wasn't consistent in the past. The require is more like an imperative here and the needs is
descriptive.
I'm also no native speaker, but in my opinon needing a command sounds a bit strange.
One thing I found is that a need is required for living, while a requirement must be
fulfilled, for something to happen. With this definition requirement fits. There is also the term
requierement in software engineering and no term "needment"
But strangely I still have no problem with TST_NEEDS_*, but I would also be ok withTST_REQUIRES_. Actually I'd propably chose it, if I was designing the library.
I do not really like renaming tst_test_* to test_needs_*. Needs does not sound
strong enough to me in that context.? But I just made a quick search for "needs_"
and there is so much needs in the c library as well, that touching all of this is maybe
to much.