Require that this test be run as non-root.
[coreutils.git] / src / du-tests
blob15ea37305c1dd051757aac4b6e893a1257a150eb
1 #!/bin/bash
2 cat - <<\EOF > /dev/null
3 Invoke e.g., like this
4 DU1=du-4.5.2 DU2=du ./du-tests
5 EOF
7 test -x "$DU1" || { echo DU1 envvar not set; exit 1; }
8 test -x "$DU2" || { echo DU2 envvar not set; exit 1; }
9 # Expects $DU1 and $DU2 to be the binaries to compare.
10 d1=$(mktemp -d)
11 cp -a $DU1 $d1/du
12 d2=$(mktemp -d)
13 cp -a $DU2 $d2/du
15 for args in \
16 '-Sa .' \
17 '-Sa ../..' \
18 '-Sa a' \
19 '-Sa /tmp /t' \
20 '-Sa /tmp' \
21 '/tmp /t' \
22 '-a /tmp /t' \
23 '-a a' \
24 '-ca .' \
25 '-ca ..' \
26 '-ca ../..' \
27 '-ca /tmp /t' \
28 '-ca /tmp' \
29 '-ca a' \
30 ; do
31 echo Args: $args ======================
32 diff -u --label=$DU1 --label=$DU2 \
33 <(PATH=$d1 du $args 2>&1) <(PATH=$d2 du $args 2>&1)
34 done
35 rm -rf $d1 $d2