##// 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 required_tools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
25 required_tools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
26
26
27 parser = optparse.OptionParser("%prog [options] [tests]")
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 parser.add_option("-C", "--annotate", action="store_true",
28 parser.add_option("-C", "--annotate", action="store_true",
37 help="output files annotated with coverage")
29 help="output files annotated with coverage")
38 parser.add_option("-r", "--retest", action="store_true",
30 parser.add_option("--child", type="int",
39 help="retest failed tests")
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 parser.add_option("-f", "--first", action="store_true",
34 parser.add_option("-f", "--first", action="store_true",
41 help="exit on the first test failure")
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 parser.add_option("-R", "--restart", action="store_true",
40 parser.add_option("-R", "--restart", action="store_true",
43 help="restart at last error")
41 help="restart at last error")
44 parser.add_option("-i", "--interactive", action="store_true",
42 parser.add_option("-p", "--port", type="int",
45 help="prompt to accept changed output")
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 (options, args) = parser.parse_args()
56 (options, args) = parser.parse_args()
49 verbose = options.verbose
57 verbose = options.verbose
50 coverage = options.cover or options.cover_stdlib or options.annotate
58 coverage = options.cover or options.cover_stdlib or options.annotate
51 python = sys.executable
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 def vlog(*msg):
68 def vlog(*msg):
54 if verbose:
69 if verbose:
55 for m in msg:
70 for m in msg:
@@ -368,10 +383,10 b' def run_one(test):'
368 return None
383 return None
369 return ret == 0
384 return ret == 0
370
385
386 if not options.child:
387 os.umask(022)
371
388
372 os.umask(022)
389 check_required_tools()
373
374 check_required_tools()
375
390
376 # Reset some environment variables to well-known values so that
391 # Reset some environment variables to well-known values so that
377 # the tests produce repeatable output.
392 # the tests produce repeatable output.
@@ -380,28 +395,83 b" os.environ['TZ'] = 'GMT'"
380
395
381 TESTDIR = os.environ["TESTDIR"] = os.getcwd()
396 TESTDIR = os.environ["TESTDIR"] = os.getcwd()
382 HGTMP = os.environ["HGTMP"] = tempfile.mkdtemp("", "hgtests.")
397 HGTMP = os.environ["HGTMP"] = tempfile.mkdtemp("", "hgtests.")
383 DAEMON_PIDS = os.environ["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
398 DAEMON_PIDS = None
384 HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
399 HGRCPATH = None
385
400
386 os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
401 os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
387 os.environ["HGMERGE"] = ('python "%s" -L my -L other'
402 os.environ["HGMERGE"] = ('python "%s" -L my -L other'
388 % os.path.join(TESTDIR, os.path.pardir, 'contrib',
403 % os.path.join(TESTDIR, os.path.pardir,
389 'simplemerge'))
404 'contrib', 'simplemerge'))
390 os.environ["HGUSER"] = "test"
405 os.environ["HGUSER"] = "test"
391 os.environ["HGENCODING"] = "ascii"
406 os.environ["HGENCODING"] = "ascii"
392 os.environ["HGENCODINGMODE"] = "strict"
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)
412 if options.with_hg:
395 vlog("# Using HGTMP", HGTMP)
413 INST = options.with_hg
396
414 else:
397 INST = os.path.join(HGTMP, "install")
415 INST = os.path.join(HGTMP, "install")
398 BINDIR = os.path.join(INST, "bin")
416 BINDIR = os.path.join(INST, "bin")
399 PYTHONDIR = os.path.join(INST, "lib", "python")
417 PYTHONDIR = os.path.join(INST, "lib", "python")
400 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
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 try:
472 try:
404 install_hg()
473 if not options.with_hg:
474 install_hg()
405
475
406 if options.timeout > 0:
476 if options.timeout > 0:
407 try:
477 try:
@@ -416,18 +486,6 b' try:'
416 failed = 0
486 failed = 0
417 skipped = 0
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 if options.restart:
489 if options.restart:
432 orig = list(tests)
490 orig = list(tests)
433 while tests:
491 while tests:
@@ -458,15 +516,41 b' try:'
458 break
516 break
459 tested += 1
517 tested += 1
460
518
461 print "\n# Ran %d tests, %d skipped, %d failed." % (tested, skipped,
519 if options.child:
462 failed)
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 if coverage:
527 if coverage:
464 output_coverage()
528 output_coverage()
465 except KeyboardInterrupt:
529 except KeyboardInterrupt:
466 failed = True
530 failed = True
467 print "\ninterrupted!"
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 finally:
555 finally:
469 cleanup_exit()
556 cleanup_exit()
470
471 if failed:
472 sys.exit(1)
@@ -13,16 +13,16 b" hg commit -Am 3 -d '1000000000 0'"
13 echo "[web]" >> .hg/hgrc
13 echo "[web]" >> .hg/hgrc
14 echo "name = test-archive" >> .hg/hgrc
14 echo "name = test-archive" >> .hg/hgrc
15 echo "allow_archive = gz bz2, zip" >> .hg/hgrc
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 cat hg.pid >> $DAEMON_PIDS
17 cat hg.pid >> $DAEMON_PIDS
18
18
19 TIP=`hg id -v | cut -f1 -d' '`
19 TIP=`hg id -v | cut -f1 -d' '`
20 QTIP=`hg id -q`
20 QTIP=`hg id -q`
21 cat > getarchive.py <<EOF
21 cat > getarchive.py <<EOF
22 import sys, urllib2
22 import os, sys, urllib2
23 node, archive = sys.argv[1:]
23 node, archive = sys.argv[1:]
24 f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s'
24 f = urllib2.urlopen('http://127.0.0.1:%s/?cmd=archive;node=%s;type=%s'
25 % (node, archive))
25 % (os.environ['HGPORT'], node, archive))
26 sys.stdout.write(f.read())
26 sys.stdout.write(f.read())
27 EOF
27 EOF
28 http_proxy= python getarchive.py "$TIP" gz | gunzip | tar tf - | sed "s/$QTIP/TIP/"
28 http_proxy= python getarchive.py "$TIP" gz | gunzip | tar tf - | sed "s/$QTIP/TIP/"
@@ -1,15 +1,15 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg clone http://localhost:20059/ copy
3 hg clone http://localhost:$HGPORT/ copy
4 echo $?
4 echo $?
5 test -d copy || echo copy: No such file or directory
5 test -d copy || echo copy: No such file or directory
6
6
7 cat > dumb.py <<EOF
7 cat > dumb.py <<EOF
8 import BaseHTTPServer, SimpleHTTPServer, signal
8 import BaseHTTPServer, SimpleHTTPServer, os, signal
9
9
10 def run(server_class=BaseHTTPServer.HTTPServer,
10 def run(server_class=BaseHTTPServer.HTTPServer,
11 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
11 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
12 server_address = ('localhost', 20059)
12 server_address = ('localhost', int(os.environ['HGPORT']))
13 httpd = server_class(server_address, handler_class)
13 httpd = server_class(server_address, handler_class)
14 httpd.serve_forever()
14 httpd.serve_forever()
15
15
@@ -23,7 +23,7 b' echo $! >> $DAEMON_PIDS'
23 # give the server some time to start running
23 # give the server some time to start running
24 sleep 1
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 sed -e 's/404.*/404/' -e 's/Date:.*/Date:/'
27 sed -e 's/404.*/404/' -e 's/Date:.*/Date:/'
28 echo $?
28 echo $?
29
29
@@ -6,8 +6,8 b' mkdir da'
6 echo foo > da/foo
6 echo foo > da/foo
7 echo foo > foo
7 echo foo > foo
8 hg ci -Ambase -d '0 0'
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 echo % manifest
10 echo % manifest
11 ("$TESTDIR/get-with-headers.py" localhost:20060 '/file/tip/?style=raw')
11 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw')
12 ("$TESTDIR/get-with-headers.py" localhost:20060 '/file/tip/da?style=raw')
12 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw')
13 kill `cat hg.pid`
13 kill `cat hg.pid`
@@ -6,23 +6,23 b' hg init test'
6 cd test
6 cd test
7 echo foo>foo
7 echo foo>foo
8 hg commit -A -d '0 0' -m 1
8 hg commit -A -d '0 0' -m 1
9 hg --config server.uncompressed=True serve -p 20059 -d --pid-file=../hg1.pid
9 hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=../hg1.pid
10 hg serve -p 20060 -d --pid-file=../hg2.pid
10 hg serve -p $HGPORT1 -d --pid-file=../hg2.pid
11 # Test server address cannot be reused
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 cd ..
13 cd ..
14 cat hg1.pid hg2.pid >> $DAEMON_PIDS
14 cat hg1.pid hg2.pid >> $DAEMON_PIDS
15
15
16 echo % clone via stream
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 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
18 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
19 hg verify -R copy
19 hg verify -R copy
20
20
21 echo % try to clone via stream, should use pull instead
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 echo % clone via pull
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 hg verify -R copy-pull
26 hg verify -R copy-pull
27
27
28 cd test
28 cd test
@@ -34,5 +34,5 b' echo % pull'
34 cd copy-pull
34 cd copy-pull
35 echo '[hooks]' >> .hg/hgrc
35 echo '[hooks]' >> .hg/hgrc
36 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
36 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
37 hg pull
37 hg pull | sed -e 's,:[0-9][0-9]*/,/,'
38 cd ..
38 cd ..
@@ -49,13 +49,13 b' hg debugindex .hg/store/data/fred.i'
49 hg debugindex .hg/store/00manifest.i
49 hg debugindex .hg/store/00manifest.i
50 hg verify
50 hg verify
51 echo "# Starting server"
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 cd ..
53 cd ..
54 cat hg1.pid >> $DAEMON_PIDS
54 cat hg1.pid >> $DAEMON_PIDS
55
55
56 echo "# clone remote via stream"
56 echo "# clone remote via stream"
57 for i in 0 1 2 3 4 5 6 7 8; do
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 if cd test-"$i"; then
59 if cd test-"$i"; then
60 hg verify
60 hg verify
61 cd ..
61 cd ..
@@ -66,13 +66,13 b' hg pull ../test-7'
66 hg verify
66 hg verify
67 cd ..
67 cd ..
68 cd test-1
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 hg verify
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 cd ..
72 cd ..
73 cd test-2
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 hg verify
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 hg verify
77 hg verify
78 cd ..
78 cd ..
@@ -138,7 +138,7 b' checking manifests'
138 crosschecking files in changesets and manifests
138 crosschecking files in changesets and manifests
139 checking files
139 checking files
140 4 files, 9 changesets, 7 total revisions
140 4 files, 9 changesets, 7 total revisions
141 pulling from http://localhost:20061/
141 pulling from http://localhost/
142 searching for changes
142 searching for changes
143 adding changesets
143 adding changesets
144 adding manifests
144 adding manifests
@@ -150,14 +150,14 b' checking manifests'
150 crosschecking files in changesets and manifests
150 crosschecking files in changesets and manifests
151 checking files
151 checking files
152 1 files, 3 changesets, 2 total revisions
152 1 files, 3 changesets, 2 total revisions
153 pulling from http://localhost:20061/
153 pulling from http://localhost/
154 searching for changes
154 searching for changes
155 adding changesets
155 adding changesets
156 adding manifests
156 adding manifests
157 adding file changes
157 adding file changes
158 added 6 changesets with 5 changes to 4 files
158 added 6 changesets with 5 changes to 4 files
159 (run 'hg update' to get a working copy)
159 (run 'hg update' to get a working copy)
160 pulling from http://localhost:20061/
160 pulling from http://localhost/
161 searching for changes
161 searching for changes
162 adding changesets
162 adding changesets
163 adding manifests
163 adding manifests
@@ -169,7 +169,7 b' checking manifests'
169 crosschecking files in changesets and manifests
169 crosschecking files in changesets and manifests
170 checking files
170 checking files
171 1 files, 5 changesets, 3 total revisions
171 1 files, 5 changesets, 3 total revisions
172 pulling from http://localhost:20061/
172 pulling from http://localhost/
173 searching for changes
173 searching for changes
174 adding changesets
174 adding changesets
175 adding manifests
175 adding manifests
@@ -4,38 +4,38 b' hg init a'
4 cd a
4 cd a
5 echo a > a
5 echo a > a
6 hg ci -Ama -d '1123456789 0'
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 cat hg.pid >> $DAEMON_PIDS
8 cat hg.pid >> $DAEMON_PIDS
9
9
10 cd ..
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 echo $! > proxy.pid)
12 echo $! > proxy.pid)
13 cat proxy.pid >> $DAEMON_PIDS
13 cat proxy.pid >> $DAEMON_PIDS
14 sleep 2
14 sleep 2
15
15
16 echo %% url for proxy, stream
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 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
18 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
19 cd b
19 cd b
20 hg verify
20 hg verify
21 cd ..
21 cd ..
22
22
23 echo %% url for proxy, pull
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 cd b-pull
25 cd b-pull
26 hg verify
26 hg verify
27 cd ..
27 cd ..
28
28
29 echo %% host:port for proxy
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 echo %% proxy url with user name and password
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 echo %% url with user name and password
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 echo %% bad host:port for proxy
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 exit 0
41 exit 0
@@ -31,8 +31,8 b' checking files'
31 1 files, 1 changesets, 1 total revisions
31 1 files, 1 changesets, 1 total revisions
32 adding bar
32 adding bar
33 % pull
33 % pull
34 changegroup hook: HG_NODE=cfbd11a1fa315300a080c3de8fe36b0fc5820acf HG_SOURCE=pull HG_URL=http://localhost:20059/
34 changegroup hook: HG_NODE=cfbd11a1fa315300a080c3de8fe36b0fc5820acf HG_SOURCE=pull HG_URL=http://localhost/
35 pulling from http://localhost:20059/
35 pulling from http://localhost/
36 searching for changes
36 searching for changes
37 adding changesets
37 adding changesets
38 adding manifests
38 adding manifests
@@ -8,20 +8,20 b' for i in 0 1 2 3 4 5 6 7 8; do'
8 hg commit -A -m $i -d "1000000 0"
8 hg commit -A -m $i -d "1000000 0"
9 done
9 done
10 hg verify
10 hg verify
11 hg serve -p 20059 -d --pid-file=hg.pid
11 hg serve -p $HGPORT -d --pid-file=hg.pid
12 cat hg.pid >> $DAEMON_PIDS
12 cat hg.pid >> $DAEMON_PIDS
13 cd ..
13 cd ..
14
14
15 hg init new
15 hg init new
16 # http incoming
16 # http incoming
17 http_proxy= hg -R new incoming 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:20059/
18 http_proxy= hg -R new incoming -r 4 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
19 # local incoming
19 # local incoming
20 hg -R new incoming test
20 hg -R new incoming test
21 hg -R new incoming -r 4 test
21 hg -R new incoming -r 4 test
22
22
23 # test with --bundle
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 hg -R new incoming --bundle test2.hg test
25 hg -R new incoming --bundle test2.hg test
26
26
27 # test the resulting bundles
27 # test the resulting bundles
@@ -44,5 +44,5 b' done'
44 hg verify
44 hg verify
45 cd ..
45 cd ..
46 hg -R test-dev outgoing test
46 hg -R test-dev outgoing test
47 http_proxy= hg -R test-dev outgoing 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:20059/
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 crosschecking files in changesets and manifests
4 crosschecking files in changesets and manifests
5 checking files
5 checking files
6 1 files, 9 changesets, 9 total revisions
6 1 files, 9 changesets, 9 total revisions
7 comparing with http://localhost:20059/
7 comparing with http://localhost/
8 changeset: 0:9cb21d99fe27
8 changeset: 0:9cb21d99fe27
9 user: test
9 user: test
10 date: Mon Jan 12 13:46:40 1970 +0000
10 date: Mon Jan 12 13:46:40 1970 +0000
@@ -51,7 +51,7 b' user: test'
51 date: Mon Jan 12 13:46:40 1970 +0000
51 date: Mon Jan 12 13:46:40 1970 +0000
52 summary: 8
52 summary: 8
53
53
54 comparing with http://localhost:20059/
54 comparing with http://localhost/
55 changeset: 0:9cb21d99fe27
55 changeset: 0:9cb21d99fe27
56 user: test
56 user: test
57 date: Mon Jan 12 13:46:40 1970 +0000
57 date: Mon Jan 12 13:46:40 1970 +0000
@@ -151,7 +151,7 b' user: test'
151 date: Mon Jan 12 13:46:40 1970 +0000
151 date: Mon Jan 12 13:46:40 1970 +0000
152 summary: 4
152 summary: 4
153
153
154 comparing with http://localhost:20059/
154 comparing with http://localhost/
155 changeset: 0:9cb21d99fe27
155 changeset: 0:9cb21d99fe27
156 user: test
156 user: test
157 date: Mon Jan 12 13:46:40 1970 +0000
157 date: Mon Jan 12 13:46:40 1970 +0000
@@ -301,7 +301,7 b' user: test'
301 date: Mon Jan 12 13:46:40 1970 +0000
301 date: Mon Jan 12 13:46:40 1970 +0000
302 summary: 13
302 summary: 13
303
303
304 comparing with http://localhost:20059/
304 comparing with http://localhost/
305 searching for changes
305 searching for changes
306 changeset: 9:3741c3ad1096
306 changeset: 9:3741c3ad1096
307 user: test
307 user: test
@@ -329,7 +329,7 b' user: test'
329 date: Mon Jan 12 13:46:40 1970 +0000
329 date: Mon Jan 12 13:46:40 1970 +0000
330 summary: 13
330 summary: 13
331
331
332 comparing with http://localhost:20059/
332 comparing with http://localhost/
333 searching for changes
333 searching for changes
334 changeset: 9:3741c3ad1096
334 changeset: 9:3741c3ad1096
335 user: test
335 user: test
@@ -15,7 +15,7 b' from mercurial.hgweb.request import _wsg'
15 from mercurial.ui import ui
15 from mercurial.ui import ui
16 from mercurial import hg
16 from mercurial import hg
17 from StringIO import StringIO
17 from StringIO import StringIO
18 import sys
18 import os, sys
19
19
20 class FileLike(object):
20 class FileLike(object):
21 def __init__(self, real):
21 def __init__(self, real):
@@ -58,7 +58,7 b' env = {'
58 'PATH_INFO': '',
58 'PATH_INFO': '',
59 'QUERY_STRING': '',
59 'QUERY_STRING': '',
60 'SERVER_NAME': '127.0.0.1',
60 'SERVER_NAME': '127.0.0.1',
61 'SERVER_PORT': '20059',
61 'SERVER_PORT': os.environ['HGPORT'],
62 'SERVER_PROTOCOL': 'HTTP/1.0'
62 'SERVER_PROTOCOL': 'HTTP/1.0'
63 }
63 }
64
64
@@ -7,17 +7,17 b' hg init'
7 hg addremove
7 hg addremove
8 hg commit -m 1
8 hg commit -m 1
9 hg verify
9 hg verify
10 hg serve -p 20059 -d --pid-file=hg.pid
10 hg serve -p $HGPORT -d --pid-file=hg.pid
11 cat hg.pid >> $DAEMON_PIDS
11 cat hg.pid >> $DAEMON_PIDS
12 cd ..
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 cd copy
15 cd copy
16 hg verify
16 hg verify
17 hg co
17 hg co
18 cat foo
18 cat foo
19 hg manifest --debug
19 hg manifest --debug
20 hg pull
20 hg pull | sed -e 's,:[0-9][0-9]*/,/,'
21
21
22 echo % issue 622
22 echo % issue 622
23 cd ..
23 cd ..
@@ -18,7 +18,7 b' 1 files, 1 changesets, 1 total revisions'
18 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 foo
19 foo
20 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
20 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
21 pulling from http://localhost:20059/
21 pulling from http://localhost/
22 searching for changes
22 searching for changes
23 no changes found
23 no changes found
24 % issue 622
24 % issue 622
@@ -16,33 +16,33 b" hg ci -mb -d '0 0'"
16 cd ../test
16 cd ../test
17
17
18 echo % expect ssl error
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 cat hg.pid >> $DAEMON_PIDS
20 cat hg.pid >> $DAEMON_PIDS
21 hg --cwd ../test2 push http://localhost:20059/
21 hg --cwd ../test2 push http://localhost:$HGPORT/
22 kill `cat hg.pid`
22 kill `cat hg.pid`
23
23
24 echo % expect authorization error
24 echo % expect authorization error
25 echo '[web]' > .hg/hgrc
25 echo '[web]' > .hg/hgrc
26 echo 'push_ssl = false' >> .hg/hgrc
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 cat hg.pid >> $DAEMON_PIDS
28 cat hg.pid >> $DAEMON_PIDS
29 hg --cwd ../test2 push http://localhost:20059/
29 hg --cwd ../test2 push http://localhost:$HGPORT/
30 kill `cat hg.pid`
30 kill `cat hg.pid`
31
31
32 echo % expect authorization error: must have authorized user
32 echo % expect authorization error: must have authorized user
33 echo 'allow_push = unperson' >> .hg/hgrc
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 cat hg.pid >> $DAEMON_PIDS
35 cat hg.pid >> $DAEMON_PIDS
36 hg --cwd ../test2 push http://localhost:20059/
36 hg --cwd ../test2 push http://localhost:$HGPORT/
37 kill `cat hg.pid`
37 kill `cat hg.pid`
38
38
39 echo % expect success
39 echo % expect success
40 echo 'allow_push = *' >> .hg/hgrc
40 echo 'allow_push = *' >> .hg/hgrc
41 echo '[hooks]' >> .hg/hgrc
41 echo '[hooks]' >> .hg/hgrc
42 echo 'changegroup = python ../printenv.py changegroup 0 ../urls' >> .hg/hgrc
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 cat hg.pid >> $DAEMON_PIDS
44 cat hg.pid >> $DAEMON_PIDS
45 hg --cwd ../test2 push http://localhost:20059/
45 hg --cwd ../test2 push http://localhost:$HGPORT/
46 kill `cat hg.pid`
46 kill `cat hg.pid`
47 hg rollback
47 hg rollback
48
48
@@ -52,14 +52,14 b' echo % expect authorization error: all u'
52 echo '[web]' > .hg/hgrc
52 echo '[web]' > .hg/hgrc
53 echo 'push_ssl = false' >> .hg/hgrc
53 echo 'push_ssl = false' >> .hg/hgrc
54 echo 'deny_push = *' >> .hg/hgrc
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 cat hg.pid >> $DAEMON_PIDS
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 kill `cat hg.pid`
58 kill `cat hg.pid`
59
59
60 echo % expect authorization error: some users denied, users must be authenticated
60 echo % expect authorization error: some users denied, users must be authenticated
61 echo 'deny_push = unperson' >> .hg/hgrc
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 cat hg.pid >> $DAEMON_PIDS
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 kill `cat hg.pid`
65 kill `cat hg.pid`
@@ -1,19 +1,19 b''
1 adding a
1 adding a
2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 % expect ssl error
3 % expect ssl error
4 pushing to http://localhost:20059/
4 pushing to http://localhost:23451/
5 searching for changes
5 searching for changes
6 ssl required
6 ssl required
7 % expect authorization error
7 % expect authorization error
8 pushing to http://localhost:20059/
8 pushing to http://localhost:23451/
9 searching for changes
9 searching for changes
10 push not authorized
10 push not authorized
11 % expect authorization error: must have authorized user
11 % expect authorization error: must have authorized user
12 pushing to http://localhost:20059/
12 pushing to http://localhost:23451/
13 searching for changes
13 searching for changes
14 push not authorized
14 push not authorized
15 % expect success
15 % expect success
16 pushing to http://localhost:20059/
16 pushing to http://localhost:23451/
17 searching for changes
17 searching for changes
18 adding changesets
18 adding changesets
19 adding manifests
19 adding manifests
@@ -22,10 +22,10 b' added 1 changesets with 1 changes to 1 f'
22 rolling back last transaction
22 rolling back last transaction
23 changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http
23 changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http
24 % expect authorization error: all users denied
24 % expect authorization error: all users denied
25 pushing to http://localhost:20059/
25 pushing to http://localhost/
26 searching for changes
26 searching for changes
27 push not authorized
27 push not authorized
28 % expect authorization error: some users denied, users must be authenticated
28 % expect authorization error: some users denied, users must be authenticated
29 pushing to http://localhost:20059/
29 pushing to http://localhost/
30 searching for changes
30 searching for changes
31 push not authorized
31 push not authorized
@@ -7,12 +7,12 b" echo '[web]' > .hg/hgrc"
7 echo 'accesslog = access.log' >> .hg/hgrc
7 echo 'accesslog = access.log' >> .hg/hgrc
8
8
9 echo % Without -v
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 cat hg.pid >> "$DAEMON_PIDS"
11 cat hg.pid >> "$DAEMON_PIDS"
12 if [ -f access.log ]; then
12 if [ -f access.log ]; then
13 echo 'access log created - .hg/hgrc respected'
13 echo 'access log created - .hg/hgrc respected'
14 fi
14 fi
15
15
16 echo % With -v
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 cat hg.pid >> "$DAEMON_PIDS"
18 cat hg.pid >> "$DAEMON_PIDS"
@@ -1,4 +1,4 b''
1 % Without -v
1 % Without -v
2 access log created - .hg/hgrc respected
2 access log created - .hg/hgrc respected
3 % With -v
3 % With -v
4 listening at http://localhost:20064/
4 listening at http://localhost/
@@ -2,18 +2,18 b''
2
2
3 cp "$TESTDIR"/printenv.py .
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 echo $?
6 echo $?
7 test -d copy || echo copy: No such file or directory
7 test -d copy || echo copy: No such file or directory
8
8
9 # This server doesn't do range requests so it's basically only good for
9 # This server doesn't do range requests so it's basically only good for
10 # one pull
10 # one pull
11 cat > dumb.py <<EOF
11 cat > dumb.py <<EOF
12 import BaseHTTPServer, SimpleHTTPServer, signal
12 import BaseHTTPServer, SimpleHTTPServer, os, signal
13
13
14 def run(server_class=BaseHTTPServer.HTTPServer,
14 def run(server_class=BaseHTTPServer.HTTPServer,
15 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
15 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
16 server_address = ('localhost', 20059)
16 server_address = ('localhost', int(os.environ['HGPORT']))
17 httpd = server_class(server_address, handler_class)
17 httpd = server_class(server_address, handler_class)
18 httpd.serve_forever()
18 httpd.serve_forever()
19
19
@@ -34,7 +34,7 b' hg tip'
34
34
35 cd ..
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 cd local
39 cd local
40 hg verify
40 hg verify
@@ -47,7 +47,7 b" hg commit -A -mtest2 -d '100000000 0'"
47 cd ../local
47 cd ../local
48 echo '[hooks]' >> .hg/hgrc
48 echo '[hooks]' >> .hg/hgrc
49 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
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 echo '% test with "/" URI (issue 747)'
52 echo '% test with "/" URI (issue 747)'
53 cd ..
53 cd ..
@@ -56,11 +56,11 b' echo a > a'
56 hg add a
56 hg add a
57 hg ci -ma
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 cd local2
61 cd local2
62 hg verify
62 hg verify
63 cat a
63 cat a
64 hg paths
64 hg paths | sed -e 's,:[0-9][0-9]*/,/,'
65
65
66 kill $!
66 kill $!
@@ -20,8 +20,8 b' checking files'
20 1 files, 1 changesets, 1 total revisions
20 1 files, 1 changesets, 1 total revisions
21 foo
21 foo
22 adding quux
22 adding quux
23 changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=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:20059/remote
24 pulling from static-http://localhost/remote
25 searching for changes
25 searching for changes
26 adding changesets
26 adding changesets
27 adding manifests
27 adding manifests
@@ -41,4 +41,4 b' crosschecking files in changesets and ma'
41 checking files
41 checking files
42 1 files, 1 changesets, 1 total revisions
42 1 files, 1 changesets, 1 total revisions
43 a
43 a
44 default = static-http://localhost:20059/
44 default = static-http://localhost/
@@ -56,12 +56,12 b' cd ../pullback'
56 hg transplant -s ../remote -a -b tip
56 hg transplant -s ../remote -a -b tip
57
57
58 echo '% remote transplant with pull'
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 cat ../t.pid >> $DAEMON_PIDS
60 cat ../t.pid >> $DAEMON_PIDS
61
61
62 hg clone -r 0 ../t ../rp
62 hg clone -r 0 ../t ../rp
63 cd ../rp
63 cd ../rp
64 hg transplant -s http://localhost:20062/ 2 4
64 hg transplant -s http://localhost:$HGPORT/ 2 4
65 hg log --template '{rev} {parents} {desc}\n'
65 hg log --template '{rev} {parents} {desc}\n'
66
66
67 echo '% transplant --continue'
67 echo '% transplant --continue'
@@ -10,9 +10,9 b' care about things like that.'
10 ENDSOME
10 ENDSOME
11 hg add sometext.txt
11 hg add sometext.txt
12 hg commit -d "1 0" -m "Just some text"
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 cat hg.pid >> $DAEMON_PIDS
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 sleep 5
17 sleep 5
18 kill `cat hg.pid`
18 kill `cat hg.pid`
General Comments 0
You need to be logged in to leave comments. Login now