summaryrefslogtreecommitdiff
path: root/src/du-tests
blob: 15ea37305c1dd051757aac4b6e893a1257a150eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
cat - <<\EOF > /dev/null
Invoke e.g., like this
DU1=du-4.5.2 DU2=du ./du-tests
EOF

test -x "$DU1" || { echo DU1 envvar not set; exit 1; }
test -x "$DU2" || { echo DU2 envvar not set; exit 1; }
# Expects $DU1 and $DU2 to be the binaries to compare.
d1=$(mktemp -d)
cp -a $DU1 $d1/du
d2=$(mktemp -d)
cp -a $DU2 $d2/du

for args in  \
    '-Sa .' \
    '-Sa ../..' \
    '-Sa a' \
    '-Sa /tmp /t' \
    '-Sa /tmp' \
    '/tmp /t' \
    '-a /tmp /t' \
    '-a a' \
    '-ca .' \
    '-ca ..' \
    '-ca ../..' \
    '-ca /tmp /t' \
    '-ca /tmp' \
    '-ca a' \
  ; do
  echo Args: $args ======================
  diff -u --label=$DU1 --label=$DU2 \
    <(PATH=$d1 du $args 2>&1) <(PATH=$d2 du $args 2>&1)
done
rm -rf $d1 $d2