##// END OF EJS Templates
test-ssh: add some flush() to make output deterministic...
Yuya Nishihara -
r37962:45a669ba default
parent child Browse files
Show More
@@ -161,10 +161,12 b' Test pushing to a server that has a pret'
161 161 > import sys
162 162 > def hook1line(ui, repo, **kwargs):
163 163 > ui.write(b'ui.write 1 line\n')
164 > ui.flush()
164 165 > return 1
165 166 > def hook2lines(ui, repo, **kwargs):
166 167 > ui.write(b'ui.write 2 lines 1\n')
167 168 > ui.write(b'ui.write 2 lines 2\n')
169 > ui.flush()
168 170 > return 1
169 171 > def hook1lineflush(ui, repo, **kwargs):
170 172 > ui.write(b'ui.write 1 line flush\n')
@@ -181,21 +183,31 b' Test pushing to a server that has a pret'
181 183 > ui.write_err(b'ui.write_err 1\n')
182 184 > ui.write(b'ui.write 2\n')
183 185 > ui.write_err(b'ui.write_err 2\n')
186 > ui.flush()
184 187 > return 1
185 188 > def hookprintstdout(ui, repo, **kwargs):
186 189 > print('printed line')
190 > sys.stdout.flush()
187 191 > return 1
188 192 > def hookprintandwrite(ui, repo, **kwargs):
189 193 > print('print 1')
194 > sys.stdout.flush()
190 195 > ui.write(b'ui.write 1\n')
196 > ui.flush()
191 197 > print('print 2')
198 > sys.stdout.flush()
192 199 > ui.write(b'ui.write 2\n')
200 > ui.flush()
193 201 > return 1
194 202 > def hookprintstderrandstdout(ui, repo, **kwargs):
195 203 > print('stdout 1')
204 > sys.stdout.flush()
196 205 > print('stderr 1', file=sys.stderr)
206 > sys.stderr.flush()
197 207 > print('stdout 2')
208 > sys.stdout.flush()
198 209 > print('stderr 2', file=sys.stderr)
210 > sys.stderr.flush()
199 211 > return 1
200 212 > EOF
201 213
@@ -1046,10 +1058,10 b' Mixed print() and ui.write() are both ca'
1046 1058 e> adding manifests\n
1047 1059 e> adding file changes\n
1048 1060 e> added 1 changesets with 1 changes to 1 files\n
1061 e> print 1\n
1049 1062 e> ui.write 1\n
1063 e> print 2\n
1050 1064 e> ui.write 2\n
1051 e> print 1\n
1052 e> print 2\n
1053 1065 e> transaction abort!\n
1054 1066 e> rollback completed\n
1055 1067 e> abort: pretxnchangegroup.fail hook failed\n
@@ -1106,10 +1118,10 b' Mixed print() and ui.write() are both ca'
1106 1118 e> adding manifests\n
1107 1119 e> adding file changes\n
1108 1120 e> added 1 changesets with 1 changes to 1 files\n
1121 e> print 1\n
1109 1122 e> ui.write 1\n
1123 e> print 2\n
1110 1124 e> ui.write 2\n
1111 e> print 1\n
1112 e> print 2\n
1113 1125 e> transaction abort!\n
1114 1126 e> rollback completed\n
1115 1127 e> abort: pretxnchangegroup.fail hook failed\n
@@ -1180,10 +1192,10 b' print() to stdout and stderr both get ca'
1180 1192 e> adding manifests\n
1181 1193 e> adding file changes\n
1182 1194 e> added 1 changesets with 1 changes to 1 files\n
1195 e> stdout 1\n
1183 1196 e> stderr 1\n
1197 e> stdout 2\n
1184 1198 e> stderr 2\n
1185 e> stdout 1\n
1186 e> stdout 2\n
1187 1199 e> transaction abort!\n
1188 1200 e> rollback completed\n
1189 1201 e> abort: pretxnchangegroup.fail hook failed\n
@@ -1240,10 +1252,10 b' print() to stdout and stderr both get ca'
1240 1252 e> adding manifests\n
1241 1253 e> adding file changes\n
1242 1254 e> added 1 changesets with 1 changes to 1 files\n
1255 e> stdout 1\n
1243 1256 e> stderr 1\n
1257 e> stdout 2\n
1244 1258 e> stderr 2\n
1245 e> stdout 1\n
1246 e> stdout 2\n
1247 1259 e> transaction abort!\n
1248 1260 e> rollback completed\n
1249 1261 e> abort: pretxnchangegroup.fail hook failed\n
@@ -1731,10 +1743,10 b' Shell and Python hooks writing to stdout'
1731 1743 e> shell stderr 1\n
1732 1744 e> shell stdout 2\n
1733 1745 e> shell stderr 2\n
1746 e> stdout 1\n
1734 1747 e> stderr 1\n
1748 e> stdout 2\n
1735 1749 e> stderr 2\n
1736 e> stdout 1\n
1737 e> stdout 2\n
1738 1750 e> transaction abort!\n
1739 1751 e> rollback completed\n
1740 1752 e> abort: pretxnchangegroup.b hook failed\n
@@ -1795,10 +1807,10 b' Shell and Python hooks writing to stdout'
1795 1807 e> shell stderr 1\n
1796 1808 e> shell stdout 2\n
1797 1809 e> shell stderr 2\n
1810 e> stdout 1\n
1798 1811 e> stderr 1\n
1812 e> stdout 2\n
1799 1813 e> stderr 2\n
1800 e> stdout 1\n
1801 e> stdout 2\n
1802 1814 e> transaction abort!\n
1803 1815 e> rollback completed\n
1804 1816 e> abort: pretxnchangegroup.b hook failed\n
@@ -272,12 +272,14 b' a bad, evil hook that prints to stdout'
272 272 $ cat <<EOF > $TESTTMP/badhook
273 273 > import sys
274 274 > sys.stdout.write("KABOOM\n")
275 > sys.stdout.flush()
275 276 > EOF
276 277
277 278 $ cat <<EOF > $TESTTMP/badpyhook.py
278 279 > import sys
279 280 > def hook(ui, repo, hooktype, **kwargs):
280 281 > sys.stdout.write("KABOOM IN PROCESS\n")
282 > sys.stdout.flush()
281 283 > EOF
282 284
283 285 $ cat <<EOF >> ../remote/.hg/hgrc
@@ -456,6 +458,7 b' stderr from remote commands should be pr'
456 458 > def wrappedpush(orig, repo, *args, **kwargs):
457 459 > res = orig(repo, *args, **kwargs)
458 460 > repo.ui.write('local stdout\n')
461 > repo.ui.flush()
459 462 > return res
460 463 >
461 464 > def extsetup(ui):
General Comments 0
You need to be logged in to leave comments. Login now