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