3 [ -f testing.sh ] && . testing.sh
5 if [ "$(id -u)" -ne 0 ]
7 echo "SKIPPED: losetup (not root)"
12 #testing "name" "command" "result" "infile" "stdin"
14 truncate -s 1M blah.img &&
15 FILE="$(readlink -f blah.img)"
16 DEV="$(printf '%04d' $(stat -t blah.img | awk '{print $7}'))"
17 NODE="$(awk '{print $7}')"
22 testing "cat" "cat && echo yes" "oneyes\n" "" "one"
23 testing "cat -" "cat - && echo yes" "oneyes\n" "" "one"
24 testing "cat file1 file2" "cat file1 file2" "one\ntwo\n" "" ""
25 testing "cat - file" "cat - file1" "zero\none\n" "" "zero\n"
26 testing "cat file -" "cat file1 -" "one\nzero\n" "" "zero\n"
28 testing "cat file1 notfound file2" \
29 "cat file1 notfound file2 2>stderr && echo ok ; cat stderr; rm stderr" \
30 "one\ntwo\ncat: notfound: No such file or directory\n" "" ""
33 "cat /proc/self/exe > file1 && cmp /proc/self/exe file1 && echo yes" \
36 testing "cat - file1" \
37 "cat - file1 | diff -a -U 0 - file1 | tail -n 1" \
38 "-hello\n" "" "hello\n"
40 testing "cat > /dev/full" \
41 "cat - > /dev/full 2>stderr && echo ok; cat stderr; rm stderr" \
42 "cat: xwrite: No space left on device\n" "" "zero\n"