daemon: debug segv correct use of dereferencing NULL.
[libguestfs.git] / cat / test-virt-ls.sh
1 #!/bin/bash -
2
3 export LANG=C
4 set -e
5
6 # Read out the test directory using virt-ls.
7 if [ "$(./virt-ls ../tests/guests/fedora.img /bin)" != "ls
8 test1
9 test2
10 test3
11 test4
12 test5
13 test6
14 test7" ]; then
15     echo "$0: error: unexpected output from virt-ls"
16     exit 1
17 fi
18
19 # Try the -lR option.
20 output="$(./virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')"
21 expected="d0755/boot
22 d0755/boot/grub
23 -0644/boot/grub/grub.conf
24 d0700/boot/lost+found"
25 if [ "$output" != "$expected" ]; then
26     echo "$0: error: unexpected output from virt-ls -lR"
27     echo "output: ------------------------------------------"
28     echo "$output"
29     echo "expected: ----------------------------------------"
30     echo "$expected"
31     echo "--------------------------------------------------"
32     exit 1
33 fi