From d4e0f2f2ad93124c01695c072e7a514ff8e27d2c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 13 Oct 2009 15:37:49 +0200 Subject: [PATCH] tests: swapon workaround for libtool wrapper The swapon command behaviour depends on program name (argv[0] = swapon | swapoff). It means we cannot use the libtool wrapper script in our regression tests. It seems better to call the binaries directly with proper LD_LIBRARY_PATH. This is probably less portable, but good enough for our tests. Signed-off-by: Karel Zak --- tests/commands.sh.in | 6 ++++-- tests/functions.sh | 3 ++- tests/ts/swapon/devname | 3 ++- tests/ts/swapon/label | 3 ++- tests/ts/swapon/uuid | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/commands.sh.in b/tests/commands.sh.in index 55585e7b..70084cd0 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -18,11 +18,13 @@ TS_HELPER_PARTITIONS="$TOPDIR/shlibs/blkid/samples/partitions" TS_ECMD_BLKID="@BLKID@" TS_ECMD_VOLID="@VOLID@" +U_L_LIBRARY_PATH="$TOPDIR/shlibs/blkid/src/.libs:$TOPDIR/shlibs/uuid/src/.libs" + # paths to commands TS_CMD_MOUNT=${TS_CMD_MOUNT:-"$TOPDIR/mount/mount"} TS_CMD_UMOUNT=${TS_CMD_UMOUNT:-"$TOPDIR/mount/umount"} -TS_CMD_SWAPON=${TS_CMD_SWAPON:-"$TOPDIR/mount/swapon"} -TS_CMD_SWAPOFF=${TS_CMD_SWAPOFF:-"$TOPDIR/mount/swapoff"} +TS_CMD_SWAPON=${TS_CMD_SWAPON:-"$TOPDIR/mount/.libs/swapon"} +TS_CMD_SWAPOFF=${TS_CMD_SWAPOFF:-"$TOPDIR/mount/.libs/swapoff"} TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"$TOPDIR/mount/losetup"} TS_CMD_MTABLOCK=${TS_CMD_MTABLOCK:-"$TOPDIR/mount/mtab_lock_test"} diff --git a/tests/functions.sh b/tests/functions.sh index 50ef12d8..e8a2ceb6 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -365,7 +365,8 @@ function ts_swapoff { ln -sf $TS_CMD_SWAPON $TS_CMD_SWAPOFF REMSWAPOFF="true" fi - $TS_CMD_SWAPOFF $DEV 2>&1 >> $TS_OUTPUT + LD_LIBRARY_PATH="$U_L_LIBRARY_PATH" \ + $TS_CMD_SWAPOFF $DEV 2>&1 >> $TS_OUTPUT if [ -n "$REMSWAPOFF" ]; then rm -f $TS_CMD_SWAPOFF fi diff --git a/tests/ts/swapon/devname b/tests/ts/swapon/devname index f6edd537..6ad6b2fc 100755 --- a/tests/ts/swapon/devname +++ b/tests/ts/swapon/devname @@ -32,7 +32,8 @@ $TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \ ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot found swap on $DEVICE" $DEVICE -$TS_CMD_SWAPON $DEVICE 2>&1 >> $TS_OUTPUT +LD_LIBRARY_PATH="$U_L_LIBRARY_PATH" \ + $TS_CMD_SWAPON $DEVICE 2>&1 >> $TS_OUTPUT grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE diff --git a/tests/ts/swapon/label b/tests/ts/swapon/label index 299572c8..5a5e2650 100755 --- a/tests/ts/swapon/label +++ b/tests/ts/swapon/label @@ -36,7 +36,8 @@ ts_device_has "LABEL" $LABEL $DEVICE \ ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE -$TS_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT +LD_LIBRARY_PATH="$U_L_LIBRARY_PATH" \ + $TS_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE diff --git a/tests/ts/swapon/uuid b/tests/ts/swapon/uuid index 3a9c1318..373afd3c 100755 --- a/tests/ts/swapon/uuid +++ b/tests/ts/swapon/uuid @@ -36,7 +36,8 @@ UUID=$(ts_uuid_by_devname $DEVICE) ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE -$TS_CMD_SWAPON -U $UUID 2>&1 >> $TS_OUTPUT +LD_LIBRARY_PATH="$U_L_LIBRARY_PATH" \ + $TS_CMD_SWAPON -U $UUID 2>&1 >> $TS_OUTPUT grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE -- 2.39.5