aboutsummaryrefslogtreecommitdiff
blob: 965a5b555cdd7c9acdf3b9a8d298a9a6209b5f99 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash

. ../init.sh

set -e

export ROOT=${as}/root
export Q_VDB=/

# This is the "valid" mtime the test packages have hardcoded in the CONTENTS
# files.  The stamp is the CONTENTS while the touch date is the corresponding
# unpacked date.
STAMP=1398954900 DATE=201405011035
find "${ROOT}" -exec touch -h -t "${DATE}" {} +

mktmpdir

test() {
	local num=$1 exp=$2 ret=0
	shift 2
	eval "$@" > list || ret=$?
	if ! diff -u list ${as}/list${num}.good ; then
		tfail "output does not match"
	fi
	if [[ ${exp} -ne ${ret} ]] ; then
		tfail "exit code (${ret}) does not match expected (${exp})"
	fi
	tend $? "$*"
}

# simple check
test 01 1 "qcheck a-b/pkg"

# exclude check
test 02 1 "qcheck a-b/pkg -s ^/missing-dir/.*"

# bad-only check
test 03 1 "qcheck -Ba"

# hash mismatch ignore check
test 04 1 "qcheck -Ha"

# mtime mismatch ignore check
test 05 1 "qcheck -Ta"

# missing ignore check
test 06 1 "qcheck -Aa"

# hash+mtime+missing mismatch ignore check
test 07 0 "qcheck -AHTa"

# verbose check
test 08 1 "qcheck -v a-b/pkg"

# update check
(
cp -a "${ROOT}" mod
ROOT=${PWD}/mod
test 09 0 "qcheck -u a-b/pkg && qcheck a-b/pkg"
)

cleantmpdir

end