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