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 36 37 38 39 40 41 42
|
#!/usr/bin/env bash
source common
DESC="scan(files7) with scan-time --hardlinks-is-unique"
(cd ./files7 && ./create_files)
$DUPD_CMD scan --path `pwd`/files7 -q -I
checkrv $?
DESC="report(files7)"
$DUPD_CMD report --cut `pwd`/files7/ | grep -v "Duplicate report from database" > nreport
checkrv $?
# The pair reported as dups will differ depending on which of the hard linked
# files is seen first by the scan (the subsequent ones get ignored due to -I)
# Since can't rely on which files are reported, verify that only two are
# (for a total output lenght of 7 lines).
# mawk is missing -e option so changed to using a file and -f option
# hopefully this works with all variants of awk
echo '{print $1;}' > /tmp/test.63.$$
WC=`wc nreport | awk -f /tmp/test.63.$$`
if [ "$WC" != "7" ]; then
echo "FAIL ${DESC}"
exit 1
fi
rm -f /tmp/test.63.$$
# File 8 is always a true dup (not a hard link, contains same data)
# so it must always be one of the two reported.
DESC="report(files7) file 8 is always a dup"
grep '8$' nreport > /dev/null
checkrv $?
rm -f files7/?
tdone
|