##// END OF EJS Templates
tests: move mock blackbox extension into own file...
Gregory Szorc -
r24705:0ead0a07 default
parent child Browse files
Show More
@@ -0,0 +1,11 b''
1 from mercurial import util
2
3 def makedate():
4 return 0, 0
5 def getuser():
6 return 'bob'
7
8 # mock the date and user apis so the output is always the same
9 def uisetup(ui):
10 util.makedate = makedate
11 util.getuser = getuser
@@ -1,170 +1,158 b''
1 setup
1 setup
2 $ cat > mock.py <<EOF
3 > from mercurial import util
4 >
5 > def makedate():
6 > return 0, 0
7 > def getuser():
8 > return 'bob'
9 > # mock the date and user apis so the output is always the same
10 > def uisetup(ui):
11 > util.makedate = makedate
12 > util.getuser = getuser
13 > EOF
14 $ cat >> $HGRCPATH <<EOF
2 $ cat >> $HGRCPATH <<EOF
15 > [extensions]
3 > [extensions]
16 > blackbox=
4 > blackbox=
17 > mock=`pwd`/mock.py
5 > mock=$TESTDIR/mockblackbox.py
18 > mq=
6 > mq=
19 > EOF
7 > EOF
20 $ hg init blackboxtest
8 $ hg init blackboxtest
21 $ cd blackboxtest
9 $ cd blackboxtest
22
10
23 command, exit codes, and duration
11 command, exit codes, and duration
24
12
25 $ echo a > a
13 $ echo a > a
26 $ hg add a
14 $ hg add a
27 $ hg blackbox
15 $ hg blackbox
28 1970/01/01 00:00:00 bob> add a
16 1970/01/01 00:00:00 bob> add a
29 1970/01/01 00:00:00 bob> add a exited 0 after * seconds (glob)
17 1970/01/01 00:00:00 bob> add a exited 0 after * seconds (glob)
30
18
31 incoming change tracking
19 incoming change tracking
32
20
33 create two heads to verify that we only see one change in the log later
21 create two heads to verify that we only see one change in the log later
34 $ hg commit -ma
22 $ hg commit -ma
35 $ hg up null
23 $ hg up null
36 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
24 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
37 $ echo b > b
25 $ echo b > b
38 $ hg commit -Amb
26 $ hg commit -Amb
39 adding b
27 adding b
40 created new head
28 created new head
41
29
42 clone, commit, pull
30 clone, commit, pull
43 $ hg clone . ../blackboxtest2
31 $ hg clone . ../blackboxtest2
44 updating to branch default
32 updating to branch default
45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 $ echo c > c
34 $ echo c > c
47 $ hg commit -Amc
35 $ hg commit -Amc
48 adding c
36 adding c
49 $ cd ../blackboxtest2
37 $ cd ../blackboxtest2
50 $ hg pull
38 $ hg pull
51 pulling from $TESTTMP/blackboxtest (glob)
39 pulling from $TESTTMP/blackboxtest (glob)
52 searching for changes
40 searching for changes
53 adding changesets
41 adding changesets
54 adding manifests
42 adding manifests
55 adding file changes
43 adding file changes
56 added 1 changesets with 1 changes to 1 files
44 added 1 changesets with 1 changes to 1 files
57 (run 'hg update' to get a working copy)
45 (run 'hg update' to get a working copy)
58 $ hg blackbox -l 5
46 $ hg blackbox -l 5
59 1970/01/01 00:00:00 bob> pull
47 1970/01/01 00:00:00 bob> pull
60 1970/01/01 00:00:00 bob> updated served branch cache in ?.???? seconds (glob)
48 1970/01/01 00:00:00 bob> updated served branch cache in ?.???? seconds (glob)
61 1970/01/01 00:00:00 bob> wrote served branch cache with 1 labels and 2 nodes
49 1970/01/01 00:00:00 bob> wrote served branch cache with 1 labels and 2 nodes
62 1970/01/01 00:00:00 bob> 1 incoming changes - new heads: d02f48003e62
50 1970/01/01 00:00:00 bob> 1 incoming changes - new heads: d02f48003e62
63 1970/01/01 00:00:00 bob> pull exited 0 after * seconds (glob)
51 1970/01/01 00:00:00 bob> pull exited 0 after * seconds (glob)
64
52
65 we must not cause a failure if we cannot write to the log
53 we must not cause a failure if we cannot write to the log
66
54
67 $ hg rollback
55 $ hg rollback
68 repository tip rolled back to revision 1 (undo pull)
56 repository tip rolled back to revision 1 (undo pull)
69
57
70 #if unix-permissions no-root
58 #if unix-permissions no-root
71 $ chmod 000 .hg/blackbox.log
59 $ chmod 000 .hg/blackbox.log
72 $ hg --debug incoming
60 $ hg --debug incoming
73 warning: cannot write to blackbox.log: Permission denied
61 warning: cannot write to blackbox.log: Permission denied
74 comparing with $TESTTMP/blackboxtest (glob)
62 comparing with $TESTTMP/blackboxtest (glob)
75 query 1; heads
63 query 1; heads
76 searching for changes
64 searching for changes
77 all local heads known remotely
65 all local heads known remotely
78 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
66 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
79 tag: tip
67 tag: tip
80 phase: draft
68 phase: draft
81 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
69 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
82 parent: -1:0000000000000000000000000000000000000000
70 parent: -1:0000000000000000000000000000000000000000
83 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
71 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
84 user: test
72 user: test
85 date: Thu Jan 01 00:00:00 1970 +0000
73 date: Thu Jan 01 00:00:00 1970 +0000
86 files+: c
74 files+: c
87 extra: branch=default
75 extra: branch=default
88 description:
76 description:
89 c
77 c
90
78
91
79
92 #endif
80 #endif
93 $ hg pull
81 $ hg pull
94 pulling from $TESTTMP/blackboxtest (glob)
82 pulling from $TESTTMP/blackboxtest (glob)
95 searching for changes
83 searching for changes
96 adding changesets
84 adding changesets
97 adding manifests
85 adding manifests
98 adding file changes
86 adding file changes
99 added 1 changesets with 1 changes to 1 files
87 added 1 changesets with 1 changes to 1 files
100 (run 'hg update' to get a working copy)
88 (run 'hg update' to get a working copy)
101
89
102 a failure reading from the log is fine
90 a failure reading from the log is fine
103 #if unix-permissions no-root
91 #if unix-permissions no-root
104 $ hg blackbox -l 3
92 $ hg blackbox -l 3
105 abort: Permission denied: $TESTTMP/blackboxtest2/.hg/blackbox.log
93 abort: Permission denied: $TESTTMP/blackboxtest2/.hg/blackbox.log
106 [255]
94 [255]
107
95
108 $ chmod 600 .hg/blackbox.log
96 $ chmod 600 .hg/blackbox.log
109 #endif
97 #endif
110
98
111 backup bundles get logged
99 backup bundles get logged
112
100
113 $ touch d
101 $ touch d
114 $ hg commit -Amd
102 $ hg commit -Amd
115 adding d
103 adding d
116 created new head
104 created new head
117 $ hg strip tip
105 $ hg strip tip
118 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
106 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
119 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
107 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
120 $ hg blackbox -l 5
108 $ hg blackbox -l 5
121 1970/01/01 00:00:00 bob> strip tip
109 1970/01/01 00:00:00 bob> strip tip
122 1970/01/01 00:00:00 bob> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
110 1970/01/01 00:00:00 bob> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
123 1970/01/01 00:00:00 bob> updated base branch cache in ?.???? seconds (glob)
111 1970/01/01 00:00:00 bob> updated base branch cache in ?.???? seconds (glob)
124 1970/01/01 00:00:00 bob> wrote base branch cache with 1 labels and 2 nodes
112 1970/01/01 00:00:00 bob> wrote base branch cache with 1 labels and 2 nodes
125 1970/01/01 00:00:00 bob> strip tip exited 0 after * seconds (glob)
113 1970/01/01 00:00:00 bob> strip tip exited 0 after * seconds (glob)
126
114
127 tags cache gets logged
115 tags cache gets logged
128 $ hg up tip
116 $ hg up tip
129 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 $ hg tag -m 'create test tag' test-tag
118 $ hg tag -m 'create test tag' test-tag
131 $ hg tags
119 $ hg tags
132 tip 3:5b5562c08298
120 tip 3:5b5562c08298
133 test-tag 2:d02f48003e62
121 test-tag 2:d02f48003e62
134 $ hg blackbox -l 3
122 $ hg blackbox -l 3
135 1970/01/01 00:00:00 bob> resolved 1 tags cache entries from 1 manifests in ?.???? seconds (glob)
123 1970/01/01 00:00:00 bob> resolved 1 tags cache entries from 1 manifests in ?.???? seconds (glob)
136 1970/01/01 00:00:00 bob> writing tags cache file with 2 heads and 1 tags
124 1970/01/01 00:00:00 bob> writing tags cache file with 2 heads and 1 tags
137 1970/01/01 00:00:00 bob> tags exited 0 after ?.?? seconds (glob)
125 1970/01/01 00:00:00 bob> tags exited 0 after ?.?? seconds (glob)
138
126
139 extension and python hooks - use the eol extension for a pythonhook
127 extension and python hooks - use the eol extension for a pythonhook
140
128
141 $ echo '[extensions]' >> .hg/hgrc
129 $ echo '[extensions]' >> .hg/hgrc
142 $ echo 'eol=' >> .hg/hgrc
130 $ echo 'eol=' >> .hg/hgrc
143 $ echo '[hooks]' >> .hg/hgrc
131 $ echo '[hooks]' >> .hg/hgrc
144 $ echo 'update = echo hooked' >> .hg/hgrc
132 $ echo 'update = echo hooked' >> .hg/hgrc
145 $ hg update
133 $ hg update
146 hooked
134 hooked
147 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 $ hg blackbox -l 4
136 $ hg blackbox -l 4
149 1970/01/01 00:00:00 bob> update
137 1970/01/01 00:00:00 bob> update
150 1970/01/01 00:00:00 bob> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
138 1970/01/01 00:00:00 bob> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
151 1970/01/01 00:00:00 bob> exthook-update: echo hooked finished in * seconds (glob)
139 1970/01/01 00:00:00 bob> exthook-update: echo hooked finished in * seconds (glob)
152 1970/01/01 00:00:00 bob> update exited 0 after * seconds (glob)
140 1970/01/01 00:00:00 bob> update exited 0 after * seconds (glob)
153
141
154 log rotation
142 log rotation
155
143
156 $ echo '[blackbox]' >> .hg/hgrc
144 $ echo '[blackbox]' >> .hg/hgrc
157 $ echo 'maxsize = 20 b' >> .hg/hgrc
145 $ echo 'maxsize = 20 b' >> .hg/hgrc
158 $ echo 'maxfiles = 3' >> .hg/hgrc
146 $ echo 'maxfiles = 3' >> .hg/hgrc
159 $ hg status
147 $ hg status
160 $ hg status
148 $ hg status
161 $ hg status
149 $ hg status
162 $ hg tip -q
150 $ hg tip -q
163 3:5b5562c08298
151 3:5b5562c08298
164 $ ls .hg/blackbox.log*
152 $ ls .hg/blackbox.log*
165 .hg/blackbox.log
153 .hg/blackbox.log
166 .hg/blackbox.log.1
154 .hg/blackbox.log.1
167 .hg/blackbox.log.2
155 .hg/blackbox.log.2
168
156
169 cleanup
157 cleanup
170 $ cd ..
158 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now