# $1: number of lines to output (default: 40)
typeset lines=${1:-40}
-typeset history=$(cat /sys/module/zfs/parameters/zfs_multihost_history)
+typeset history=$(</sys/module/zfs/parameters/zfs_multihost_history)
if [ $history -eq 0 ]; then
exit
log_note "Stopping ZED"
if [[ -f ${ZEDLET_DIR}/zed.pid ]]; then
- zedpid=$(cat ${ZEDLET_DIR}/zed.pid)
+ zedpid=$(<${ZEDLET_DIR}/zed.pid)
kill $zedpid
while ps -p $zedpid > /dev/null; do
sleep 1
outdiff=$(diff "$basename.out" "$tmpout")
if [[ $? -ne 0 ]]; then
- output=$(cat $tmpout)
+ output=$(<$tmpout)
rm $tmpout $tmperr $tmpin
log_fail "Output mismatch. Expected:\n" \
- "$(cat $basename.out)\nBut got:\n$output\n" \
+ "$(<$basename.out)\nBut got:\n$output\n" \
"Diff:\n$outdiff"
fi
outdiff=$(diff "$basename.err" "$tmperr")
if [[ $? -ne 0 ]]; then
- outputerror=$(cat $tmperr)
+ outputerror=$(<$tmperr)
rm $tmpout $tmperr $tmpin
log_fail "Error mismatch. Expected:\n" \
- "$(cat $basename.err)\nBut got:\n$outputerror\n" \
+ "$(<$basename.err)\nBut got:\n$outputerror\n" \
"Diff:\n$outdiff"
fi
grep -q "$expecterror" $tmperr
if [[ $? -ne 0 ]]; then
- outputerror=$(cat $tmperr)
+ outputerror=$(<$tmperr)
rm $tmpout $tmperr $tmpin
log_fail "Error mismatch. Expected to contain:\n" \
"$expecterror\nBut got:\n$outputerror\n"
# If there's no expected output, error reporting is allowed to
# vary, but ensure that we didn't fail silently.
#
- if [[ -z "$(cat $tmperr)" ]]; then
+ if [[ -z "$(<$tmperr)" ]]; then
rm $tmpout $tmperr $tmpin
log_fail "error with no stderr output"
fi
{
log_must zfs list $FS0
log_must zfs list $FS1
- log_must [ "$(cat $FS0FILE)" = "$FILECONTENTS0" ]
- log_must [ "$(cat $FS1FILE)" = "$FILECONTENTS1" ]
+ log_must [ "$(<$FS0FILE)" = "$FILECONTENTS0" ]
+ log_must [ "$(<$FS1FILE)" = "$FILECONTENTS1" ]
#
# If we've opened the checkpointed state of the
# Ensure post-checkpoint state is not present
#
log_mustnot zfs list $FS2
- log_mustnot [ "$(cat $FS0FILE)" = "$NEWFILECONTENTS0" ]
+ log_mustnot [ "$(<$FS0FILE)" = "$NEWFILECONTENTS0" ]
}
function nested_verify_pre_checkpoint_state
{
log_must zfs list $NESTEDFS0
log_must zfs list $NESTEDFS1
- log_must [ "$(cat $NESTEDFS0FILE)" = "$FILECONTENTS0" ]
- log_must [ "$(cat $NESTEDFS1FILE)" = "$FILECONTENTS1" ]
+ log_must [ "$(<$NESTEDFS0FILE)" = "$FILECONTENTS0" ]
+ log_must [ "$(<$NESTEDFS1FILE)" = "$FILECONTENTS1" ]
#
# If we've opened the checkpointed state of the
# Ensure post-checkpoint state is not present
#
log_mustnot zfs list $NESTEDFS2
- log_mustnot [ "$(cat $NESTEDFS0FILE)" = "$NEWFILECONTENTS0" ]
+ log_mustnot [ "$(<$NESTEDFS0FILE)" = "$NEWFILECONTENTS0" ]
}
function test_change_state_after_checkpoint
{
log_must zfs list $FS0
log_must zfs list $FS2
- log_must [ "$(cat $FS0FILE)" = "$NEWFILECONTENTS0" ]
- log_must [ "$(cat $FS2FILE)" = "$NEWFILECONTENTS2" ]
+ log_must [ "$(<$FS0FILE)" = "$NEWFILECONTENTS0" ]
+ log_must [ "$(<$FS2FILE)" = "$NEWFILECONTENTS2" ]
log_must zdb $TESTPOOL
# is not present
#
log_mustnot zfs list $FS1
- log_mustnot [ "$(cat $FS0FILE)" = "$FILECONTENTS0" ]
+ log_mustnot [ "$(<$FS0FILE)" = "$FILECONTENTS0" ]
}
function fragment_before_checkpoint
verify_runnable "global"
-ZFS_USER=$(cat $TEST_BASE_DIR/zfs-privs-test-user.txt)
+ZFS_USER=$(<$TEST_BASE_DIR/zfs-privs-test-user.txt)
[[ -z $ZFS_USER ]] && log_fail "no ZFS_USER found"
-USES_NIS=$(cat $TEST_BASE_DIR/zfs-privs-test-nis.txt)
+USES_NIS=$(<$TEST_BASE_DIR/zfs-privs-test-nis.txt)
if [ "${USES_NIS}" == "true" ]
then
log_assert "The RBAC profile \"ZFS Storage Management\" works"
-ZFS_USER=$(cat $TEST_BASE_DIR/zfs-privs-test-user.txt)
+ZFS_USER=$(<$TEST_BASE_DIR/zfs-privs-test-user.txt)
# the user shouldn't be able to do anything initially
log_mustnot user_run $ZFS_USER "zpool create $TESTPOOL $DISKS"
log_assert "The RBAC profile \"ZFS File System Management\" works"
-ZFS_USER=$(cat $TEST_BASE_DIR/zfs-privs-test-user.txt)
+ZFS_USER=$(<$TEST_BASE_DIR/zfs-privs-test-user.txt)
# Set a $DATASET where we can create child files systems
if is_global_zone; then
state1=$(zpool status $pool | awk '/state: /{print $2}');
state2=$(zpool list -H -o health $pool)
- state3=$(cat /proc/spl/kstat/zfs/$pool/state)
+ state3=$(</proc/spl/kstat/zfs/$pool/state)
log_note "Checking $expected = $state1 = $state2 = $state3"
if [[ "$expected" == "$state1" && "$expected" == "$state2" && \
"$expected" == "$state3" ]] ; then
log_onexit cleanup
-default_max_entries=$(cat $MAX_ENTRIES_PARAM) || log_fail
+default_max_entries=$(<$MAX_ENTRIES_PARAM) || log_fail
echo 50 >$MAX_ENTRIES_PARAM || log_fail
# Clear all of the existing entries.
log_must set_tunable32 zfs_remove_max_segment 32768
log_must dd if=/dev/urandom of=$TESTDIR/$TESTFILE0 bs=128k count=1
-FILE_CONTENTS=`cat $TESTDIR/$TESTFILE0`
-log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+FILE_CONTENTS=$(<$TESTDIR/$TESTFILE0)
+log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
for i in {1..10}; do
log_must zpool remove $TESTPOOL $TMPDIR/dsk1
log_must zinject -a
log_must dd if=$TESTDIR/$TESTFILE0 of=/dev/null
- log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+ log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
log_must zpool remove $TESTPOOL $TMPDIR/dsk2
log_must wait_for_removal $TESTPOOL
log_must zinject -a
log_must dd if=$TESTDIR/$TESTFILE0 of=/dev/null
- log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+ log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
done
log_pass "File contents transferred completely from one disk to another."
FILE_CONTENTS="Leeloo Dallas mul-ti-pass."
echo $FILE_CONTENTS >$TESTDIR/$TESTFILE0
-log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
log_must zpool remove $TESTPOOL $REMOVEDISK
log_must wait_for_removal $TESTPOOL
log_mustnot vdevs_in_pool $TESTPOOL $REMOVEDISK
log_must dd if=/$TESTDIR/$TESTFILE0 of=/dev/null
-log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
log_pass "Removed device not in use after removal."
echo $FILE_CONTENTS >$TESTDIR/$TESTFILE0
echo $FILE_CONTENTS >$TESTDIR/$TESTFILE1
echo $FILE_CONTENTS >$TESTDIR/$TESTFILE2
-log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
-log_must [ "x$(cat $TESTDIR/$TESTFILE1)" = "x$FILE_CONTENTS" ]
-log_must [ "x$(cat $TESTDIR/$TESTFILE2)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE1)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE2)" = "x$FILE_CONTENTS" ]
log_must zpool remove $TESTPOOL $REMOVEDISK
log_must wait_for_removal $TESTPOOL
log_must dd if=/$TESTDIR/$TESTFILE0 of=/dev/null
log_must dd if=/$TESTDIR/$TESTFILE1 of=/dev/null
log_must dd if=/$TESTDIR/$TESTFILE2 of=/dev/null
-log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
-log_must [ "x$(cat $TESTDIR/$TESTFILE1)" = "x$FILE_CONTENTS" ]
-log_must [ "x$(cat $TESTDIR/$TESTFILE2)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE1)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE2)" = "x$FILE_CONTENTS" ]
log_pass "Removed device not in use after removal."
FILE_CONTENTS="Leeloo Dallas mul-ti-pass."
echo $FILE_CONTENTS >$TESTDIR/$TESTFILE0
-log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
log_must file_write -o create -f $TESTDIR/$TESTFILE1 -b $((2**20)) -c $((2**7))
log_must zpool remove $TESTPOOL $REMOVEDISK
log_mustnot vdevs_in_pool $TESTPOOL $REMOVEDISK
log_must dd if=/$TESTDIR/$TESTFILE0 of=/dev/null
-log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
log_pass "Removed device not in use after removal."
log_must cp $WORDS_FILE2 $TESTDIR
else
echo $FILE_CONTENTS >$TESTDIR/$TESTFILE0
- log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+ log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
fi
log_must zpool remove $TESTPOOL mirror-1
log_must diff $WORDS_FILE2 $TESTDIR/words
else
log_must dd if=/$TESTDIR/$TESTFILE0 of=/dev/null
- log_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
+ log_must [ "x$(<$TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
fi
log_pass "Removed top-level mirror device not in use after removal."
then
printf ",\n" >>$config
fi
- printf " \"$tunable\": \"$(cat $zfs_tunables/$tunable)\"" \
+ printf " \"$tunable\": \"$(<$zfs_tunables/$tunable)\"" \
>>$config
done
printf "\n }\n" >>$config