Show More
@@ -1,441 +1,443 b'' | |||||
1 | test-abort-checkin.t |
|
1 | test-abort-checkin.t | |
2 | test-add.t |
|
2 | test-add.t | |
3 | test-addremove-similar.t |
|
3 | test-addremove-similar.t | |
4 | test-addremove.t |
|
4 | test-addremove.t | |
5 | test-amend-subrepo.t |
|
5 | test-amend-subrepo.t | |
6 | test-amend.t |
|
6 | test-amend.t | |
7 | test-ancestor.py |
|
7 | test-ancestor.py | |
8 | test-annotate.py |
|
8 | test-annotate.py | |
9 | test-annotate.t |
|
9 | test-annotate.t | |
10 | test-archive-symlinks.t |
|
10 | test-archive-symlinks.t | |
11 | test-atomictempfile.py |
|
11 | test-atomictempfile.py | |
12 | test-audit-path.t |
|
12 | test-audit-path.t | |
13 | test-audit-subrepo.t |
|
13 | test-audit-subrepo.t | |
14 | test-automv.t |
|
14 | test-automv.t | |
15 | test-backout.t |
|
15 | test-backout.t | |
16 | test-backwards-remove.t |
|
16 | test-backwards-remove.t | |
17 | test-basic.t |
|
17 | test-basic.t | |
18 | test-bheads.t |
|
18 | test-bheads.t | |
19 | test-bisect.t |
|
19 | test-bisect.t | |
20 | test-bisect2.t |
|
20 | test-bisect2.t | |
21 | test-bisect3.t |
|
21 | test-bisect3.t | |
22 | test-blackbox.t |
|
22 | test-blackbox.t | |
23 | test-bookmarks-current.t |
|
23 | test-bookmarks-current.t | |
24 | test-bookmarks-merge.t |
|
24 | test-bookmarks-merge.t | |
25 | test-bookmarks-rebase.t |
|
25 | test-bookmarks-rebase.t | |
26 | test-bookmarks-strip.t |
|
26 | test-bookmarks-strip.t | |
27 | test-bookmarks.t |
|
27 | test-bookmarks.t | |
28 | test-branch-change.t |
|
28 | test-branch-change.t | |
29 | test-branch-option.t |
|
29 | test-branch-option.t | |
30 | test-branch-tag-confict.t |
|
30 | test-branch-tag-confict.t | |
31 | test-branches.t |
|
31 | test-branches.t | |
32 | test-bundle-phases.t |
|
32 | test-bundle-phases.t | |
33 | test-bundle-type.t |
|
33 | test-bundle-type.t | |
34 | test-bundle-vs-outgoing.t |
|
34 | test-bundle-vs-outgoing.t | |
35 | test-bundle2-multiple-changegroups.t |
|
35 | test-bundle2-multiple-changegroups.t | |
36 | test-cappedreader.py |
|
36 | test-cappedreader.py | |
37 | test-casecollision.t |
|
37 | test-casecollision.t | |
38 | test-cat.t |
|
38 | test-cat.t | |
39 | test-censor.t |
|
39 | test-censor.t | |
40 | test-changelog-exec.t |
|
40 | test-changelog-exec.t | |
41 | test-check-commit.t |
|
41 | test-check-commit.t | |
42 | test-check-execute.t |
|
42 | test-check-execute.t | |
43 | test-check-module-imports.t |
|
43 | test-check-module-imports.t | |
44 | test-check-pyflakes.t |
|
44 | test-check-pyflakes.t | |
45 | test-check-pylint.t |
|
45 | test-check-pylint.t | |
46 | test-check-shbang.t |
|
46 | test-check-shbang.t | |
47 | test-children.t |
|
47 | test-children.t | |
48 | test-clone-pull-corruption.t |
|
48 | test-clone-pull-corruption.t | |
49 | test-clone-r.t |
|
49 | test-clone-r.t | |
50 | test-clone-update-order.t |
|
50 | test-clone-update-order.t | |
51 | test-command-template.t |
|
51 | test-command-template.t | |
52 | test-commit-amend.t |
|
52 | test-commit-amend.t | |
53 | test-commit-interactive.t |
|
53 | test-commit-interactive.t | |
54 | test-commit-multiple.t |
|
54 | test-commit-multiple.t | |
55 | test-commit-unresolved.t |
|
55 | test-commit-unresolved.t | |
56 | test-commit.t |
|
56 | test-commit.t | |
57 | test-committer.t |
|
57 | test-committer.t | |
58 | test-completion.t |
|
58 | test-completion.t | |
59 | test-config-env.py |
|
59 | test-config-env.py | |
60 | test-config.t |
|
60 | test-config.t | |
61 | test-conflict.t |
|
61 | test-conflict.t | |
62 | test-confused-revert.t |
|
62 | test-confused-revert.t | |
63 | test-contrib-check-code.t |
|
63 | test-contrib-check-code.t | |
64 | test-contrib-check-commit.t |
|
64 | test-contrib-check-commit.t | |
65 | test-convert-authormap.t |
|
65 | test-convert-authormap.t | |
66 | test-convert-clonebranches.t |
|
66 | test-convert-clonebranches.t | |
67 | test-convert-datesort.t |
|
67 | test-convert-datesort.t | |
68 | test-convert-filemap.t |
|
68 | test-convert-filemap.t | |
69 | test-convert-hg-sink.t |
|
69 | test-convert-hg-sink.t | |
70 | test-convert-hg-source.t |
|
70 | test-convert-hg-source.t | |
71 | test-convert-hg-startrev.t |
|
71 | test-convert-hg-startrev.t | |
72 | test-convert-splicemap.t |
|
72 | test-convert-splicemap.t | |
73 | test-convert-tagsbranch-topology.t |
|
73 | test-convert-tagsbranch-topology.t | |
74 | test-copy-move-merge.t |
|
74 | test-copy-move-merge.t | |
75 | test-copy.t |
|
75 | test-copy.t | |
76 | test-copytrace-heuristics.t |
|
76 | test-copytrace-heuristics.t | |
77 | test-debugbuilddag.t |
|
77 | test-debugbuilddag.t | |
78 | test-debugbundle.t |
|
78 | test-debugbundle.t | |
79 | test-debugextensions.t |
|
79 | test-debugextensions.t | |
80 | test-debugindexdot.t |
|
80 | test-debugindexdot.t | |
81 | test-debugrename.t |
|
81 | test-debugrename.t | |
82 | test-default-push.t |
|
82 | test-default-push.t | |
83 | test-diff-binary-file.t |
|
83 | test-diff-binary-file.t | |
84 | test-diff-change.t |
|
84 | test-diff-change.t | |
85 | test-diff-copy-depth.t |
|
85 | test-diff-copy-depth.t | |
86 | test-diff-hashes.t |
|
86 | test-diff-hashes.t | |
87 | test-diff-ignore-whitespace.t |
|
87 | test-diff-ignore-whitespace.t | |
88 | test-diff-indent-heuristic.t |
|
88 | test-diff-indent-heuristic.t | |
89 | test-diff-issue2761.t |
|
89 | test-diff-issue2761.t | |
90 | test-diff-newlines.t |
|
90 | test-diff-newlines.t | |
91 | test-diff-reverse.t |
|
91 | test-diff-reverse.t | |
92 | test-diff-subdir.t |
|
92 | test-diff-subdir.t | |
93 | test-diff-unified.t |
|
93 | test-diff-unified.t | |
94 | test-diff-upgrade.t |
|
94 | test-diff-upgrade.t | |
95 | test-diffdir.t |
|
95 | test-diffdir.t | |
96 | test-diffstat.t |
|
96 | test-diffstat.t | |
97 | test-directaccess.t |
|
97 | test-directaccess.t | |
98 | test-dirstate-backup.t |
|
98 | test-dirstate-backup.t | |
99 | test-dirstate-nonnormalset.t |
|
99 | test-dirstate-nonnormalset.t | |
100 | test-dirstate.t |
|
100 | test-dirstate.t | |
101 | test-doctest.py |
|
101 | test-doctest.py | |
102 | test-double-merge.t |
|
102 | test-double-merge.t | |
103 | test-drawdag.t |
|
103 | test-drawdag.t | |
104 | test-duplicateoptions.py |
|
104 | test-duplicateoptions.py | |
105 | test-editor-filename.t |
|
105 | test-editor-filename.t | |
106 | test-empty-dir.t |
|
106 | test-empty-dir.t | |
107 | test-empty-file.t |
|
107 | test-empty-file.t | |
108 | test-empty-group.t |
|
108 | test-empty-group.t | |
109 | test-empty.t |
|
109 | test-empty.t | |
110 | test-encode.t |
|
110 | test-encode.t | |
111 | test-encoding-func.py |
|
111 | test-encoding-func.py | |
112 | test-encoding.t |
|
112 | test-encoding.t | |
113 | test-eol-add.t |
|
113 | test-eol-add.t | |
114 | test-eol-clone.t |
|
114 | test-eol-clone.t | |
115 | test-eol-hook.t |
|
115 | test-eol-hook.t | |
116 | test-eol-tag.t |
|
116 | test-eol-tag.t | |
117 | test-eol-update.t |
|
117 | test-eol-update.t | |
118 | test-excessive-merge.t |
|
118 | test-excessive-merge.t | |
119 | test-exchange-obsmarkers-case-A1.t |
|
119 | test-exchange-obsmarkers-case-A1.t | |
120 | test-exchange-obsmarkers-case-A2.t |
|
120 | test-exchange-obsmarkers-case-A2.t | |
121 | test-exchange-obsmarkers-case-A3.t |
|
121 | test-exchange-obsmarkers-case-A3.t | |
122 | test-exchange-obsmarkers-case-A4.t |
|
122 | test-exchange-obsmarkers-case-A4.t | |
123 | test-exchange-obsmarkers-case-A5.t |
|
123 | test-exchange-obsmarkers-case-A5.t | |
124 | test-exchange-obsmarkers-case-A6.t |
|
124 | test-exchange-obsmarkers-case-A6.t | |
125 | test-exchange-obsmarkers-case-A7.t |
|
125 | test-exchange-obsmarkers-case-A7.t | |
126 | test-exchange-obsmarkers-case-B1.t |
|
126 | test-exchange-obsmarkers-case-B1.t | |
127 | test-exchange-obsmarkers-case-B2.t |
|
127 | test-exchange-obsmarkers-case-B2.t | |
128 | test-exchange-obsmarkers-case-B3.t |
|
128 | test-exchange-obsmarkers-case-B3.t | |
129 | test-exchange-obsmarkers-case-B4.t |
|
129 | test-exchange-obsmarkers-case-B4.t | |
130 | test-exchange-obsmarkers-case-B5.t |
|
130 | test-exchange-obsmarkers-case-B5.t | |
131 | test-exchange-obsmarkers-case-B6.t |
|
131 | test-exchange-obsmarkers-case-B6.t | |
132 | test-exchange-obsmarkers-case-B7.t |
|
132 | test-exchange-obsmarkers-case-B7.t | |
133 | test-exchange-obsmarkers-case-C1.t |
|
133 | test-exchange-obsmarkers-case-C1.t | |
134 | test-exchange-obsmarkers-case-C2.t |
|
134 | test-exchange-obsmarkers-case-C2.t | |
135 | test-exchange-obsmarkers-case-C3.t |
|
135 | test-exchange-obsmarkers-case-C3.t | |
136 | test-exchange-obsmarkers-case-C4.t |
|
136 | test-exchange-obsmarkers-case-C4.t | |
137 | test-exchange-obsmarkers-case-D1.t |
|
137 | test-exchange-obsmarkers-case-D1.t | |
138 | test-exchange-obsmarkers-case-D2.t |
|
138 | test-exchange-obsmarkers-case-D2.t | |
139 | test-exchange-obsmarkers-case-D3.t |
|
139 | test-exchange-obsmarkers-case-D3.t | |
140 | test-exchange-obsmarkers-case-D4.t |
|
140 | test-exchange-obsmarkers-case-D4.t | |
141 | test-execute-bit.t |
|
141 | test-execute-bit.t | |
142 | test-export.t |
|
142 | test-export.t | |
143 | test-extdiff.t |
|
143 | test-extdiff.t | |
144 | test-extra-filelog-entry.t |
|
144 | test-extra-filelog-entry.t | |
145 | test-filebranch.t |
|
145 | test-filebranch.t | |
146 | test-fileset-generated.t |
|
146 | test-fileset-generated.t | |
147 | test-flags.t |
|
147 | test-flags.t | |
148 | test-generaldelta.t |
|
148 | test-generaldelta.t | |
149 | test-getbundle.t |
|
149 | test-getbundle.t | |
150 | test-git-export.t |
|
150 | test-git-export.t | |
151 | test-glog-topological.t |
|
151 | test-glog-topological.t | |
152 | test-gpg.t |
|
152 | test-gpg.t | |
153 | test-graft.t |
|
153 | test-graft.t | |
154 | test-hghave.t |
|
154 | test-hghave.t | |
155 | test-hgignore.t |
|
155 | test-hgignore.t | |
156 | test-hgk.t |
|
156 | test-hgk.t | |
157 | test-hgweb-bundle.t |
|
157 | test-hgweb-bundle.t | |
158 | test-hgweb-descend-empties.t |
|
158 | test-hgweb-descend-empties.t | |
159 | test-hgweb-empty.t |
|
159 | test-hgweb-empty.t | |
160 | test-hgweb-removed.t |
|
160 | test-hgweb-removed.t | |
161 | test-histedit-arguments.t |
|
161 | test-histedit-arguments.t | |
162 | test-histedit-base.t |
|
162 | test-histedit-base.t | |
163 | test-histedit-bookmark-motion.t |
|
163 | test-histedit-bookmark-motion.t | |
164 | test-histedit-commute.t |
|
164 | test-histedit-commute.t | |
165 | test-histedit-drop.t |
|
165 | test-histedit-drop.t | |
166 | test-histedit-edit.t |
|
166 | test-histedit-edit.t | |
167 | test-histedit-fold-non-commute.t |
|
167 | test-histedit-fold-non-commute.t | |
168 | test-histedit-fold.t |
|
168 | test-histedit-fold.t | |
169 | test-histedit-no-change.t |
|
169 | test-histedit-no-change.t | |
170 | test-histedit-non-commute-abort.t |
|
170 | test-histedit-non-commute-abort.t | |
171 | test-histedit-non-commute.t |
|
171 | test-histedit-non-commute.t | |
172 | test-histedit-obsolete.t |
|
172 | test-histedit-obsolete.t | |
173 | test-histedit-outgoing.t |
|
173 | test-histedit-outgoing.t | |
174 | test-histedit-templates.t |
|
174 | test-histedit-templates.t | |
175 | test-http-branchmap.t |
|
175 | test-http-branchmap.t | |
176 | test-http-bundle1.t |
|
176 | test-http-bundle1.t | |
177 | test-http-clone-r.t |
|
177 | test-http-clone-r.t | |
178 | test-identify.t |
|
178 | test-identify.t | |
179 | test-import-unknown.t |
|
179 | test-import-unknown.t | |
180 | test-import.t |
|
180 | test-import.t | |
181 | test-imports-checker.t |
|
181 | test-imports-checker.t | |
182 | test-incoming-outgoing.t |
|
182 | test-incoming-outgoing.t | |
183 | test-inherit-mode.t |
|
183 | test-inherit-mode.t | |
184 | test-issue1089.t |
|
184 | test-issue1089.t | |
185 | test-issue1102.t |
|
185 | test-issue1102.t | |
186 | test-issue1175.t |
|
186 | test-issue1175.t | |
187 | test-issue1306.t |
|
187 | test-issue1306.t | |
188 | test-issue1438.t |
|
188 | test-issue1438.t | |
189 | test-issue1502.t |
|
189 | test-issue1502.t | |
190 | test-issue1802.t |
|
190 | test-issue1802.t | |
191 | test-issue1877.t |
|
191 | test-issue1877.t | |
192 | test-issue1993.t |
|
192 | test-issue1993.t | |
193 | test-issue2137.t |
|
193 | test-issue2137.t | |
194 | test-issue3084.t |
|
194 | test-issue3084.t | |
195 | test-issue4074.t |
|
195 | test-issue4074.t | |
196 | test-issue522.t |
|
196 | test-issue522.t | |
197 | test-issue586.t |
|
197 | test-issue586.t | |
198 | test-issue612.t |
|
198 | test-issue612.t | |
199 | test-issue619.t |
|
199 | test-issue619.t | |
200 | test-issue660.t |
|
200 | test-issue660.t | |
201 | test-issue672.t |
|
201 | test-issue672.t | |
202 | test-issue842.t |
|
202 | test-issue842.t | |
203 | test-journal-exists.t |
|
203 | test-journal-exists.t | |
204 | test-journal-share.t |
|
204 | test-journal-share.t | |
205 | test-journal.t |
|
205 | test-journal.t | |
206 | test-largefiles-cache.t |
|
206 | test-largefiles-cache.t | |
207 | test-largefiles-misc.t |
|
207 | test-largefiles-misc.t | |
208 | test-largefiles-small-disk.t |
|
208 | test-largefiles-small-disk.t | |
209 | test-largefiles-update.t |
|
209 | test-largefiles-update.t | |
210 | test-lfs-largefiles.t |
|
210 | test-lfs-largefiles.t | |
211 | test-linerange.py |
|
211 | test-linerange.py | |
212 | test-locate.t |
|
212 | test-locate.t | |
213 | test-lock-badness.t |
|
213 | test-lock-badness.t | |
214 | test-log-linerange.t |
|
214 | test-log-linerange.t | |
215 | test-log.t |
|
215 | test-log.t | |
216 | test-logexchange.t |
|
216 | test-logexchange.t | |
217 | test-lrucachedict.py |
|
217 | test-lrucachedict.py | |
218 | test-mactext.t |
|
218 | test-mactext.t | |
219 | test-mailmap.t |
|
219 | test-mailmap.t | |
220 | test-manifest-merging.t |
|
220 | test-manifest-merging.t | |
221 | test-manifest.py |
|
221 | test-manifest.py | |
222 | test-manifest.t |
|
222 | test-manifest.t | |
223 | test-match.py |
|
223 | test-match.py | |
224 | test-mdiff.py |
|
224 | test-mdiff.py | |
225 | test-merge-changedelete.t |
|
225 | test-merge-changedelete.t | |
226 | test-merge-closedheads.t |
|
226 | test-merge-closedheads.t | |
227 | test-merge-commit.t |
|
227 | test-merge-commit.t | |
228 | test-merge-criss-cross.t |
|
228 | test-merge-criss-cross.t | |
229 | test-merge-default.t |
|
229 | test-merge-default.t | |
230 | test-merge-force.t |
|
230 | test-merge-force.t | |
231 | test-merge-halt.t |
|
231 | test-merge-halt.t | |
232 | test-merge-internal-tools-pattern.t |
|
232 | test-merge-internal-tools-pattern.t | |
233 | test-merge-local.t |
|
233 | test-merge-local.t | |
234 | test-merge-remove.t |
|
234 | test-merge-remove.t | |
235 | test-merge-revert.t |
|
235 | test-merge-revert.t | |
236 | test-merge-revert2.t |
|
236 | test-merge-revert2.t | |
237 | test-merge-subrepos.t |
|
237 | test-merge-subrepos.t | |
238 | test-merge-symlinks.t |
|
238 | test-merge-symlinks.t | |
239 | test-merge-tools.t |
|
239 | test-merge-tools.t | |
240 | test-merge-types.t |
|
240 | test-merge-types.t | |
241 | test-merge1.t |
|
241 | test-merge1.t | |
242 | test-merge10.t |
|
242 | test-merge10.t | |
243 | test-merge2.t |
|
243 | test-merge2.t | |
244 | test-merge4.t |
|
244 | test-merge4.t | |
245 | test-merge5.t |
|
245 | test-merge5.t | |
246 | test-merge6.t |
|
246 | test-merge6.t | |
247 | test-merge7.t |
|
247 | test-merge7.t | |
248 | test-merge8.t |
|
248 | test-merge8.t | |
249 | test-merge9.t |
|
249 | test-merge9.t | |
250 | test-mq-git.t |
|
250 | test-mq-git.t | |
251 | test-mq-header-date.t |
|
251 | test-mq-header-date.t | |
252 | test-mq-header-from.t |
|
252 | test-mq-header-from.t | |
253 | test-mq-merge.t |
|
253 | test-mq-merge.t | |
254 | test-mq-pull-from-bundle.t |
|
254 | test-mq-pull-from-bundle.t | |
255 | test-mq-qdelete.t |
|
255 | test-mq-qdelete.t | |
256 | test-mq-qdiff.t |
|
256 | test-mq-qdiff.t | |
257 | test-mq-qfold.t |
|
257 | test-mq-qfold.t | |
258 | test-mq-qgoto.t |
|
258 | test-mq-qgoto.t | |
259 | test-mq-qimport-fail-cleanup.t |
|
259 | test-mq-qimport-fail-cleanup.t | |
260 | test-mq-qnew.t |
|
260 | test-mq-qnew.t | |
261 | test-mq-qpush-exact.t |
|
261 | test-mq-qpush-exact.t | |
262 | test-mq-qqueue.t |
|
262 | test-mq-qqueue.t | |
263 | test-mq-qrefresh-interactive.t |
|
263 | test-mq-qrefresh-interactive.t | |
264 | test-mq-qrefresh-replace-log-message.t |
|
264 | test-mq-qrefresh-replace-log-message.t | |
265 | test-mq-qrefresh.t |
|
265 | test-mq-qrefresh.t | |
266 | test-mq-qrename.t |
|
266 | test-mq-qrename.t | |
267 | test-mq-qsave.t |
|
267 | test-mq-qsave.t | |
268 | test-mq-safety.t |
|
268 | test-mq-safety.t | |
269 | test-mq-subrepo.t |
|
269 | test-mq-subrepo.t | |
270 | test-mq-symlinks.t |
|
270 | test-mq-symlinks.t | |
271 | test-mv-cp-st-diff.t |
|
271 | test-mv-cp-st-diff.t | |
272 | test-narrow-archive.t |
|
272 | test-narrow-archive.t | |
273 | test-narrow-clone-no-ellipsis.t |
|
273 | test-narrow-clone-no-ellipsis.t | |
274 | test-narrow-clone-non-narrow-server.t |
|
274 | test-narrow-clone-non-narrow-server.t | |
275 | test-narrow-clone-nonlinear.t |
|
275 | test-narrow-clone-nonlinear.t | |
276 | test-narrow-clone.t |
|
276 | test-narrow-clone.t | |
277 | test-narrow-commit.t |
|
277 | test-narrow-commit.t | |
278 | test-narrow-copies.t |
|
278 | test-narrow-copies.t | |
279 | test-narrow-debugcommands.t |
|
279 | test-narrow-debugcommands.t | |
280 | test-narrow-debugrebuilddirstate.t |
|
280 | test-narrow-debugrebuilddirstate.t | |
281 | test-narrow-exchange-merges.t |
|
281 | test-narrow-exchange-merges.t | |
282 | test-narrow-exchange.t |
|
282 | test-narrow-exchange.t | |
283 | test-narrow-expanddirstate.t |
|
283 | test-narrow-expanddirstate.t | |
284 | test-narrow-merge.t |
|
284 | test-narrow-merge.t | |
285 | test-narrow-patch.t |
|
285 | test-narrow-patch.t | |
286 | test-narrow-patterns.t |
|
286 | test-narrow-patterns.t | |
287 | test-narrow-pull.t |
|
287 | test-narrow-pull.t | |
288 | test-narrow-rebase.t |
|
288 | test-narrow-rebase.t | |
289 | test-narrow-shallow-merges.t |
|
289 | test-narrow-shallow-merges.t | |
290 | test-narrow-shallow.t |
|
290 | test-narrow-shallow.t | |
291 | test-narrow-strip.t |
|
291 | test-narrow-strip.t | |
292 | test-narrow-update.t |
|
292 | test-narrow-update.t | |
293 | test-nested-repo.t |
|
293 | test-nested-repo.t | |
294 | test-newbranch.t |
|
294 | test-newbranch.t | |
295 | test-obshistory.t |
|
295 | test-obshistory.t | |
296 | test-obsmarker-template.t |
|
296 | test-obsmarker-template.t | |
297 | test-obsmarkers-effectflag.t |
|
297 | test-obsmarkers-effectflag.t | |
298 | test-obsolete-bundle-strip.t |
|
298 | test-obsolete-bundle-strip.t | |
299 | test-obsolete-changeset-exchange.t |
|
299 | test-obsolete-changeset-exchange.t | |
300 | test-obsolete-checkheads.t |
|
300 | test-obsolete-checkheads.t | |
301 | test-obsolete-distributed.t |
|
301 | test-obsolete-distributed.t | |
302 | test-obsolete-tag-cache.t |
|
302 | test-obsolete-tag-cache.t | |
303 | test-parents.t |
|
303 | test-parents.t | |
304 | test-pathconflicts-merge.t |
|
304 | test-pathconflicts-merge.t | |
305 | test-pathconflicts-update.t |
|
305 | test-pathconflicts-update.t | |
306 | test-pending.t |
|
306 | test-pending.t | |
307 | test-permissions.t |
|
307 | test-permissions.t | |
308 | test-phases.t |
|
308 | test-phases.t | |
309 | test-pull-branch.t |
|
309 | test-pull-branch.t | |
310 | test-pull-http.t |
|
310 | test-pull-http.t | |
311 | test-pull-permission.t |
|
311 | test-pull-permission.t | |
312 | test-pull-pull-corruption.t |
|
312 | test-pull-pull-corruption.t | |
313 | test-pull-r.t |
|
313 | test-pull-r.t | |
314 | test-pull-update.t |
|
314 | test-pull-update.t | |
315 | test-purge.t |
|
315 | test-purge.t | |
316 | test-push-checkheads-partial-C1.t |
|
316 | test-push-checkheads-partial-C1.t | |
317 | test-push-checkheads-partial-C2.t |
|
317 | test-push-checkheads-partial-C2.t | |
318 | test-push-checkheads-partial-C3.t |
|
318 | test-push-checkheads-partial-C3.t | |
319 | test-push-checkheads-partial-C4.t |
|
319 | test-push-checkheads-partial-C4.t | |
320 | test-push-checkheads-pruned-B1.t |
|
320 | test-push-checkheads-pruned-B1.t | |
321 | test-push-checkheads-pruned-B2.t |
|
321 | test-push-checkheads-pruned-B2.t | |
322 | test-push-checkheads-pruned-B3.t |
|
322 | test-push-checkheads-pruned-B3.t | |
323 | test-push-checkheads-pruned-B4.t |
|
323 | test-push-checkheads-pruned-B4.t | |
324 | test-push-checkheads-pruned-B5.t |
|
324 | test-push-checkheads-pruned-B5.t | |
325 | test-push-checkheads-pruned-B6.t |
|
325 | test-push-checkheads-pruned-B6.t | |
326 | test-push-checkheads-pruned-B7.t |
|
326 | test-push-checkheads-pruned-B7.t | |
327 | test-push-checkheads-pruned-B8.t |
|
327 | test-push-checkheads-pruned-B8.t | |
328 | test-push-checkheads-superceed-A1.t |
|
328 | test-push-checkheads-superceed-A1.t | |
329 | test-push-checkheads-superceed-A2.t |
|
329 | test-push-checkheads-superceed-A2.t | |
330 | test-push-checkheads-superceed-A3.t |
|
330 | test-push-checkheads-superceed-A3.t | |
331 | test-push-checkheads-superceed-A4.t |
|
331 | test-push-checkheads-superceed-A4.t | |
332 | test-push-checkheads-superceed-A5.t |
|
332 | test-push-checkheads-superceed-A5.t | |
333 | test-push-checkheads-superceed-A6.t |
|
333 | test-push-checkheads-superceed-A6.t | |
334 | test-push-checkheads-superceed-A7.t |
|
334 | test-push-checkheads-superceed-A7.t | |
335 | test-push-checkheads-superceed-A8.t |
|
335 | test-push-checkheads-superceed-A8.t | |
336 | test-push-checkheads-unpushed-D1.t |
|
336 | test-push-checkheads-unpushed-D1.t | |
337 | test-push-checkheads-unpushed-D2.t |
|
337 | test-push-checkheads-unpushed-D2.t | |
338 | test-push-checkheads-unpushed-D3.t |
|
338 | test-push-checkheads-unpushed-D3.t | |
339 | test-push-checkheads-unpushed-D4.t |
|
339 | test-push-checkheads-unpushed-D4.t | |
340 | test-push-checkheads-unpushed-D5.t |
|
340 | test-push-checkheads-unpushed-D5.t | |
341 | test-push-checkheads-unpushed-D6.t |
|
341 | test-push-checkheads-unpushed-D6.t | |
342 | test-push-checkheads-unpushed-D7.t |
|
342 | test-push-checkheads-unpushed-D7.t | |
343 | test-push-http.t |
|
343 | test-push-http.t | |
344 | test-push-warn.t |
|
344 | test-push-warn.t | |
345 | test-pushvars.t |
|
345 | test-pushvars.t | |
346 | test-rebase-abort.t |
|
346 | test-rebase-abort.t | |
347 | test-rebase-base-flag.t |
|
347 | test-rebase-base-flag.t | |
348 | test-rebase-bookmarks.t |
|
348 | test-rebase-bookmarks.t | |
349 | test-rebase-brute-force.t |
|
349 | test-rebase-brute-force.t | |
350 | test-rebase-cache.t |
|
350 | test-rebase-cache.t | |
351 | test-rebase-check-restore.t |
|
351 | test-rebase-check-restore.t | |
352 | test-rebase-collapse.t |
|
352 | test-rebase-collapse.t | |
353 | test-rebase-conflicts.t |
|
353 | test-rebase-conflicts.t | |
354 | test-rebase-dest.t |
|
354 | test-rebase-dest.t | |
355 | test-rebase-detach.t |
|
355 | test-rebase-detach.t | |
356 | test-rebase-emptycommit.t |
|
356 | test-rebase-emptycommit.t | |
357 | test-rebase-inmemory.t |
|
357 | test-rebase-inmemory.t | |
358 | test-rebase-interruptions.t |
|
358 | test-rebase-interruptions.t | |
359 | test-rebase-issue-noparam-single-rev.t |
|
359 | test-rebase-issue-noparam-single-rev.t | |
360 | test-rebase-legacy.t |
|
360 | test-rebase-legacy.t | |
361 | test-rebase-mq-skip.t |
|
361 | test-rebase-mq-skip.t | |
362 | test-rebase-mq.t |
|
362 | test-rebase-mq.t | |
363 | test-rebase-named-branches.t |
|
363 | test-rebase-named-branches.t | |
364 | test-rebase-newancestor.t |
|
364 | test-rebase-newancestor.t | |
365 | test-rebase-obsolete.t |
|
365 | test-rebase-obsolete.t | |
366 | test-rebase-parameters.t |
|
366 | test-rebase-parameters.t | |
367 | test-rebase-partial.t |
|
367 | test-rebase-partial.t | |
368 | test-rebase-pull.t |
|
368 | test-rebase-pull.t | |
369 | test-rebase-rename.t |
|
369 | test-rebase-rename.t | |
370 | test-rebase-scenario-global.t |
|
370 | test-rebase-scenario-global.t | |
371 | test-rebase-templates.t |
|
371 | test-rebase-templates.t | |
372 | test-rebase-transaction.t |
|
372 | test-rebase-transaction.t | |
373 | test-record.t |
|
373 | test-record.t | |
374 | test-relink.t |
|
374 | test-relink.t | |
375 | test-remove.t |
|
375 | test-remove.t | |
376 | test-rename-after-merge.t |
|
376 | test-rename-after-merge.t | |
377 | test-rename-dir-merge.t |
|
377 | test-rename-dir-merge.t | |
378 | test-rename-merge1.t |
|
378 | test-rename-merge1.t | |
379 | test-rename.t |
|
379 | test-rename.t | |
380 | test-repair-strip.t |
|
380 | test-repair-strip.t | |
381 | test-repo-compengines.t |
|
381 | test-repo-compengines.t | |
382 | test-resolve.t |
|
382 | test-resolve.t | |
383 | test-revert-flags.t |
|
383 | test-revert-flags.t | |
384 | test-revert-unknown.t |
|
384 | test-revert-unknown.t | |
385 | test-revlog-ancestry.py |
|
385 | test-revlog-ancestry.py | |
386 | test-revlog-group-emptyiter.t |
|
386 | test-revlog-group-emptyiter.t | |
387 | test-revlog-mmapindex.t |
|
387 | test-revlog-mmapindex.t | |
388 | test-revlog-packentry.t |
|
388 | test-revlog-packentry.t | |
389 | test-revset-dirstate-parents.t |
|
389 | test-revset-dirstate-parents.t | |
390 | test-revset-outgoing.t |
|
390 | test-revset-outgoing.t | |
391 | test-rollback.t |
|
391 | test-rollback.t | |
392 | test-run-tests.py |
|
392 | test-run-tests.py | |
393 | test-schemes.t |
|
393 | test-schemes.t | |
394 | test-serve.t |
|
394 | test-serve.t | |
395 | test-setdiscovery.t |
|
395 | test-setdiscovery.t | |
396 | test-share.t |
|
396 | test-share.t | |
397 | test-show-stack.t |
|
397 | test-show-stack.t | |
398 | test-show-work.t |
|
398 | test-show-work.t | |
399 | test-show.t |
|
399 | test-show.t | |
400 | test-simple-update.t |
|
400 | test-simple-update.t | |
401 | test-single-head.t |
|
401 | test-single-head.t | |
402 | test-sparse-clear.t |
|
402 | test-sparse-clear.t | |
403 | test-sparse-import.t |
|
403 | test-sparse-import.t | |
404 | test-sparse-merges.t |
|
404 | test-sparse-merges.t | |
405 | test-sparse-profiles.t |
|
405 | test-sparse-profiles.t | |
406 | test-sparse-requirement.t |
|
406 | test-sparse-requirement.t | |
407 | test-sparse-verbose-json.t |
|
407 | test-sparse-verbose-json.t | |
408 | test-ssh-clone-r.t |
|
408 | test-ssh-clone-r.t | |
409 | test-ssh-proto.t |
|
409 | test-ssh-proto.t | |
410 | test-sshserver.py |
|
410 | test-sshserver.py | |
411 | test-stack.t |
|
411 | test-stack.t | |
412 | test-status-rev.t |
|
412 | test-status-rev.t | |
413 | test-status-terse.t |
|
413 | test-status-terse.t | |
414 | test-strip-cross.t |
|
414 | test-strip-cross.t | |
415 | test-strip.t |
|
415 | test-strip.t | |
416 | test-subrepo-deep-nested-change.t |
|
416 | test-subrepo-deep-nested-change.t | |
417 | test-subrepo-missing.t |
|
417 | test-subrepo-missing.t | |
418 | test-subrepo.t |
|
418 | test-subrepo.t | |
419 | test-symlinks.t |
|
419 | test-symlinks.t | |
420 | test-tag.t |
|
420 | test-tag.t | |
421 | test-tags.t |
|
421 | test-tags.t | |
422 | test-template-engine.t |
|
422 | test-template-engine.t | |
423 | test-treemanifest.t |
|
423 | test-treemanifest.t | |
424 | test-unamend.t |
|
424 | test-unamend.t | |
425 | test-uncommit.t |
|
425 | test-uncommit.t | |
426 | test-unified-test.t |
|
426 | test-unified-test.t | |
427 | test-unrelated-pull.t |
|
427 | test-unrelated-pull.t | |
428 | test-up-local-change.t |
|
428 | test-up-local-change.t | |
429 | test-update-branches.t |
|
429 | test-update-branches.t | |
430 | test-update-dest.t |
|
430 | test-update-dest.t | |
431 | test-update-issue1456.t |
|
431 | test-update-issue1456.t | |
432 | test-update-names.t |
|
432 | test-update-names.t | |
433 | test-update-reverse.t |
|
433 | test-update-reverse.t | |
434 | test-upgrade-repo.t |
|
434 | test-upgrade-repo.t | |
435 | test-url-rev.t |
|
435 | test-url-rev.t | |
436 | test-username-newline.t |
|
436 | test-username-newline.t | |
437 | test-verify.t |
|
437 | test-verify.t | |
438 | test-websub.t |
|
438 | test-websub.t | |
439 | test-win32text.t |
|
439 | test-win32text.t | |
|
440 | test-wireproto-clientreactor.py | |||
440 | test-wireproto-framing.py |
|
441 | test-wireproto-framing.py | |
|
442 | test-wireproto-serverreactor.py | |||
441 | test-xdg.t |
|
443 | test-xdg.t |
@@ -1,130 +1,130 b'' | |||||
1 | from __future__ import absolute_import |
|
1 | from __future__ import absolute_import | |
2 |
|
2 | |||
3 | import unittest |
|
3 | import unittest | |
4 |
|
4 | |||
5 | from mercurial import ( |
|
5 | from mercurial import ( | |
6 | error, |
|
6 | error, | |
7 | wireprotoframing as framing, |
|
7 | wireprotoframing as framing, | |
8 | ) |
|
8 | ) | |
9 |
|
9 | |||
10 | ffs = framing.makeframefromhumanstring |
|
10 | ffs = framing.makeframefromhumanstring | |
11 |
|
11 | |||
12 | def sendframe(reactor, frame): |
|
12 | def sendframe(reactor, frame): | |
13 | """Send a frame bytearray to a reactor.""" |
|
13 | """Send a frame bytearray to a reactor.""" | |
14 | header = framing.parseheader(frame) |
|
14 | header = framing.parseheader(frame) | |
15 | payload = frame[framing.FRAME_HEADER_SIZE:] |
|
15 | payload = frame[framing.FRAME_HEADER_SIZE:] | |
16 | assert len(payload) == header.length |
|
16 | assert len(payload) == header.length | |
17 |
|
17 | |||
18 | return reactor.onframerecv(framing.frame(header.requestid, |
|
18 | return reactor.onframerecv(framing.frame(header.requestid, | |
19 | header.streamid, |
|
19 | header.streamid, | |
20 | header.streamflags, |
|
20 | header.streamflags, | |
21 | header.typeid, |
|
21 | header.typeid, | |
22 | header.flags, |
|
22 | header.flags, | |
23 | payload)) |
|
23 | payload)) | |
24 |
|
24 | |||
25 | class SingleSendTests(unittest.TestCase): |
|
25 | class SingleSendTests(unittest.TestCase): | |
26 | """A reactor that can only send once rejects subsequent sends.""" |
|
26 | """A reactor that can only send once rejects subsequent sends.""" | |
27 | def testbasic(self): |
|
27 | def testbasic(self): | |
28 | reactor = framing.clientreactor(hasmultiplesend=False, buffersends=True) |
|
28 | reactor = framing.clientreactor(hasmultiplesend=False, buffersends=True) | |
29 |
|
29 | |||
30 | request, action, meta = reactor.callcommand(b'foo', {}) |
|
30 | request, action, meta = reactor.callcommand(b'foo', {}) | |
31 | self.assertEqual(request.state, 'pending') |
|
31 | self.assertEqual(request.state, b'pending') | |
32 | self.assertEqual(action, 'noop') |
|
32 | self.assertEqual(action, b'noop') | |
33 |
|
33 | |||
34 | action, meta = reactor.flushcommands() |
|
34 | action, meta = reactor.flushcommands() | |
35 | self.assertEqual(action, 'sendframes') |
|
35 | self.assertEqual(action, b'sendframes') | |
36 |
|
36 | |||
37 | for frame in meta['framegen']: |
|
37 | for frame in meta[b'framegen']: | |
38 | self.assertEqual(request.state, 'sending') |
|
38 | self.assertEqual(request.state, b'sending') | |
39 |
|
39 | |||
40 | self.assertEqual(request.state, 'sent') |
|
40 | self.assertEqual(request.state, b'sent') | |
41 |
|
41 | |||
42 | with self.assertRaisesRegexp(error.ProgrammingError, |
|
42 | with self.assertRaisesRegexp(error.ProgrammingError, | |
43 | 'cannot issue new commands'): |
|
43 | 'cannot issue new commands'): | |
44 | reactor.callcommand(b'foo', {}) |
|
44 | reactor.callcommand(b'foo', {}) | |
45 |
|
45 | |||
46 | with self.assertRaisesRegexp(error.ProgrammingError, |
|
46 | with self.assertRaisesRegexp(error.ProgrammingError, | |
47 | 'cannot issue new commands'): |
|
47 | 'cannot issue new commands'): | |
48 | reactor.callcommand(b'foo', {}) |
|
48 | reactor.callcommand(b'foo', {}) | |
49 |
|
49 | |||
50 | class NoBufferTests(unittest.TestCase): |
|
50 | class NoBufferTests(unittest.TestCase): | |
51 | """A reactor without send buffering sends requests immediately.""" |
|
51 | """A reactor without send buffering sends requests immediately.""" | |
52 | def testbasic(self): |
|
52 | def testbasic(self): | |
53 | reactor = framing.clientreactor(hasmultiplesend=True, buffersends=False) |
|
53 | reactor = framing.clientreactor(hasmultiplesend=True, buffersends=False) | |
54 |
|
54 | |||
55 | request, action, meta = reactor.callcommand(b'command1', {}) |
|
55 | request, action, meta = reactor.callcommand(b'command1', {}) | |
56 | self.assertEqual(request.requestid, 1) |
|
56 | self.assertEqual(request.requestid, 1) | |
57 | self.assertEqual(action, 'sendframes') |
|
57 | self.assertEqual(action, b'sendframes') | |
58 |
|
58 | |||
59 | self.assertEqual(request.state, 'pending') |
|
59 | self.assertEqual(request.state, b'pending') | |
60 |
|
60 | |||
61 | for frame in meta['framegen']: |
|
61 | for frame in meta[b'framegen']: | |
62 | self.assertEqual(request.state, 'sending') |
|
62 | self.assertEqual(request.state, b'sending') | |
63 |
|
63 | |||
64 | self.assertEqual(request.state, 'sent') |
|
64 | self.assertEqual(request.state, b'sent') | |
65 |
|
65 | |||
66 | action, meta = reactor.flushcommands() |
|
66 | action, meta = reactor.flushcommands() | |
67 | self.assertEqual(action, 'noop') |
|
67 | self.assertEqual(action, b'noop') | |
68 |
|
68 | |||
69 | # And we can send another command. |
|
69 | # And we can send another command. | |
70 | request, action, meta = reactor.callcommand(b'command2', {}) |
|
70 | request, action, meta = reactor.callcommand(b'command2', {}) | |
71 | self.assertEqual(request.requestid, 3) |
|
71 | self.assertEqual(request.requestid, 3) | |
72 | self.assertEqual(action, 'sendframes') |
|
72 | self.assertEqual(action, b'sendframes') | |
73 |
|
73 | |||
74 | for frame in meta['framegen']: |
|
74 | for frame in meta[b'framegen']: | |
75 | self.assertEqual(request.state, 'sending') |
|
75 | self.assertEqual(request.state, b'sending') | |
76 |
|
76 | |||
77 | self.assertEqual(request.state, 'sent') |
|
77 | self.assertEqual(request.state, b'sent') | |
78 |
|
78 | |||
79 | class BadFrameRecvTests(unittest.TestCase): |
|
79 | class BadFrameRecvTests(unittest.TestCase): | |
80 | def testoddstream(self): |
|
80 | def testoddstream(self): | |
81 | reactor = framing.clientreactor() |
|
81 | reactor = framing.clientreactor() | |
82 |
|
82 | |||
83 | action, meta = sendframe(reactor, ffs(b'1 1 0 1 0 foo')) |
|
83 | action, meta = sendframe(reactor, ffs(b'1 1 0 1 0 foo')) | |
84 | self.assertEqual(action, 'error') |
|
84 | self.assertEqual(action, b'error') | |
85 | self.assertEqual(meta['message'], |
|
85 | self.assertEqual(meta[b'message'], | |
86 | 'received frame with odd numbered stream ID: 1') |
|
86 | b'received frame with odd numbered stream ID: 1') | |
87 |
|
87 | |||
88 | def testunknownstream(self): |
|
88 | def testunknownstream(self): | |
89 | reactor = framing.clientreactor() |
|
89 | reactor = framing.clientreactor() | |
90 |
|
90 | |||
91 | action, meta = sendframe(reactor, ffs(b'1 0 0 1 0 foo')) |
|
91 | action, meta = sendframe(reactor, ffs(b'1 0 0 1 0 foo')) | |
92 | self.assertEqual(action, 'error') |
|
92 | self.assertEqual(action, b'error') | |
93 | self.assertEqual(meta['message'], |
|
93 | self.assertEqual(meta[b'message'], | |
94 | 'received frame on unknown stream without beginning ' |
|
94 | b'received frame on unknown stream without beginning ' | |
95 | 'of stream flag set') |
|
95 | b'of stream flag set') | |
96 |
|
96 | |||
97 | def testunhandledframetype(self): |
|
97 | def testunhandledframetype(self): | |
98 | reactor = framing.clientreactor(buffersends=False) |
|
98 | reactor = framing.clientreactor(buffersends=False) | |
99 |
|
99 | |||
100 | request, action, meta = reactor.callcommand(b'foo', {}) |
|
100 | request, action, meta = reactor.callcommand(b'foo', {}) | |
101 | for frame in meta['framegen']: |
|
101 | for frame in meta[b'framegen']: | |
102 | pass |
|
102 | pass | |
103 |
|
103 | |||
104 | with self.assertRaisesRegexp(error.ProgrammingError, |
|
104 | with self.assertRaisesRegexp(error.ProgrammingError, | |
105 | 'unhandled frame type'): |
|
105 | 'unhandled frame type'): | |
106 | sendframe(reactor, ffs(b'1 0 stream-begin text-output 0 foo')) |
|
106 | sendframe(reactor, ffs(b'1 0 stream-begin text-output 0 foo')) | |
107 |
|
107 | |||
108 | class StreamTests(unittest.TestCase): |
|
108 | class StreamTests(unittest.TestCase): | |
109 | def testmultipleresponseframes(self): |
|
109 | def testmultipleresponseframes(self): | |
110 | reactor = framing.clientreactor(buffersends=False) |
|
110 | reactor = framing.clientreactor(buffersends=False) | |
111 |
|
111 | |||
112 | request, action, meta = reactor.callcommand(b'foo', {}) |
|
112 | request, action, meta = reactor.callcommand(b'foo', {}) | |
113 |
|
113 | |||
114 | self.assertEqual(action, 'sendframes') |
|
114 | self.assertEqual(action, b'sendframes') | |
115 | for f in meta['framegen']: |
|
115 | for f in meta[b'framegen']: | |
116 | pass |
|
116 | pass | |
117 |
|
117 | |||
118 | action, meta = sendframe( |
|
118 | action, meta = sendframe( | |
119 | reactor, |
|
119 | reactor, | |
120 | ffs(b'%d 0 stream-begin 4 0 foo' % request.requestid)) |
|
120 | ffs(b'%d 0 stream-begin 4 0 foo' % request.requestid)) | |
121 | self.assertEqual(action, 'responsedata') |
|
121 | self.assertEqual(action, b'responsedata') | |
122 |
|
122 | |||
123 | action, meta = sendframe( |
|
123 | action, meta = sendframe( | |
124 | reactor, |
|
124 | reactor, | |
125 | ffs(b'%d 0 0 4 eos bar' % request.requestid)) |
|
125 | ffs(b'%d 0 0 4 eos bar' % request.requestid)) | |
126 | self.assertEqual(action, 'responsedata') |
|
126 | self.assertEqual(action, b'responsedata') | |
127 |
|
127 | |||
128 | if __name__ == '__main__': |
|
128 | if __name__ == '__main__': | |
129 | import silenttestrunner |
|
129 | import silenttestrunner | |
130 | silenttestrunner.main(__name__) |
|
130 | silenttestrunner.main(__name__) |
@@ -1,485 +1,485 b'' | |||||
1 | from __future__ import absolute_import, print_function |
|
1 | from __future__ import absolute_import, print_function | |
2 |
|
2 | |||
3 | import unittest |
|
3 | import unittest | |
4 |
|
4 | |||
5 | from mercurial.thirdparty import ( |
|
5 | from mercurial.thirdparty import ( | |
6 | cbor, |
|
6 | cbor, | |
7 | ) |
|
7 | ) | |
8 | from mercurial import ( |
|
8 | from mercurial import ( | |
9 | util, |
|
9 | util, | |
10 | wireprotoframing as framing, |
|
10 | wireprotoframing as framing, | |
11 | ) |
|
11 | ) | |
12 |
|
12 | |||
13 | ffs = framing.makeframefromhumanstring |
|
13 | ffs = framing.makeframefromhumanstring | |
14 |
|
14 | |||
15 | def makereactor(deferoutput=False): |
|
15 | def makereactor(deferoutput=False): | |
16 | return framing.serverreactor(deferoutput=deferoutput) |
|
16 | return framing.serverreactor(deferoutput=deferoutput) | |
17 |
|
17 | |||
18 | def sendframes(reactor, gen): |
|
18 | def sendframes(reactor, gen): | |
19 | """Send a generator of frame bytearray to a reactor. |
|
19 | """Send a generator of frame bytearray to a reactor. | |
20 |
|
20 | |||
21 | Emits a generator of results from ``onframerecv()`` calls. |
|
21 | Emits a generator of results from ``onframerecv()`` calls. | |
22 | """ |
|
22 | """ | |
23 | for frame in gen: |
|
23 | for frame in gen: | |
24 | header = framing.parseheader(frame) |
|
24 | header = framing.parseheader(frame) | |
25 | payload = frame[framing.FRAME_HEADER_SIZE:] |
|
25 | payload = frame[framing.FRAME_HEADER_SIZE:] | |
26 | assert len(payload) == header.length |
|
26 | assert len(payload) == header.length | |
27 |
|
27 | |||
28 | yield reactor.onframerecv(framing.frame(header.requestid, |
|
28 | yield reactor.onframerecv(framing.frame(header.requestid, | |
29 | header.streamid, |
|
29 | header.streamid, | |
30 | header.streamflags, |
|
30 | header.streamflags, | |
31 | header.typeid, |
|
31 | header.typeid, | |
32 | header.flags, |
|
32 | header.flags, | |
33 | payload)) |
|
33 | payload)) | |
34 |
|
34 | |||
35 | def sendcommandframes(reactor, stream, rid, cmd, args, datafh=None): |
|
35 | def sendcommandframes(reactor, stream, rid, cmd, args, datafh=None): | |
36 | """Generate frames to run a command and send them to a reactor.""" |
|
36 | """Generate frames to run a command and send them to a reactor.""" | |
37 | return sendframes(reactor, |
|
37 | return sendframes(reactor, | |
38 | framing.createcommandframes(stream, rid, cmd, args, |
|
38 | framing.createcommandframes(stream, rid, cmd, args, | |
39 | datafh)) |
|
39 | datafh)) | |
40 |
|
40 | |||
41 |
|
41 | |||
42 | class ServerReactorTests(unittest.TestCase): |
|
42 | class ServerReactorTests(unittest.TestCase): | |
43 | def _sendsingleframe(self, reactor, f): |
|
43 | def _sendsingleframe(self, reactor, f): | |
44 | results = list(sendframes(reactor, [f])) |
|
44 | results = list(sendframes(reactor, [f])) | |
45 | self.assertEqual(len(results), 1) |
|
45 | self.assertEqual(len(results), 1) | |
46 |
|
46 | |||
47 | return results[0] |
|
47 | return results[0] | |
48 |
|
48 | |||
49 | def assertaction(self, res, expected): |
|
49 | def assertaction(self, res, expected): | |
50 | self.assertIsInstance(res, tuple) |
|
50 | self.assertIsInstance(res, tuple) | |
51 | self.assertEqual(len(res), 2) |
|
51 | self.assertEqual(len(res), 2) | |
52 | self.assertIsInstance(res[1], dict) |
|
52 | self.assertIsInstance(res[1], dict) | |
53 | self.assertEqual(res[0], expected) |
|
53 | self.assertEqual(res[0], expected) | |
54 |
|
54 | |||
55 | def assertframesequal(self, frames, framestrings): |
|
55 | def assertframesequal(self, frames, framestrings): | |
56 | expected = [ffs(s) for s in framestrings] |
|
56 | expected = [ffs(s) for s in framestrings] | |
57 | self.assertEqual(list(frames), expected) |
|
57 | self.assertEqual(list(frames), expected) | |
58 |
|
58 | |||
59 | def test1framecommand(self): |
|
59 | def test1framecommand(self): | |
60 | """Receiving a command in a single frame yields request to run it.""" |
|
60 | """Receiving a command in a single frame yields request to run it.""" | |
61 | reactor = makereactor() |
|
61 | reactor = makereactor() | |
62 | stream = framing.stream(1) |
|
62 | stream = framing.stream(1) | |
63 | results = list(sendcommandframes(reactor, stream, 1, b'mycommand', {})) |
|
63 | results = list(sendcommandframes(reactor, stream, 1, b'mycommand', {})) | |
64 | self.assertEqual(len(results), 1) |
|
64 | self.assertEqual(len(results), 1) | |
65 | self.assertaction(results[0], 'runcommand') |
|
65 | self.assertaction(results[0], b'runcommand') | |
66 | self.assertEqual(results[0][1], { |
|
66 | self.assertEqual(results[0][1], { | |
67 | 'requestid': 1, |
|
67 | b'requestid': 1, | |
68 | 'command': b'mycommand', |
|
68 | b'command': b'mycommand', | |
69 | 'args': {}, |
|
69 | b'args': {}, | |
70 | 'data': None, |
|
70 | b'data': None, | |
71 | }) |
|
71 | }) | |
72 |
|
72 | |||
73 | result = reactor.oninputeof() |
|
73 | result = reactor.oninputeof() | |
74 | self.assertaction(result, 'noop') |
|
74 | self.assertaction(result, b'noop') | |
75 |
|
75 | |||
76 | def test1argument(self): |
|
76 | def test1argument(self): | |
77 | reactor = makereactor() |
|
77 | reactor = makereactor() | |
78 | stream = framing.stream(1) |
|
78 | stream = framing.stream(1) | |
79 | results = list(sendcommandframes(reactor, stream, 41, b'mycommand', |
|
79 | results = list(sendcommandframes(reactor, stream, 41, b'mycommand', | |
80 | {b'foo': b'bar'})) |
|
80 | {b'foo': b'bar'})) | |
81 | self.assertEqual(len(results), 1) |
|
81 | self.assertEqual(len(results), 1) | |
82 | self.assertaction(results[0], 'runcommand') |
|
82 | self.assertaction(results[0], b'runcommand') | |
83 | self.assertEqual(results[0][1], { |
|
83 | self.assertEqual(results[0][1], { | |
84 | 'requestid': 41, |
|
84 | b'requestid': 41, | |
85 | 'command': b'mycommand', |
|
85 | b'command': b'mycommand', | |
86 | 'args': {b'foo': b'bar'}, |
|
86 | b'args': {b'foo': b'bar'}, | |
87 | 'data': None, |
|
87 | b'data': None, | |
88 | }) |
|
88 | }) | |
89 |
|
89 | |||
90 | def testmultiarguments(self): |
|
90 | def testmultiarguments(self): | |
91 | reactor = makereactor() |
|
91 | reactor = makereactor() | |
92 | stream = framing.stream(1) |
|
92 | stream = framing.stream(1) | |
93 | results = list(sendcommandframes(reactor, stream, 1, b'mycommand', |
|
93 | results = list(sendcommandframes(reactor, stream, 1, b'mycommand', | |
94 | {b'foo': b'bar', b'biz': b'baz'})) |
|
94 | {b'foo': b'bar', b'biz': b'baz'})) | |
95 | self.assertEqual(len(results), 1) |
|
95 | self.assertEqual(len(results), 1) | |
96 | self.assertaction(results[0], 'runcommand') |
|
96 | self.assertaction(results[0], b'runcommand') | |
97 | self.assertEqual(results[0][1], { |
|
97 | self.assertEqual(results[0][1], { | |
98 | 'requestid': 1, |
|
98 | b'requestid': 1, | |
99 | 'command': b'mycommand', |
|
99 | b'command': b'mycommand', | |
100 | 'args': {b'foo': b'bar', b'biz': b'baz'}, |
|
100 | b'args': {b'foo': b'bar', b'biz': b'baz'}, | |
101 | 'data': None, |
|
101 | b'data': None, | |
102 | }) |
|
102 | }) | |
103 |
|
103 | |||
104 | def testsimplecommanddata(self): |
|
104 | def testsimplecommanddata(self): | |
105 | reactor = makereactor() |
|
105 | reactor = makereactor() | |
106 | stream = framing.stream(1) |
|
106 | stream = framing.stream(1) | |
107 | results = list(sendcommandframes(reactor, stream, 1, b'mycommand', {}, |
|
107 | results = list(sendcommandframes(reactor, stream, 1, b'mycommand', {}, | |
108 | util.bytesio(b'data!'))) |
|
108 | util.bytesio(b'data!'))) | |
109 | self.assertEqual(len(results), 2) |
|
109 | self.assertEqual(len(results), 2) | |
110 | self.assertaction(results[0], 'wantframe') |
|
110 | self.assertaction(results[0], b'wantframe') | |
111 | self.assertaction(results[1], 'runcommand') |
|
111 | self.assertaction(results[1], b'runcommand') | |
112 | self.assertEqual(results[1][1], { |
|
112 | self.assertEqual(results[1][1], { | |
113 | 'requestid': 1, |
|
113 | b'requestid': 1, | |
114 | 'command': b'mycommand', |
|
114 | b'command': b'mycommand', | |
115 | 'args': {}, |
|
115 | b'args': {}, | |
116 | 'data': b'data!', |
|
116 | b'data': b'data!', | |
117 | }) |
|
117 | }) | |
118 |
|
118 | |||
119 | def testmultipledataframes(self): |
|
119 | def testmultipledataframes(self): | |
120 | frames = [ |
|
120 | frames = [ | |
121 | ffs(b'1 1 stream-begin command-request new|have-data ' |
|
121 | ffs(b'1 1 stream-begin command-request new|have-data ' | |
122 | b"cbor:{b'name': b'mycommand'}"), |
|
122 | b"cbor:{b'name': b'mycommand'}"), | |
123 | ffs(b'1 1 0 command-data continuation data1'), |
|
123 | ffs(b'1 1 0 command-data continuation data1'), | |
124 | ffs(b'1 1 0 command-data continuation data2'), |
|
124 | ffs(b'1 1 0 command-data continuation data2'), | |
125 | ffs(b'1 1 0 command-data eos data3'), |
|
125 | ffs(b'1 1 0 command-data eos data3'), | |
126 | ] |
|
126 | ] | |
127 |
|
127 | |||
128 | reactor = makereactor() |
|
128 | reactor = makereactor() | |
129 | results = list(sendframes(reactor, frames)) |
|
129 | results = list(sendframes(reactor, frames)) | |
130 | self.assertEqual(len(results), 4) |
|
130 | self.assertEqual(len(results), 4) | |
131 | for i in range(3): |
|
131 | for i in range(3): | |
132 | self.assertaction(results[i], 'wantframe') |
|
132 | self.assertaction(results[i], b'wantframe') | |
133 | self.assertaction(results[3], 'runcommand') |
|
133 | self.assertaction(results[3], b'runcommand') | |
134 | self.assertEqual(results[3][1], { |
|
134 | self.assertEqual(results[3][1], { | |
135 | 'requestid': 1, |
|
135 | b'requestid': 1, | |
136 | 'command': b'mycommand', |
|
136 | b'command': b'mycommand', | |
137 | 'args': {}, |
|
137 | b'args': {}, | |
138 | 'data': b'data1data2data3', |
|
138 | b'data': b'data1data2data3', | |
139 | }) |
|
139 | }) | |
140 |
|
140 | |||
141 | def testargumentanddata(self): |
|
141 | def testargumentanddata(self): | |
142 | frames = [ |
|
142 | frames = [ | |
143 | ffs(b'1 1 stream-begin command-request new|have-data ' |
|
143 | ffs(b'1 1 stream-begin command-request new|have-data ' | |
144 | b"cbor:{b'name': b'command', b'args': {b'key': b'val'," |
|
144 | b"cbor:{b'name': b'command', b'args': {b'key': b'val'," | |
145 | b"b'foo': b'bar'}}"), |
|
145 | b"b'foo': b'bar'}}"), | |
146 | ffs(b'1 1 0 command-data continuation value1'), |
|
146 | ffs(b'1 1 0 command-data continuation value1'), | |
147 | ffs(b'1 1 0 command-data eos value2'), |
|
147 | ffs(b'1 1 0 command-data eos value2'), | |
148 | ] |
|
148 | ] | |
149 |
|
149 | |||
150 | reactor = makereactor() |
|
150 | reactor = makereactor() | |
151 | results = list(sendframes(reactor, frames)) |
|
151 | results = list(sendframes(reactor, frames)) | |
152 |
|
152 | |||
153 | self.assertaction(results[-1], 'runcommand') |
|
153 | self.assertaction(results[-1], b'runcommand') | |
154 | self.assertEqual(results[-1][1], { |
|
154 | self.assertEqual(results[-1][1], { | |
155 | 'requestid': 1, |
|
155 | b'requestid': 1, | |
156 | 'command': b'command', |
|
156 | b'command': b'command', | |
157 | 'args': { |
|
157 | b'args': { | |
158 | b'key': b'val', |
|
158 | b'key': b'val', | |
159 | b'foo': b'bar', |
|
159 | b'foo': b'bar', | |
160 | }, |
|
160 | }, | |
161 | 'data': b'value1value2', |
|
161 | b'data': b'value1value2', | |
162 | }) |
|
162 | }) | |
163 |
|
163 | |||
164 | def testnewandcontinuation(self): |
|
164 | def testnewandcontinuation(self): | |
165 | result = self._sendsingleframe(makereactor(), |
|
165 | result = self._sendsingleframe(makereactor(), | |
166 | ffs(b'1 1 stream-begin command-request new|continuation ')) |
|
166 | ffs(b'1 1 stream-begin command-request new|continuation ')) | |
167 | self.assertaction(result, 'error') |
|
167 | self.assertaction(result, b'error') | |
168 | self.assertEqual(result[1], { |
|
168 | self.assertEqual(result[1], { | |
169 | 'message': b'received command request frame with both new and ' |
|
169 | b'message': b'received command request frame with both new and ' | |
170 | b'continuation flags set', |
|
170 | b'continuation flags set', | |
171 | }) |
|
171 | }) | |
172 |
|
172 | |||
173 | def testneithernewnorcontinuation(self): |
|
173 | def testneithernewnorcontinuation(self): | |
174 | result = self._sendsingleframe(makereactor(), |
|
174 | result = self._sendsingleframe(makereactor(), | |
175 | ffs(b'1 1 stream-begin command-request 0 ')) |
|
175 | ffs(b'1 1 stream-begin command-request 0 ')) | |
176 | self.assertaction(result, 'error') |
|
176 | self.assertaction(result, b'error') | |
177 | self.assertEqual(result[1], { |
|
177 | self.assertEqual(result[1], { | |
178 | 'message': b'received command request frame with neither new nor ' |
|
178 | b'message': b'received command request frame with neither new nor ' | |
179 | b'continuation flags set', |
|
179 | b'continuation flags set', | |
180 | }) |
|
180 | }) | |
181 |
|
181 | |||
182 | def testunexpectedcommanddata(self): |
|
182 | def testunexpectedcommanddata(self): | |
183 | """Command data frame when not running a command is an error.""" |
|
183 | """Command data frame when not running a command is an error.""" | |
184 | result = self._sendsingleframe(makereactor(), |
|
184 | result = self._sendsingleframe(makereactor(), | |
185 | ffs(b'1 1 stream-begin command-data 0 ignored')) |
|
185 | ffs(b'1 1 stream-begin command-data 0 ignored')) | |
186 | self.assertaction(result, 'error') |
|
186 | self.assertaction(result, b'error') | |
187 | self.assertEqual(result[1], { |
|
187 | self.assertEqual(result[1], { | |
188 | 'message': b'expected command request frame; got 3', |
|
188 | b'message': b'expected command request frame; got 3', | |
189 | }) |
|
189 | }) | |
190 |
|
190 | |||
191 | def testunexpectedcommanddatareceiving(self): |
|
191 | def testunexpectedcommanddatareceiving(self): | |
192 | """Same as above except the command is receiving.""" |
|
192 | """Same as above except the command is receiving.""" | |
193 | results = list(sendframes(makereactor(), [ |
|
193 | results = list(sendframes(makereactor(), [ | |
194 | ffs(b'1 1 stream-begin command-request new|more ' |
|
194 | ffs(b'1 1 stream-begin command-request new|more ' | |
195 | b"cbor:{b'name': b'ignored'}"), |
|
195 | b"cbor:{b'name': b'ignored'}"), | |
196 | ffs(b'1 1 0 command-data eos ignored'), |
|
196 | ffs(b'1 1 0 command-data eos ignored'), | |
197 | ])) |
|
197 | ])) | |
198 |
|
198 | |||
199 | self.assertaction(results[0], 'wantframe') |
|
199 | self.assertaction(results[0], b'wantframe') | |
200 | self.assertaction(results[1], 'error') |
|
200 | self.assertaction(results[1], b'error') | |
201 | self.assertEqual(results[1][1], { |
|
201 | self.assertEqual(results[1][1], { | |
202 | 'message': b'received command data frame for request that is not ' |
|
202 | b'message': b'received command data frame for request that is not ' | |
203 | b'expecting data: 1', |
|
203 | b'expecting data: 1', | |
204 | }) |
|
204 | }) | |
205 |
|
205 | |||
206 | def testconflictingrequestidallowed(self): |
|
206 | def testconflictingrequestidallowed(self): | |
207 | """Multiple fully serviced commands with same request ID is allowed.""" |
|
207 | """Multiple fully serviced commands with same request ID is allowed.""" | |
208 | reactor = makereactor() |
|
208 | reactor = makereactor() | |
209 | results = [] |
|
209 | results = [] | |
210 | outstream = reactor.makeoutputstream() |
|
210 | outstream = reactor.makeoutputstream() | |
211 | results.append(self._sendsingleframe( |
|
211 | results.append(self._sendsingleframe( | |
212 | reactor, ffs(b'1 1 stream-begin command-request new ' |
|
212 | reactor, ffs(b'1 1 stream-begin command-request new ' | |
213 | b"cbor:{b'name': b'command'}"))) |
|
213 | b"cbor:{b'name': b'command'}"))) | |
214 | result = reactor.onbytesresponseready(outstream, 1, b'response1') |
|
214 | result = reactor.onbytesresponseready(outstream, 1, b'response1') | |
215 | self.assertaction(result, 'sendframes') |
|
215 | self.assertaction(result, b'sendframes') | |
216 | list(result[1]['framegen']) |
|
216 | list(result[1][b'framegen']) | |
217 | results.append(self._sendsingleframe( |
|
217 | results.append(self._sendsingleframe( | |
218 | reactor, ffs(b'1 1 stream-begin command-request new ' |
|
218 | reactor, ffs(b'1 1 stream-begin command-request new ' | |
219 | b"cbor:{b'name': b'command'}"))) |
|
219 | b"cbor:{b'name': b'command'}"))) | |
220 | result = reactor.onbytesresponseready(outstream, 1, b'response2') |
|
220 | result = reactor.onbytesresponseready(outstream, 1, b'response2') | |
221 | self.assertaction(result, 'sendframes') |
|
221 | self.assertaction(result, b'sendframes') | |
222 | list(result[1]['framegen']) |
|
222 | list(result[1][b'framegen']) | |
223 | results.append(self._sendsingleframe( |
|
223 | results.append(self._sendsingleframe( | |
224 | reactor, ffs(b'1 1 stream-begin command-request new ' |
|
224 | reactor, ffs(b'1 1 stream-begin command-request new ' | |
225 | b"cbor:{b'name': b'command'}"))) |
|
225 | b"cbor:{b'name': b'command'}"))) | |
226 | result = reactor.onbytesresponseready(outstream, 1, b'response3') |
|
226 | result = reactor.onbytesresponseready(outstream, 1, b'response3') | |
227 | self.assertaction(result, 'sendframes') |
|
227 | self.assertaction(result, b'sendframes') | |
228 | list(result[1]['framegen']) |
|
228 | list(result[1][b'framegen']) | |
229 |
|
229 | |||
230 | for i in range(3): |
|
230 | for i in range(3): | |
231 | self.assertaction(results[i], 'runcommand') |
|
231 | self.assertaction(results[i], b'runcommand') | |
232 | self.assertEqual(results[i][1], { |
|
232 | self.assertEqual(results[i][1], { | |
233 | 'requestid': 1, |
|
233 | b'requestid': 1, | |
234 | 'command': b'command', |
|
234 | b'command': b'command', | |
235 | 'args': {}, |
|
235 | b'args': {}, | |
236 | 'data': None, |
|
236 | b'data': None, | |
237 | }) |
|
237 | }) | |
238 |
|
238 | |||
239 | def testconflictingrequestid(self): |
|
239 | def testconflictingrequestid(self): | |
240 | """Request ID for new command matching in-flight command is illegal.""" |
|
240 | """Request ID for new command matching in-flight command is illegal.""" | |
241 | results = list(sendframes(makereactor(), [ |
|
241 | results = list(sendframes(makereactor(), [ | |
242 | ffs(b'1 1 stream-begin command-request new|more ' |
|
242 | ffs(b'1 1 stream-begin command-request new|more ' | |
243 | b"cbor:{b'name': b'command'}"), |
|
243 | b"cbor:{b'name': b'command'}"), | |
244 | ffs(b'1 1 0 command-request new ' |
|
244 | ffs(b'1 1 0 command-request new ' | |
245 | b"cbor:{b'name': b'command1'}"), |
|
245 | b"cbor:{b'name': b'command1'}"), | |
246 | ])) |
|
246 | ])) | |
247 |
|
247 | |||
248 | self.assertaction(results[0], 'wantframe') |
|
248 | self.assertaction(results[0], b'wantframe') | |
249 | self.assertaction(results[1], 'error') |
|
249 | self.assertaction(results[1], b'error') | |
250 | self.assertEqual(results[1][1], { |
|
250 | self.assertEqual(results[1][1], { | |
251 | 'message': b'request with ID 1 already received', |
|
251 | b'message': b'request with ID 1 already received', | |
252 | }) |
|
252 | }) | |
253 |
|
253 | |||
254 | def testinterleavedcommands(self): |
|
254 | def testinterleavedcommands(self): | |
255 | cbor1 = cbor.dumps({ |
|
255 | cbor1 = cbor.dumps({ | |
256 | b'name': b'command1', |
|
256 | b'name': b'command1', | |
257 | b'args': { |
|
257 | b'args': { | |
258 | b'foo': b'bar', |
|
258 | b'foo': b'bar', | |
259 | b'key1': b'val', |
|
259 | b'key1': b'val', | |
260 | } |
|
260 | } | |
261 | }, canonical=True) |
|
261 | }, canonical=True) | |
262 | cbor3 = cbor.dumps({ |
|
262 | cbor3 = cbor.dumps({ | |
263 | b'name': b'command3', |
|
263 | b'name': b'command3', | |
264 | b'args': { |
|
264 | b'args': { | |
265 | b'biz': b'baz', |
|
265 | b'biz': b'baz', | |
266 | b'key': b'val', |
|
266 | b'key': b'val', | |
267 | }, |
|
267 | }, | |
268 | }, canonical=True) |
|
268 | }, canonical=True) | |
269 |
|
269 | |||
270 | results = list(sendframes(makereactor(), [ |
|
270 | results = list(sendframes(makereactor(), [ | |
271 | ffs(b'1 1 stream-begin command-request new|more %s' % cbor1[0:6]), |
|
271 | ffs(b'1 1 stream-begin command-request new|more %s' % cbor1[0:6]), | |
272 | ffs(b'3 1 0 command-request new|more %s' % cbor3[0:10]), |
|
272 | ffs(b'3 1 0 command-request new|more %s' % cbor3[0:10]), | |
273 | ffs(b'1 1 0 command-request continuation|more %s' % cbor1[6:9]), |
|
273 | ffs(b'1 1 0 command-request continuation|more %s' % cbor1[6:9]), | |
274 | ffs(b'3 1 0 command-request continuation|more %s' % cbor3[10:13]), |
|
274 | ffs(b'3 1 0 command-request continuation|more %s' % cbor3[10:13]), | |
275 | ffs(b'3 1 0 command-request continuation %s' % cbor3[13:]), |
|
275 | ffs(b'3 1 0 command-request continuation %s' % cbor3[13:]), | |
276 | ffs(b'1 1 0 command-request continuation %s' % cbor1[9:]), |
|
276 | ffs(b'1 1 0 command-request continuation %s' % cbor1[9:]), | |
277 | ])) |
|
277 | ])) | |
278 |
|
278 | |||
279 | self.assertEqual([t[0] for t in results], [ |
|
279 | self.assertEqual([t[0] for t in results], [ | |
280 | 'wantframe', |
|
280 | b'wantframe', | |
281 | 'wantframe', |
|
281 | b'wantframe', | |
282 | 'wantframe', |
|
282 | b'wantframe', | |
283 | 'wantframe', |
|
283 | b'wantframe', | |
284 | 'runcommand', |
|
284 | b'runcommand', | |
285 | 'runcommand', |
|
285 | b'runcommand', | |
286 | ]) |
|
286 | ]) | |
287 |
|
287 | |||
288 | self.assertEqual(results[4][1], { |
|
288 | self.assertEqual(results[4][1], { | |
289 | 'requestid': 3, |
|
289 | b'requestid': 3, | |
290 | 'command': 'command3', |
|
290 | b'command': b'command3', | |
291 | 'args': {b'biz': b'baz', b'key': b'val'}, |
|
291 | b'args': {b'biz': b'baz', b'key': b'val'}, | |
292 | 'data': None, |
|
292 | b'data': None, | |
293 | }) |
|
293 | }) | |
294 | self.assertEqual(results[5][1], { |
|
294 | self.assertEqual(results[5][1], { | |
295 | 'requestid': 1, |
|
295 | b'requestid': 1, | |
296 | 'command': 'command1', |
|
296 | b'command': b'command1', | |
297 | 'args': {b'foo': b'bar', b'key1': b'val'}, |
|
297 | b'args': {b'foo': b'bar', b'key1': b'val'}, | |
298 | 'data': None, |
|
298 | b'data': None, | |
299 | }) |
|
299 | }) | |
300 |
|
300 | |||
301 | def testmissingcommanddataframe(self): |
|
301 | def testmissingcommanddataframe(self): | |
302 | # The reactor doesn't currently handle partially received commands. |
|
302 | # The reactor doesn't currently handle partially received commands. | |
303 | # So this test is failing to do anything with request 1. |
|
303 | # So this test is failing to do anything with request 1. | |
304 | frames = [ |
|
304 | frames = [ | |
305 | ffs(b'1 1 stream-begin command-request new|have-data ' |
|
305 | ffs(b'1 1 stream-begin command-request new|have-data ' | |
306 | b"cbor:{b'name': b'command1'}"), |
|
306 | b"cbor:{b'name': b'command1'}"), | |
307 | ffs(b'3 1 0 command-request new ' |
|
307 | ffs(b'3 1 0 command-request new ' | |
308 | b"cbor:{b'name': b'command2'}"), |
|
308 | b"cbor:{b'name': b'command2'}"), | |
309 | ] |
|
309 | ] | |
310 | results = list(sendframes(makereactor(), frames)) |
|
310 | results = list(sendframes(makereactor(), frames)) | |
311 | self.assertEqual(len(results), 2) |
|
311 | self.assertEqual(len(results), 2) | |
312 | self.assertaction(results[0], 'wantframe') |
|
312 | self.assertaction(results[0], b'wantframe') | |
313 | self.assertaction(results[1], 'runcommand') |
|
313 | self.assertaction(results[1], b'runcommand') | |
314 |
|
314 | |||
315 | def testmissingcommanddataframeflags(self): |
|
315 | def testmissingcommanddataframeflags(self): | |
316 | frames = [ |
|
316 | frames = [ | |
317 | ffs(b'1 1 stream-begin command-request new|have-data ' |
|
317 | ffs(b'1 1 stream-begin command-request new|have-data ' | |
318 | b"cbor:{b'name': b'command1'}"), |
|
318 | b"cbor:{b'name': b'command1'}"), | |
319 | ffs(b'1 1 0 command-data 0 data'), |
|
319 | ffs(b'1 1 0 command-data 0 data'), | |
320 | ] |
|
320 | ] | |
321 | results = list(sendframes(makereactor(), frames)) |
|
321 | results = list(sendframes(makereactor(), frames)) | |
322 | self.assertEqual(len(results), 2) |
|
322 | self.assertEqual(len(results), 2) | |
323 | self.assertaction(results[0], 'wantframe') |
|
323 | self.assertaction(results[0], b'wantframe') | |
324 | self.assertaction(results[1], 'error') |
|
324 | self.assertaction(results[1], b'error') | |
325 | self.assertEqual(results[1][1], { |
|
325 | self.assertEqual(results[1][1], { | |
326 | 'message': b'command data frame without flags', |
|
326 | b'message': b'command data frame without flags', | |
327 | }) |
|
327 | }) | |
328 |
|
328 | |||
329 | def testframefornonreceivingrequest(self): |
|
329 | def testframefornonreceivingrequest(self): | |
330 | """Receiving a frame for a command that is not receiving is illegal.""" |
|
330 | """Receiving a frame for a command that is not receiving is illegal.""" | |
331 | results = list(sendframes(makereactor(), [ |
|
331 | results = list(sendframes(makereactor(), [ | |
332 | ffs(b'1 1 stream-begin command-request new ' |
|
332 | ffs(b'1 1 stream-begin command-request new ' | |
333 | b"cbor:{b'name': b'command1'}"), |
|
333 | b"cbor:{b'name': b'command1'}"), | |
334 | ffs(b'3 1 0 command-request new|have-data ' |
|
334 | ffs(b'3 1 0 command-request new|have-data ' | |
335 | b"cbor:{b'name': b'command3'}"), |
|
335 | b"cbor:{b'name': b'command3'}"), | |
336 | ffs(b'5 1 0 command-data eos ignored'), |
|
336 | ffs(b'5 1 0 command-data eos ignored'), | |
337 | ])) |
|
337 | ])) | |
338 | self.assertaction(results[2], 'error') |
|
338 | self.assertaction(results[2], b'error') | |
339 | self.assertEqual(results[2][1], { |
|
339 | self.assertEqual(results[2][1], { | |
340 | 'message': b'received frame for request that is not receiving: 5', |
|
340 | b'message': b'received frame for request that is not receiving: 5', | |
341 | }) |
|
341 | }) | |
342 |
|
342 | |||
343 | def testsimpleresponse(self): |
|
343 | def testsimpleresponse(self): | |
344 | """Bytes response to command sends result frames.""" |
|
344 | """Bytes response to command sends result frames.""" | |
345 | reactor = makereactor() |
|
345 | reactor = makereactor() | |
346 | instream = framing.stream(1) |
|
346 | instream = framing.stream(1) | |
347 | list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) |
|
347 | list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) | |
348 |
|
348 | |||
349 | outstream = reactor.makeoutputstream() |
|
349 | outstream = reactor.makeoutputstream() | |
350 | result = reactor.onbytesresponseready(outstream, 1, b'response') |
|
350 | result = reactor.onbytesresponseready(outstream, 1, b'response') | |
351 | self.assertaction(result, 'sendframes') |
|
351 | self.assertaction(result, b'sendframes') | |
352 | self.assertframesequal(result[1]['framegen'], [ |
|
352 | self.assertframesequal(result[1][b'framegen'], [ | |
353 | b'1 2 stream-begin bytes-response eos response', |
|
353 | b'1 2 stream-begin bytes-response eos response', | |
354 | ]) |
|
354 | ]) | |
355 |
|
355 | |||
356 | def testmultiframeresponse(self): |
|
356 | def testmultiframeresponse(self): | |
357 | """Bytes response spanning multiple frames is handled.""" |
|
357 | """Bytes response spanning multiple frames is handled.""" | |
358 | first = b'x' * framing.DEFAULT_MAX_FRAME_SIZE |
|
358 | first = b'x' * framing.DEFAULT_MAX_FRAME_SIZE | |
359 | second = b'y' * 100 |
|
359 | second = b'y' * 100 | |
360 |
|
360 | |||
361 | reactor = makereactor() |
|
361 | reactor = makereactor() | |
362 | instream = framing.stream(1) |
|
362 | instream = framing.stream(1) | |
363 | list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) |
|
363 | list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) | |
364 |
|
364 | |||
365 | outstream = reactor.makeoutputstream() |
|
365 | outstream = reactor.makeoutputstream() | |
366 | result = reactor.onbytesresponseready(outstream, 1, first + second) |
|
366 | result = reactor.onbytesresponseready(outstream, 1, first + second) | |
367 | self.assertaction(result, 'sendframes') |
|
367 | self.assertaction(result, b'sendframes') | |
368 | self.assertframesequal(result[1]['framegen'], [ |
|
368 | self.assertframesequal(result[1][b'framegen'], [ | |
369 | b'1 2 stream-begin bytes-response continuation %s' % first, |
|
369 | b'1 2 stream-begin bytes-response continuation %s' % first, | |
370 | b'1 2 0 bytes-response eos %s' % second, |
|
370 | b'1 2 0 bytes-response eos %s' % second, | |
371 | ]) |
|
371 | ]) | |
372 |
|
372 | |||
373 | def testapplicationerror(self): |
|
373 | def testapplicationerror(self): | |
374 | reactor = makereactor() |
|
374 | reactor = makereactor() | |
375 | instream = framing.stream(1) |
|
375 | instream = framing.stream(1) | |
376 | list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) |
|
376 | list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) | |
377 |
|
377 | |||
378 | outstream = reactor.makeoutputstream() |
|
378 | outstream = reactor.makeoutputstream() | |
379 | result = reactor.onapplicationerror(outstream, 1, b'some message') |
|
379 | result = reactor.onapplicationerror(outstream, 1, b'some message') | |
380 | self.assertaction(result, 'sendframes') |
|
380 | self.assertaction(result, b'sendframes') | |
381 | self.assertframesequal(result[1]['framegen'], [ |
|
381 | self.assertframesequal(result[1][b'framegen'], [ | |
382 | b'1 2 stream-begin error-response application some message', |
|
382 | b'1 2 stream-begin error-response application some message', | |
383 | ]) |
|
383 | ]) | |
384 |
|
384 | |||
385 | def test1commanddeferresponse(self): |
|
385 | def test1commanddeferresponse(self): | |
386 | """Responses when in deferred output mode are delayed until EOF.""" |
|
386 | """Responses when in deferred output mode are delayed until EOF.""" | |
387 | reactor = makereactor(deferoutput=True) |
|
387 | reactor = makereactor(deferoutput=True) | |
388 | instream = framing.stream(1) |
|
388 | instream = framing.stream(1) | |
389 | results = list(sendcommandframes(reactor, instream, 1, b'mycommand', |
|
389 | results = list(sendcommandframes(reactor, instream, 1, b'mycommand', | |
390 | {})) |
|
390 | {})) | |
391 | self.assertEqual(len(results), 1) |
|
391 | self.assertEqual(len(results), 1) | |
392 | self.assertaction(results[0], 'runcommand') |
|
392 | self.assertaction(results[0], b'runcommand') | |
393 |
|
393 | |||
394 | outstream = reactor.makeoutputstream() |
|
394 | outstream = reactor.makeoutputstream() | |
395 | result = reactor.onbytesresponseready(outstream, 1, b'response') |
|
395 | result = reactor.onbytesresponseready(outstream, 1, b'response') | |
396 | self.assertaction(result, 'noop') |
|
396 | self.assertaction(result, b'noop') | |
397 | result = reactor.oninputeof() |
|
397 | result = reactor.oninputeof() | |
398 | self.assertaction(result, 'sendframes') |
|
398 | self.assertaction(result, b'sendframes') | |
399 | self.assertframesequal(result[1]['framegen'], [ |
|
399 | self.assertframesequal(result[1][b'framegen'], [ | |
400 | b'1 2 stream-begin bytes-response eos response', |
|
400 | b'1 2 stream-begin bytes-response eos response', | |
401 | ]) |
|
401 | ]) | |
402 |
|
402 | |||
403 | def testmultiplecommanddeferresponse(self): |
|
403 | def testmultiplecommanddeferresponse(self): | |
404 | reactor = makereactor(deferoutput=True) |
|
404 | reactor = makereactor(deferoutput=True) | |
405 | instream = framing.stream(1) |
|
405 | instream = framing.stream(1) | |
406 | list(sendcommandframes(reactor, instream, 1, b'command1', {})) |
|
406 | list(sendcommandframes(reactor, instream, 1, b'command1', {})) | |
407 | list(sendcommandframes(reactor, instream, 3, b'command2', {})) |
|
407 | list(sendcommandframes(reactor, instream, 3, b'command2', {})) | |
408 |
|
408 | |||
409 | outstream = reactor.makeoutputstream() |
|
409 | outstream = reactor.makeoutputstream() | |
410 | result = reactor.onbytesresponseready(outstream, 1, b'response1') |
|
410 | result = reactor.onbytesresponseready(outstream, 1, b'response1') | |
411 | self.assertaction(result, 'noop') |
|
411 | self.assertaction(result, b'noop') | |
412 | result = reactor.onbytesresponseready(outstream, 3, b'response2') |
|
412 | result = reactor.onbytesresponseready(outstream, 3, b'response2') | |
413 | self.assertaction(result, 'noop') |
|
413 | self.assertaction(result, b'noop') | |
414 | result = reactor.oninputeof() |
|
414 | result = reactor.oninputeof() | |
415 | self.assertaction(result, 'sendframes') |
|
415 | self.assertaction(result, b'sendframes') | |
416 | self.assertframesequal(result[1]['framegen'], [ |
|
416 | self.assertframesequal(result[1][b'framegen'], [ | |
417 | b'1 2 stream-begin bytes-response eos response1', |
|
417 | b'1 2 stream-begin bytes-response eos response1', | |
418 | b'3 2 0 bytes-response eos response2' |
|
418 | b'3 2 0 bytes-response eos response2' | |
419 | ]) |
|
419 | ]) | |
420 |
|
420 | |||
421 | def testrequestidtracking(self): |
|
421 | def testrequestidtracking(self): | |
422 | reactor = makereactor(deferoutput=True) |
|
422 | reactor = makereactor(deferoutput=True) | |
423 | instream = framing.stream(1) |
|
423 | instream = framing.stream(1) | |
424 | list(sendcommandframes(reactor, instream, 1, b'command1', {})) |
|
424 | list(sendcommandframes(reactor, instream, 1, b'command1', {})) | |
425 | list(sendcommandframes(reactor, instream, 3, b'command2', {})) |
|
425 | list(sendcommandframes(reactor, instream, 3, b'command2', {})) | |
426 | list(sendcommandframes(reactor, instream, 5, b'command3', {})) |
|
426 | list(sendcommandframes(reactor, instream, 5, b'command3', {})) | |
427 |
|
427 | |||
428 | # Register results for commands out of order. |
|
428 | # Register results for commands out of order. | |
429 | outstream = reactor.makeoutputstream() |
|
429 | outstream = reactor.makeoutputstream() | |
430 | reactor.onbytesresponseready(outstream, 3, b'response3') |
|
430 | reactor.onbytesresponseready(outstream, 3, b'response3') | |
431 | reactor.onbytesresponseready(outstream, 1, b'response1') |
|
431 | reactor.onbytesresponseready(outstream, 1, b'response1') | |
432 | reactor.onbytesresponseready(outstream, 5, b'response5') |
|
432 | reactor.onbytesresponseready(outstream, 5, b'response5') | |
433 |
|
433 | |||
434 | result = reactor.oninputeof() |
|
434 | result = reactor.oninputeof() | |
435 | self.assertaction(result, 'sendframes') |
|
435 | self.assertaction(result, b'sendframes') | |
436 | self.assertframesequal(result[1]['framegen'], [ |
|
436 | self.assertframesequal(result[1][b'framegen'], [ | |
437 | b'3 2 stream-begin bytes-response eos response3', |
|
437 | b'3 2 stream-begin bytes-response eos response3', | |
438 | b'1 2 0 bytes-response eos response1', |
|
438 | b'1 2 0 bytes-response eos response1', | |
439 | b'5 2 0 bytes-response eos response5', |
|
439 | b'5 2 0 bytes-response eos response5', | |
440 | ]) |
|
440 | ]) | |
441 |
|
441 | |||
442 | def testduplicaterequestonactivecommand(self): |
|
442 | def testduplicaterequestonactivecommand(self): | |
443 | """Receiving a request ID that matches a request that isn't finished.""" |
|
443 | """Receiving a request ID that matches a request that isn't finished.""" | |
444 | reactor = makereactor() |
|
444 | reactor = makereactor() | |
445 | stream = framing.stream(1) |
|
445 | stream = framing.stream(1) | |
446 | list(sendcommandframes(reactor, stream, 1, b'command1', {})) |
|
446 | list(sendcommandframes(reactor, stream, 1, b'command1', {})) | |
447 | results = list(sendcommandframes(reactor, stream, 1, b'command1', {})) |
|
447 | results = list(sendcommandframes(reactor, stream, 1, b'command1', {})) | |
448 |
|
448 | |||
449 | self.assertaction(results[0], 'error') |
|
449 | self.assertaction(results[0], b'error') | |
450 | self.assertEqual(results[0][1], { |
|
450 | self.assertEqual(results[0][1], { | |
451 | 'message': b'request with ID 1 is already active', |
|
451 | b'message': b'request with ID 1 is already active', | |
452 | }) |
|
452 | }) | |
453 |
|
453 | |||
454 | def testduplicaterequestonactivecommandnosend(self): |
|
454 | def testduplicaterequestonactivecommandnosend(self): | |
455 | """Same as above but we've registered a response but haven't sent it.""" |
|
455 | """Same as above but we've registered a response but haven't sent it.""" | |
456 | reactor = makereactor() |
|
456 | reactor = makereactor() | |
457 | instream = framing.stream(1) |
|
457 | instream = framing.stream(1) | |
458 | list(sendcommandframes(reactor, instream, 1, b'command1', {})) |
|
458 | list(sendcommandframes(reactor, instream, 1, b'command1', {})) | |
459 | outstream = reactor.makeoutputstream() |
|
459 | outstream = reactor.makeoutputstream() | |
460 | reactor.onbytesresponseready(outstream, 1, b'response') |
|
460 | reactor.onbytesresponseready(outstream, 1, b'response') | |
461 |
|
461 | |||
462 | # We've registered the response but haven't sent it. From the |
|
462 | # We've registered the response but haven't sent it. From the | |
463 | # perspective of the reactor, the command is still active. |
|
463 | # perspective of the reactor, the command is still active. | |
464 |
|
464 | |||
465 | results = list(sendcommandframes(reactor, instream, 1, b'command1', {})) |
|
465 | results = list(sendcommandframes(reactor, instream, 1, b'command1', {})) | |
466 | self.assertaction(results[0], 'error') |
|
466 | self.assertaction(results[0], b'error') | |
467 | self.assertEqual(results[0][1], { |
|
467 | self.assertEqual(results[0][1], { | |
468 | 'message': b'request with ID 1 is already active', |
|
468 | b'message': b'request with ID 1 is already active', | |
469 | }) |
|
469 | }) | |
470 |
|
470 | |||
471 | def testduplicaterequestaftersend(self): |
|
471 | def testduplicaterequestaftersend(self): | |
472 | """We can use a duplicate request ID after we've sent the response.""" |
|
472 | """We can use a duplicate request ID after we've sent the response.""" | |
473 | reactor = makereactor() |
|
473 | reactor = makereactor() | |
474 | instream = framing.stream(1) |
|
474 | instream = framing.stream(1) | |
475 | list(sendcommandframes(reactor, instream, 1, b'command1', {})) |
|
475 | list(sendcommandframes(reactor, instream, 1, b'command1', {})) | |
476 | outstream = reactor.makeoutputstream() |
|
476 | outstream = reactor.makeoutputstream() | |
477 | res = reactor.onbytesresponseready(outstream, 1, b'response') |
|
477 | res = reactor.onbytesresponseready(outstream, 1, b'response') | |
478 | list(res[1]['framegen']) |
|
478 | list(res[1][b'framegen']) | |
479 |
|
479 | |||
480 | results = list(sendcommandframes(reactor, instream, 1, b'command1', {})) |
|
480 | results = list(sendcommandframes(reactor, instream, 1, b'command1', {})) | |
481 | self.assertaction(results[0], 'runcommand') |
|
481 | self.assertaction(results[0], b'runcommand') | |
482 |
|
482 | |||
483 | if __name__ == '__main__': |
|
483 | if __name__ == '__main__': | |
484 | import silenttestrunner |
|
484 | import silenttestrunner | |
485 | silenttestrunner.main(__name__) |
|
485 | silenttestrunner.main(__name__) |
General Comments 0
You need to be logged in to leave comments.
Login now