##// END OF EJS Templates
tests: use pdiff instead of diff for portability...
FUJIWARA Katsunori -
r33614:798f7bea stable
parent child Browse files
Show More
@@ -1,97 +1,97
1 1 Enable obsolete markers
2 2
3 3 $ cat >> $HGRCPATH << EOF
4 4 > [experimental]
5 5 > evolution=createmarkers
6 6 > [phases]
7 7 > publish=False
8 8 > EOF
9 9
10 10 Build a repo with some cacheable bits:
11 11
12 12 $ hg init a
13 13 $ cd a
14 14
15 15 $ echo a > a
16 16 $ hg ci -qAm0
17 17 $ hg tag t1
18 18 $ hg book -i bk1
19 19
20 20 $ hg branch -q b2
21 21 $ hg ci -Am1
22 22 $ hg tag t2
23 23
24 24 $ echo dumb > dumb
25 25 $ hg ci -qAmdumb
26 26 $ hg debugobsolete b1174d11b69e63cb0c5726621a43c859f0858d7f
27 27 obsoleted 1 changesets
28 28
29 29 $ hg phase -pr t1
30 30 $ hg phase -fsr t2
31 31
32 32 Make a helper function to check cache damage invariants:
33 33
34 34 - command output shouldn't change
35 35 - cache should be present after first use
36 36 - corruption/repair should be silent (no exceptions or warnings)
37 37 - cache should survive deletion, overwrite, and append
38 38 - unreadable / unwriteable caches should be ignored
39 39 - cache should be rebuilt after corruption
40 40
41 41 $ damage() {
42 42 > CMD=$1
43 43 > CACHE=.hg/cache/$2
44 44 > CLEAN=$3
45 45 > hg $CMD > before
46 46 > test -f $CACHE || echo "not present"
47 47 > echo bad > $CACHE
48 48 > test -z "$CLEAN" || $CLEAN
49 49 > hg $CMD > after
50 > diff -u before after || echo "*** overwrite corruption"
50 > "$RUNTESTDIR/pdiff" before after || echo "*** overwrite corruption"
51 51 > echo corruption >> $CACHE
52 52 > test -z "$CLEAN" || $CLEAN
53 53 > hg $CMD > after
54 > diff -u before after || echo "*** append corruption"
54 > "$RUNTESTDIR/pdiff" before after || echo "*** append corruption"
55 55 > rm $CACHE
56 56 > mkdir $CACHE
57 57 > test -z "$CLEAN" || $CLEAN
58 58 > hg $CMD > after
59 > diff -u before after || echo "*** read-only corruption"
59 > "$RUNTESTDIR/pdiff" before after || echo "*** read-only corruption"
60 60 > test -d $CACHE || echo "*** directory clobbered"
61 61 > rmdir $CACHE
62 62 > test -z "$CLEAN" || $CLEAN
63 63 > hg $CMD > after
64 > diff -u before after || echo "*** missing corruption"
64 > "$RUNTESTDIR/pdiff" before after || echo "*** missing corruption"
65 65 > test -f $CACHE || echo "not rebuilt"
66 66 > }
67 67
68 68 Beat up tags caches:
69 69
70 70 $ damage "tags --hidden" tags2
71 71 $ damage tags tags2-visible
72 72 $ damage "tag -f t3" hgtagsfnodes1
73 73
74 74 Beat up branch caches:
75 75
76 76 $ damage branches branch2-base "rm .hg/cache/branch2-[vs]*"
77 77 $ damage branches branch2-served "rm .hg/cache/branch2-[bv]*"
78 78 $ damage branches branch2-visible
79 79 $ damage "log -r branch(.)" rbc-names-v1
80 80 $ damage "log -r branch(default)" rbc-names-v1
81 81 $ damage "log -r branch(b2)" rbc-revs-v1
82 82
83 83 We currently can't detect an rbc cache with unknown names:
84 84
85 85 $ damage "log -qr branch(b2)" rbc-names-v1
86 86 --- before * (glob)
87 87 +++ after * (glob)
88 88 @@ -1,8 +?,0 @@ (glob)
89 89 -2:5fb7d38b9dc4
90 90 -3:60b597ffdafa
91 91 -4:b1174d11b69e
92 92 -5:6354685872c0
93 93 -6:5ebc725f1bef
94 94 -7:7b76eec2f273
95 95 -8:ef3428d9d644
96 96 -9:ba7a936bc03c
97 97 *** append corruption
General Comments 0
You need to be logged in to leave comments. Login now