diff options
Diffstat (limited to 'tests/ts/swapon/fixpgsz')
-rwxr-xr-x | tests/ts/swapon/fixpgsz | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/ts/swapon/fixpgsz b/tests/ts/swapon/fixpgsz new file mode 100755 index 0000000..0a694ad --- /dev/null +++ b/tests/ts/swapon/fixpgsz @@ -0,0 +1,44 @@ +#!/bin/bash + +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="fix page size" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +PAGESIZE=$($TS_HELPER_SYSINFO pagesize) + +# +# Create a swap-area with incompatible page size +# +[ "$?" == 0 ] || ts_die "Cannot init device" + +if [ $(( 64 * 1024 )) -ne $PAGESIZE ]; then + BADSIZE=$(( 64 * 1024 )) +else + BADSIZE=4096 +fi + +DEVICE=$(ts_device_init) + +$TS_CMD_MKSWAP -L MyFooBarLabel --pagesize $BADSIZE $DEVICE > /dev/null &> /dev/null \ + || ts_die "Cannot make swap $DEVICE" $DEVICE + +ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE" $DEVICE + +# +# Swapon +# +$TS_CMD_SWAPON --fixpgsz $DEVICE &> /dev/null + +grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE + +$TS_CMD_SWAPOFF $DEVICE +ts_device_deinit $DEVICE + +ts_log "Success" +ts_finalize + |