##// END OF EJS Templates
Merge with crew.
Bryan O'Sullivan -
r5385:caadfbc4 merge default
parent child Browse files
Show More
@@ -25,31 +25,46 b' SKIPPED_STATUS = 80'
25 25 required_tools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
26 26
27 27 parser = optparse.OptionParser("%prog [options] [tests]")
28 parser.add_option("-v", "--verbose", action="store_true",
29 help="output verbose messages")
30 parser.add_option("-t", "--timeout", type="int",
31 help="kill errant tests after TIMEOUT seconds")
32 parser.add_option("-c", "--cover", action="store_true",
33 help="print a test coverage report")
34 parser.add_option("-s", "--cover_stdlib", action="store_true",
35 help="print a test coverage report inc. standard libraries")
36 28 parser.add_option("-C", "--annotate", action="store_true",
37 29 help="output files annotated with coverage")
38 parser.add_option("-r", "--retest", action="store_true",
39 help="retest failed tests")
30 parser.add_option("--child", type="int",
31 help="run as child process, summary to given fd")
32 parser.add_option("-c", "--cover", action="store_true",
33 help="print a test coverage report")
40 34 parser.add_option("-f", "--first", action="store_true",
41 35 help="exit on the first test failure")
36 parser.add_option("-i", "--interactive", action="store_true",
37 help="prompt to accept changed output")
38 parser.add_option("-j", "--jobs", type="int",
39 help="number of jobs to run in parallel")
42 40 parser.add_option("-R", "--restart", action="store_true",
43 41 help="restart at last error")
44 parser.add_option("-i", "--interactive", action="store_true",
45 help="prompt to accept changed output")
42 parser.add_option("-p", "--port", type="int",
43 help="port on which servers should listen")
44 parser.add_option("-r", "--retest", action="store_true",
45 help="retest failed tests")
46 parser.add_option("-s", "--cover_stdlib", action="store_true",
47 help="print a test coverage report inc. standard libraries")
48 parser.add_option("-t", "--timeout", type="int",
49 help="kill errant tests after TIMEOUT seconds")
50 parser.add_option("-v", "--verbose", action="store_true",
51 help="output verbose messages")
52 parser.add_option("--with-hg", type="string",
53 help="test existing install at given location")
46 54
47 parser.set_defaults(timeout=180)
55 parser.set_defaults(jobs=1, port=20059, timeout=180)
48 56 (options, args) = parser.parse_args()
49 57 verbose = options.verbose
50 58 coverage = options.cover or options.cover_stdlib or options.annotate
51 59 python = sys.executable
52 60
61 if options.jobs < 1:
62 print >> sys.stderr, 'ERROR: -j/--jobs must be positive'
63 sys.exit(1)
64 if options.interactive and options.jobs > 1:
65 print >> sys.stderr, 'ERROR: cannot mix -interactive and --jobs > 1'
66 sys.exit(1)
67
53 68 def vlog(*msg):
54 69 if verbose:
55 70 for m in msg:
@@ -368,10 +383,10 b' def run_one(test):'
368 383 return None
369 384 return ret == 0
370 385
386 if not options.child:
387 os.umask(022)
371 388
372 os.umask(022)
373
374 check_required_tools()
389 check_required_tools()
375 390
376 391 # Reset some environment variables to well-known values so that
377 392 # the tests produce repeatable output.
@@ -380,28 +395,83 b" os.environ['TZ'] = 'GMT'"
380 395
381 396 TESTDIR = os.environ["TESTDIR"] = os.getcwd()
382 397 HGTMP = os.environ["HGTMP"] = tempfile.mkdtemp("", "hgtests.")
383 DAEMON_PIDS = os.environ["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
384 HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
398 DAEMON_PIDS = None
399 HGRCPATH = None
385 400
386 401 os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
387 402 os.environ["HGMERGE"] = ('python "%s" -L my -L other'
388 % os.path.join(TESTDIR, os.path.pardir, 'contrib',
389 'simplemerge'))
403 % os.path.join(TESTDIR, os.path.pardir,
404 'contrib', 'simplemerge'))
390 405 os.environ["HGUSER"] = "test"
391 406 os.environ["HGENCODING"] = "ascii"
392 407 os.environ["HGENCODINGMODE"] = "strict"
408 os.environ["HGPORT"] = str(options.port)
409 os.environ["HGPORT1"] = str(options.port + 1)
410 os.environ["HGPORT2"] = str(options.port + 2)
393 411
394 vlog("# Using TESTDIR", TESTDIR)
395 vlog("# Using HGTMP", HGTMP)
396
397 INST = os.path.join(HGTMP, "install")
412 if options.with_hg:
413 INST = options.with_hg
414 else:
415 INST = os.path.join(HGTMP, "install")
398 416 BINDIR = os.path.join(INST, "bin")
399 417 PYTHONDIR = os.path.join(INST, "lib", "python")
400 418 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
401 419
402 try:
420 def run_children(tests):
421 if not options.with_hg:
422 install_hg()
423
424 optcopy = dict(options.__dict__)
425 optcopy['jobs'] = 1
426 optcopy['with_hg'] = INST
427 opts = []
428 for opt, value in optcopy.iteritems():
429 name = '--' + opt.replace('_', '-')
430 if value is True:
431 opts.append(name)
432 elif value is not None:
433 opts.append(name + '=' + str(value))
434
435 tests.reverse()
436 jobs = [[] for j in xrange(options.jobs)]
437 while tests:
438 for j in xrange(options.jobs):
439 if not tests: break
440 jobs[j].append(tests.pop())
441 fps = {}
442 for j in xrange(len(jobs)):
443 job = jobs[j]
444 if not job:
445 continue
446 rfd, wfd = os.pipe()
447 childopts = ['--child=%d' % wfd, '--port=%d' % (options.port + j * 3)]
448 cmdline = [python, sys.argv[0]] + opts + childopts + job
449 vlog(' '.join(cmdline))
450 fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'r')
451 os.close(wfd)
452 failures = 0
453 tested, skipped, failed = 0, 0, 0
454 while fps:
455 pid, status = os.wait()
456 fp = fps.pop(pid)
457 test, skip, fail = map(int, fp.read().splitlines())
458 tested += test
459 skipped += skip
460 failed += fail
461 vlog('pid %d exited, status %d' % (pid, status))
462 failures |= status
463 print "\n# Ran %d tests, %d skipped, %d failed." % (
464 tested, skipped, failed)
465 sys.exit(failures != 0)
466
467 def run_tests(tests):
468 global DAEMON_PIDS, HGRCPATH
469 DAEMON_PIDS = os.environ["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
470 HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
471
403 472 try:
404 install_hg()
473 if not options.with_hg:
474 install_hg()
405 475
406 476 if options.timeout > 0:
407 477 try:
@@ -416,18 +486,6 b' try:'
416 486 failed = 0
417 487 skipped = 0
418 488
419 if len(args) == 0:
420 args = os.listdir(".")
421 args.sort()
422
423
424 tests = []
425 for test in args:
426 if (test.startswith("test-") and '~' not in test and
427 ('.' not in test or test.endswith('.py') or
428 test.endswith('.bat'))):
429 tests.append(test)
430
431 489 if options.restart:
432 490 orig = list(tests)
433 491 while tests:
@@ -458,15 +516,41 b' try:'
458 516 break
459 517 tested += 1
460 518
461 print "\n# Ran %d tests, %d skipped, %d failed." % (tested, skipped,
462 failed)
519 if options.child:
520 fp = os.fdopen(options.child, 'w')
521 fp.write('%d\n%d\n%d\n' % (tested, skipped, failed))
522 fp.close()
523 else:
524 print "\n# Ran %d tests, %d skipped, %d failed." % (
525 tested, skipped, failed)
526
463 527 if coverage:
464 528 output_coverage()
465 529 except KeyboardInterrupt:
466 530 failed = True
467 531 print "\ninterrupted!"
532
533 if failed:
534 sys.exit(1)
535
536 if len(args) == 0:
537 args = os.listdir(".")
538 args.sort()
539
540 tests = []
541 for test in args:
542 if (test.startswith("test-") and '~' not in test and
543 ('.' not in test or test.endswith('.py') or
544 test.endswith('.bat'))):
545 tests.append(test)
546
547 vlog("# Using TESTDIR", TESTDIR)
548 vlog("# Using HGTMP", HGTMP)
549
550 try:
551 if len(tests) > 1 and options.jobs > 1:
552 run_children(tests)
553 else:
554 run_tests(tests)
468 555 finally:
469 556 cleanup_exit()
470
471 if failed:
472 sys.exit(1)
@@ -13,16 +13,16 b" hg commit -Am 3 -d '1000000000 0'"
13 13 echo "[web]" >> .hg/hgrc
14 14 echo "name = test-archive" >> .hg/hgrc
15 15 echo "allow_archive = gz bz2, zip" >> .hg/hgrc
16 hg serve -p 20059 -d --pid-file=hg.pid
16 hg serve -p $HGPORT -d --pid-file=hg.pid
17 17 cat hg.pid >> $DAEMON_PIDS
18 18
19 19 TIP=`hg id -v | cut -f1 -d' '`
20 20 QTIP=`hg id -q`
21 21 cat > getarchive.py <<EOF
22 import sys, urllib2
22 import os, sys, urllib2
23 23 node, archive = sys.argv[1:]
24 f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s'
25 % (node, archive))
24 f = urllib2.urlopen('http://127.0.0.1:%s/?cmd=archive;node=%s;type=%s'
25 % (os.environ['HGPORT'], node, archive))
26 26 sys.stdout.write(f.read())
27 27 EOF
28 28 http_proxy= python getarchive.py "$TIP" gz | gunzip | tar tf - | sed "s/$QTIP/TIP/"
@@ -1,15 +1,15 b''
1 1 #!/bin/sh
2 2
3 hg clone http://localhost:20059/ copy
3 hg clone http://localhost:$HGPORT/ copy
4 4 echo $?
5 5 test -d copy || echo copy: No such file or directory
6 6
7 7 cat > dumb.py <<EOF
8 import BaseHTTPServer, SimpleHTTPServer, signal
8 import BaseHTTPServer, SimpleHTTPServer, os, signal
9 9
10 10 def run(server_class=BaseHTTPServer.HTTPServer,
11 11 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
12 server_address = ('localhost', 20059)
12 server_address = ('localhost', int(os.environ['HGPORT']))
13 13 httpd = server_class(server_address, handler_class)
14 14 httpd.serve_forever()
15 15
@@ -23,7 +23,7 b' echo $! >> $DAEMON_PIDS'
23 23 # give the server some time to start running
24 24 sleep 1
25 25
26 http_proxy= hg clone http://localhost:20059/foo copy2 2>&1 | \
26 http_proxy= hg clone http://localhost:$HGPORT/foo copy2 2>&1 | \
27 27 sed -e 's/404.*/404/' -e 's/Date:.*/Date:/'
28 28 echo $?
29 29
@@ -6,8 +6,8 b' mkdir da'
6 6 echo foo > da/foo
7 7 echo foo > foo
8 8 hg ci -Ambase -d '0 0'
9 hg serve -p 20060 -d --pid-file=hg.pid
9 hg serve -p $HGPORT -d --pid-file=hg.pid
10 10 echo % manifest
11 ("$TESTDIR/get-with-headers.py" localhost:20060 '/file/tip/?style=raw')
12 ("$TESTDIR/get-with-headers.py" localhost:20060 '/file/tip/da?style=raw')
11 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw')
12 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw')
13 13 kill `cat hg.pid`
@@ -6,23 +6,23 b' hg init test'
6 6 cd test
7 7 echo foo>foo
8 8 hg commit -A -d '0 0' -m 1
9 hg --config server.uncompressed=True serve -p 20059 -d --pid-file=../hg1.pid
10 hg serve -p 20060 -d --pid-file=../hg2.pid
9 hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=../hg1.pid
10 hg serve -p $HGPORT1 -d --pid-file=../hg2.pid
11 11 # Test server address cannot be reused
12 hg serve -p 20060 2>&1 | sed -e 's/abort: cannot start server:.*/abort: cannot start server:/'
12 hg serve -p $HGPORT1 2>&1 | sed -e 's/abort: cannot start server:.*/abort: cannot start server:/'
13 13 cd ..
14 14 cat hg1.pid hg2.pid >> $DAEMON_PIDS
15 15
16 16 echo % clone via stream
17 http_proxy= hg clone --uncompressed http://localhost:20059/ copy 2>&1 | \
17 http_proxy= hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 | \
18 18 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
19 19 hg verify -R copy
20 20
21 21 echo % try to clone via stream, should use pull instead
22 http_proxy= hg clone --uncompressed http://localhost:20060/ copy2
22 http_proxy= hg clone --uncompressed http://localhost:$HGPORT1/ copy2
23 23
24 24 echo % clone via pull
25 http_proxy= hg clone http://localhost:20059/ copy-pull
25 http_proxy= hg clone http://localhost:$HGPORT1/ copy-pull
26 26 hg verify -R copy-pull
27 27
28 28 cd test
@@ -34,5 +34,5 b' echo % pull'
34 34 cd copy-pull
35 35 echo '[hooks]' >> .hg/hgrc
36 36 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
37 hg pull
37 hg pull | sed -e 's,:[0-9][0-9]*/,/,'
38 38 cd ..
@@ -49,13 +49,13 b' hg debugindex .hg/store/data/fred.i'
49 49 hg debugindex .hg/store/00manifest.i
50 50 hg verify
51 51 echo "# Starting server"
52 hg serve -p 20061 -d --pid-file=../hg1.pid
52 hg serve -p $HGPORT -d --pid-file=../hg1.pid
53 53 cd ..
54 54 cat hg1.pid >> $DAEMON_PIDS
55 55
56 56 echo "# clone remote via stream"
57 57 for i in 0 1 2 3 4 5 6 7 8; do
58 hg clone -r "$i" http://localhost:20061/ test-"$i" 2>&1
58 hg clone -r "$i" http://localhost:$HGPORT/ test-"$i" 2>&1
59 59 if cd test-"$i"; then
60 60 hg verify
61 61 cd ..
@@ -66,13 +66,13 b' hg pull ../test-7'
66 66 hg verify
67 67 cd ..
68 68 cd test-1
69 hg pull -r 4 http://localhost:20061/ 2>&1
69 hg pull -r 4 http://localhost:$HGPORT/ 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
70 70 hg verify
71 hg pull http://localhost:20061/ 2>&1
71 hg pull http://localhost:$HGPORT/ 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
72 72 cd ..
73 73 cd test-2
74 hg pull -r 5 http://localhost:20061/ 2>&1
74 hg pull -r 5 http://localhost:$HGPORT/ 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
75 75 hg verify
76 hg pull http://localhost:20061/ 2>&1
76 hg pull http://localhost:$HGPORT/ 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
77 77 hg verify
78 78 cd ..
@@ -138,7 +138,7 b' checking manifests'
138 138 crosschecking files in changesets and manifests
139 139 checking files
140 140 4 files, 9 changesets, 7 total revisions
141 pulling from http://localhost:20061/
141 pulling from http://localhost/
142 142 searching for changes
143 143 adding changesets
144 144 adding manifests
@@ -150,14 +150,14 b' checking manifests'
150 150 crosschecking files in changesets and manifests
151 151 checking files
152 152 1 files, 3 changesets, 2 total revisions
153 pulling from http://localhost:20061/
153 pulling from http://localhost/
154 154 searching for changes
155 155 adding changesets
156 156 adding manifests
157 157 adding file changes
158 158 added 6 changesets with 5 changes to 4 files
159 159 (run 'hg update' to get a working copy)
160 pulling from http://localhost:20061/
160 pulling from http://localhost/
161 161 searching for changes
162 162 adding changesets
163 163 adding manifests
@@ -169,7 +169,7 b' checking manifests'
169 169 crosschecking files in changesets and manifests
170 170 checking files
171 171 1 files, 5 changesets, 3 total revisions
172 pulling from http://localhost:20061/
172 pulling from http://localhost/
173 173 searching for changes
174 174 adding changesets
175 175 adding manifests
@@ -4,38 +4,38 b' hg init a'
4 4 cd a
5 5 echo a > a
6 6 hg ci -Ama -d '1123456789 0'
7 hg --config server.uncompressed=True serve -p 20059 -d --pid-file=hg.pid
7 hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=hg.pid
8 8 cat hg.pid >> $DAEMON_PIDS
9 9
10 10 cd ..
11 ("$TESTDIR/tinyproxy.py" 20060 localhost >proxy.log 2>&1 </dev/null &
11 ("$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 </dev/null &
12 12 echo $! > proxy.pid)
13 13 cat proxy.pid >> $DAEMON_PIDS
14 14 sleep 2
15 15
16 16 echo %% url for proxy, stream
17 http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone --uncompressed http://localhost:20059/ b | \
17 http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b | \
18 18 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
19 19 cd b
20 20 hg verify
21 21 cd ..
22 22
23 23 echo %% url for proxy, pull
24 http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone http://localhost:20059/ b-pull
24 http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull
25 25 cd b-pull
26 26 hg verify
27 27 cd ..
28 28
29 29 echo %% host:port for proxy
30 http_proxy=localhost:20060 hg clone --config http_proxy.always=True http://localhost:20059/ c
30 http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c
31 31
32 32 echo %% proxy url with user name and password
33 http_proxy=http://user:passwd@localhost:20060 hg clone --config http_proxy.always=True http://localhost:20059/ d
33 http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d
34 34
35 35 echo %% url with user name and password
36 http_proxy=http://user:passwd@localhost:20060 hg clone --config http_proxy.always=True http://user:passwd@localhost:20059/ e
36 http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e
37 37
38 38 echo %% bad host:port for proxy
39 http_proxy=localhost:20061 hg clone --config http_proxy.always=True http://localhost:20059/ f
39 http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f
40 40
41 41 exit 0
@@ -31,8 +31,8 b' checking files'
31 31 1 files, 1 changesets, 1 total revisions
32 32 adding bar
33 33 % pull
34 changegroup hook: HG_NODE=cfbd11a1fa315300a080c3de8fe36b0fc5820acf HG_SOURCE=pull HG_URL=http://localhost:20059/
35 pulling from http://localhost:20059/
34 changegroup hook: HG_NODE=cfbd11a1fa315300a080c3de8fe36b0fc5820acf HG_SOURCE=pull HG_URL=http://localhost/
35 pulling from http://localhost/
36 36 searching for changes
37 37 adding changesets
38 38 adding manifests
@@ -8,20 +8,20 b' for i in 0 1 2 3 4 5 6 7 8; do'
8 8 hg commit -A -m $i -d "1000000 0"
9 9 done
10 10 hg verify
11 hg serve -p 20059 -d --pid-file=hg.pid
11 hg serve -p $HGPORT -d --pid-file=hg.pid
12 12 cat hg.pid >> $DAEMON_PIDS
13 13 cd ..
14 14
15 15 hg init new
16 16 # http incoming
17 http_proxy= hg -R new incoming http://localhost:20059/
18 http_proxy= hg -R new incoming -r 4 http://localhost:20059/
17 http_proxy= hg -R new incoming http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
18 http_proxy= hg -R new incoming -r 4 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
19 19 # local incoming
20 20 hg -R new incoming test
21 21 hg -R new incoming -r 4 test
22 22
23 23 # test with --bundle
24 http_proxy= hg -R new incoming --bundle test.hg http://localhost:20059/
24 http_proxy= hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
25 25 hg -R new incoming --bundle test2.hg test
26 26
27 27 # test the resulting bundles
@@ -44,5 +44,5 b' done'
44 44 hg verify
45 45 cd ..
46 46 hg -R test-dev outgoing test
47 http_proxy= hg -R test-dev outgoing http://localhost:20059/
48 http_proxy= hg -R test-dev outgoing -r 11 http://localhost:20059/
47 http_proxy= hg -R test-dev outgoing http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
48 http_proxy= hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
@@ -4,7 +4,7 b' checking manifests'
4 4 crosschecking files in changesets and manifests
5 5 checking files
6 6 1 files, 9 changesets, 9 total revisions
7 comparing with http://localhost:20059/
7 comparing with http://localhost/
8 8 changeset: 0:9cb21d99fe27
9 9 user: test
10 10 date: Mon Jan 12 13:46:40 1970 +0000
@@ -51,7 +51,7 b' user: test'
51 51 date: Mon Jan 12 13:46:40 1970 +0000
52 52 summary: 8
53 53
54 comparing with http://localhost:20059/
54 comparing with http://localhost/
55 55 changeset: 0:9cb21d99fe27
56 56 user: test
57 57 date: Mon Jan 12 13:46:40 1970 +0000
@@ -151,7 +151,7 b' user: test'
151 151 date: Mon Jan 12 13:46:40 1970 +0000
152 152 summary: 4
153 153
154 comparing with http://localhost:20059/
154 comparing with http://localhost/
155 155 changeset: 0:9cb21d99fe27
156 156 user: test
157 157 date: Mon Jan 12 13:46:40 1970 +0000
@@ -301,7 +301,7 b' user: test'
301 301 date: Mon Jan 12 13:46:40 1970 +0000
302 302 summary: 13
303 303
304 comparing with http://localhost:20059/
304 comparing with http://localhost/
305 305 searching for changes
306 306 changeset: 9:3741c3ad1096
307 307 user: test
@@ -329,7 +329,7 b' user: test'
329 329 date: Mon Jan 12 13:46:40 1970 +0000
330 330 summary: 13
331 331
332 comparing with http://localhost:20059/
332 comparing with http://localhost/
333 333 searching for changes
334 334 changeset: 9:3741c3ad1096
335 335 user: test
@@ -15,7 +15,7 b' from mercurial.hgweb.request import _wsg'
15 15 from mercurial.ui import ui
16 16 from mercurial import hg
17 17 from StringIO import StringIO
18 import sys
18 import os, sys
19 19
20 20 class FileLike(object):
21 21 def __init__(self, real):
@@ -58,7 +58,7 b' env = {'
58 58 'PATH_INFO': '',
59 59 'QUERY_STRING': '',
60 60 'SERVER_NAME': '127.0.0.1',
61 'SERVER_PORT': '20059',
61 'SERVER_PORT': os.environ['HGPORT'],
62 62 'SERVER_PROTOCOL': 'HTTP/1.0'
63 63 }
64 64
@@ -7,17 +7,17 b' hg init'
7 7 hg addremove
8 8 hg commit -m 1
9 9 hg verify
10 hg serve -p 20059 -d --pid-file=hg.pid
10 hg serve -p $HGPORT -d --pid-file=hg.pid
11 11 cat hg.pid >> $DAEMON_PIDS
12 12 cd ..
13 13
14 http_proxy= hg clone --pull http://localhost:20059/ copy
14 http_proxy= hg clone --pull http://localhost:$HGPORT/ copy | sed -e 's,:[0-9][0-9]*/,/,'
15 15 cd copy
16 16 hg verify
17 17 hg co
18 18 cat foo
19 19 hg manifest --debug
20 hg pull
20 hg pull | sed -e 's,:[0-9][0-9]*/,/,'
21 21
22 22 echo % issue 622
23 23 cd ..
@@ -18,7 +18,7 b' 1 files, 1 changesets, 1 total revisions'
18 18 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 19 foo
20 20 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
21 pulling from http://localhost:20059/
21 pulling from http://localhost/
22 22 searching for changes
23 23 no changes found
24 24 % issue 622
@@ -16,33 +16,33 b" hg ci -mb -d '0 0'"
16 16 cd ../test
17 17
18 18 echo % expect ssl error
19 hg serve -p 20059 -d --pid-file=hg.pid
19 hg serve -p $HGPORT -d --pid-file=hg.pid
20 20 cat hg.pid >> $DAEMON_PIDS
21 hg --cwd ../test2 push http://localhost:20059/
21 hg --cwd ../test2 push http://localhost:$HGPORT/
22 22 kill `cat hg.pid`
23 23
24 24 echo % expect authorization error
25 25 echo '[web]' > .hg/hgrc
26 26 echo 'push_ssl = false' >> .hg/hgrc
27 hg serve -p 20059 -d --pid-file=hg.pid
27 hg serve -p $HGPORT -d --pid-file=hg.pid
28 28 cat hg.pid >> $DAEMON_PIDS
29 hg --cwd ../test2 push http://localhost:20059/
29 hg --cwd ../test2 push http://localhost:$HGPORT/
30 30 kill `cat hg.pid`
31 31
32 32 echo % expect authorization error: must have authorized user
33 33 echo 'allow_push = unperson' >> .hg/hgrc
34 hg serve -p 20059 -d --pid-file=hg.pid
34 hg serve -p $HGPORT -d --pid-file=hg.pid
35 35 cat hg.pid >> $DAEMON_PIDS
36 hg --cwd ../test2 push http://localhost:20059/
36 hg --cwd ../test2 push http://localhost:$HGPORT/
37 37 kill `cat hg.pid`
38 38
39 39 echo % expect success
40 40 echo 'allow_push = *' >> .hg/hgrc
41 41 echo '[hooks]' >> .hg/hgrc
42 42 echo 'changegroup = python ../printenv.py changegroup 0 ../urls' >> .hg/hgrc
43 hg serve -p 20059 -d --pid-file=hg.pid
43 hg serve -p $HGPORT -d --pid-file=hg.pid
44 44 cat hg.pid >> $DAEMON_PIDS
45 hg --cwd ../test2 push http://localhost:20059/
45 hg --cwd ../test2 push http://localhost:$HGPORT/
46 46 kill `cat hg.pid`
47 47 hg rollback
48 48
@@ -52,14 +52,14 b' echo % expect authorization error: all u'
52 52 echo '[web]' > .hg/hgrc
53 53 echo 'push_ssl = false' >> .hg/hgrc
54 54 echo 'deny_push = *' >> .hg/hgrc
55 hg serve -p 20059 -d --pid-file=hg.pid
55 hg serve -p $HGPORT -d --pid-file=hg.pid
56 56 cat hg.pid >> $DAEMON_PIDS
57 hg --cwd ../test2 push http://localhost:20059/
57 hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
58 58 kill `cat hg.pid`
59 59
60 60 echo % expect authorization error: some users denied, users must be authenticated
61 61 echo 'deny_push = unperson' >> .hg/hgrc
62 hg serve -p 20059 -d --pid-file=hg.pid
62 hg serve -p $HGPORT -d --pid-file=hg.pid
63 63 cat hg.pid >> $DAEMON_PIDS
64 hg --cwd ../test2 push http://localhost:20059/
64 hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
65 65 kill `cat hg.pid`
@@ -1,19 +1,19 b''
1 1 adding a
2 2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 3 % expect ssl error
4 pushing to http://localhost:20059/
4 pushing to http://localhost:23451/
5 5 searching for changes
6 6 ssl required
7 7 % expect authorization error
8 pushing to http://localhost:20059/
8 pushing to http://localhost:23451/
9 9 searching for changes
10 10 push not authorized
11 11 % expect authorization error: must have authorized user
12 pushing to http://localhost:20059/
12 pushing to http://localhost:23451/
13 13 searching for changes
14 14 push not authorized
15 15 % expect success
16 pushing to http://localhost:20059/
16 pushing to http://localhost:23451/
17 17 searching for changes
18 18 adding changesets
19 19 adding manifests
@@ -22,10 +22,10 b' added 1 changesets with 1 changes to 1 f'
22 22 rolling back last transaction
23 23 changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http
24 24 % expect authorization error: all users denied
25 pushing to http://localhost:20059/
25 pushing to http://localhost/
26 26 searching for changes
27 27 push not authorized
28 28 % expect authorization error: some users denied, users must be authenticated
29 pushing to http://localhost:20059/
29 pushing to http://localhost/
30 30 searching for changes
31 31 push not authorized
@@ -7,12 +7,12 b" echo '[web]' > .hg/hgrc"
7 7 echo 'accesslog = access.log' >> .hg/hgrc
8 8
9 9 echo % Without -v
10 hg serve -a localhost -p 20063 -d --pid-file=hg.pid
10 hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid
11 11 cat hg.pid >> "$DAEMON_PIDS"
12 12 if [ -f access.log ]; then
13 13 echo 'access log created - .hg/hgrc respected'
14 14 fi
15 15
16 16 echo % With -v
17 hg serve -a localhost -p 20064 -d --pid-file=hg.pid -v
17 hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v | sed -e 's,:[0-9][0-9]*/,/,'
18 18 cat hg.pid >> "$DAEMON_PIDS"
@@ -1,4 +1,4 b''
1 1 % Without -v
2 2 access log created - .hg/hgrc respected
3 3 % With -v
4 listening at http://localhost:20064/
4 listening at http://localhost/
@@ -2,18 +2,18 b''
2 2
3 3 cp "$TESTDIR"/printenv.py .
4 4
5 http_proxy= hg clone static-http://localhost:20059/ copy
5 http_proxy= hg clone static-http://localhost:$HGPORT/ copy
6 6 echo $?
7 7 test -d copy || echo copy: No such file or directory
8 8
9 9 # This server doesn't do range requests so it's basically only good for
10 10 # one pull
11 11 cat > dumb.py <<EOF
12 import BaseHTTPServer, SimpleHTTPServer, signal
12 import BaseHTTPServer, SimpleHTTPServer, os, signal
13 13
14 14 def run(server_class=BaseHTTPServer.HTTPServer,
15 15 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
16 server_address = ('localhost', 20059)
16 server_address = ('localhost', int(os.environ['HGPORT']))
17 17 httpd = server_class(server_address, handler_class)
18 18 httpd.serve_forever()
19 19
@@ -34,7 +34,7 b' hg tip'
34 34
35 35 cd ..
36 36
37 http_proxy= hg clone static-http://localhost:20059/remote local
37 http_proxy= hg clone static-http://localhost:$HGPORT/remote local | sed -e 's,:[0-9][0-9]*/,/,'
38 38
39 39 cd local
40 40 hg verify
@@ -47,7 +47,7 b" hg commit -A -mtest2 -d '100000000 0'"
47 47 cd ../local
48 48 echo '[hooks]' >> .hg/hgrc
49 49 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
50 http_proxy= hg pull
50 http_proxy= hg pull | sed -e 's,:[0-9][0-9]*/,/,'
51 51
52 52 echo '% test with "/" URI (issue 747)'
53 53 cd ..
@@ -56,11 +56,11 b' echo a > a'
56 56 hg add a
57 57 hg ci -ma
58 58
59 http_proxy= hg clone static-http://localhost:20059/ local2
59 http_proxy= hg clone static-http://localhost:$HGPORT/ local2 | sed -e 's,:[0-9][0-9]*/,/,'
60 60
61 61 cd local2
62 62 hg verify
63 63 cat a
64 hg paths
64 hg paths | sed -e 's,:[0-9][0-9]*/,/,'
65 65
66 66 kill $!
@@ -20,8 +20,8 b' checking files'
20 20 1 files, 1 changesets, 1 total revisions
21 21 foo
22 22 adding quux
23 changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=static-http://localhost:20059/remote
24 pulling from static-http://localhost:20059/remote
23 changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=static-http://localhost/remote
24 pulling from static-http://localhost/remote
25 25 searching for changes
26 26 adding changesets
27 27 adding manifests
@@ -41,4 +41,4 b' crosschecking files in changesets and ma'
41 41 checking files
42 42 1 files, 1 changesets, 1 total revisions
43 43 a
44 default = static-http://localhost:20059/
44 default = static-http://localhost/
@@ -56,12 +56,12 b' cd ../pullback'
56 56 hg transplant -s ../remote -a -b tip
57 57
58 58 echo '% remote transplant with pull'
59 hg -R ../t serve -p 20062 -d --pid-file=../t.pid
59 hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
60 60 cat ../t.pid >> $DAEMON_PIDS
61 61
62 62 hg clone -r 0 ../t ../rp
63 63 cd ../rp
64 hg transplant -s http://localhost:20062/ 2 4
64 hg transplant -s http://localhost:$HGPORT/ 2 4
65 65 hg log --template '{rev} {parents} {desc}\n'
66 66
67 67 echo '% transplant --continue'
@@ -10,9 +10,9 b' care about things like that.'
10 10 ENDSOME
11 11 hg add sometext.txt
12 12 hg commit -d "1 0" -m "Just some text"
13 hg serve -p 20059 -A access.log -E error.log -d --pid-file=hg.pid
13 hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid
14 14 cat hg.pid >> $DAEMON_PIDS
15 ("$TESTDIR/get-with-headers.py" localhost:20059 '/?f=f165dc289438;file=sometext.txt;style=raw' content-type content-length content-disposition) >getoutput.txt &
15 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=f165dc289438;file=sometext.txt;style=raw' content-type content-length content-disposition) >getoutput.txt &
16 16
17 17 sleep 5
18 18 kill `cat hg.pid`
General Comments 0
You need to be logged in to leave comments. Login now