Commit Graph

7 Commits

Author SHA1 Message Date
Jun Wu
4a7b28d08b serve: assign hg serve ports dynamically in tests
Summary:
Previously `hg server` uses `HGPORT` that might be in use. This patch uses
`-p 0 --port-file ...` so `hg server` always gets assigned a free port.

The change was first made by the following Ruby script:

```
re = /^  \$ hg serve(.*) -p \$(HGPORT[12]?) (.*[^\\])$\n  \$/
Dir['*.t'].each do |path|
  old = File.read(path)
  new = old.lines.map do |l|
    next l if l[/\(glob\)/] or not l['$HGPORT'] or l[/^  [$>]/]
    "#{l.chomp} (glob)\n"
  end.join.gsub re, <<-'EOS'.chomp
  $ hg serve\1 -p 0 --port-file $TESTTMP/.port \3
  $ \2=`cat $TESTTMP/.port`
  $
  EOS
  File.write(path, new) if old != new
end
```

Then there are some manual changes:

run-tests.py: It now treats `$HGPORT` in output as glob pattern `*`, since
it does not know the assigned value in tests.

test-bookmarks-pushpull.t, test-https.t: Some `hg pull`s were changed to use
explicit paths instead of relying on `.hgrc` since the test restarts the
server and `.hg/hgrc` having an outdated URL.

test-schemes.t: The test writes `$HGPORT` to `.hgrc` before assigning it.
Changed the order so the correct `$HGPORT` is written.

test-patchbomb-tls.t: Changed `(?) (glob)` to `(glob) (?)`.

Reviewed By: DurhamG

Differential Revision: D6925398

fbshipit-source-id: d5c10476f43ce23f9e99618807580cf8ba92595c
2018-04-13 21:51:07 -07:00
Matt Mackall
b709208c37 tests: drop DAEMON_PIDS from killdaemons calls 2015-06-08 14:55:40 -05:00
Matt Mackall
3ad28905f6 tests: drop explicit $TESTDIR from executables
$TESTDIR is added to the path, so this is superfluous. Also,
inconsistent use of quotes means we might have broken on tests with
paths containing spaces.
2015-06-08 14:44:30 -05:00
Matt Mackall
11be5cc27c tests: replace exit 80 with #require 2014-08-06 11:43:59 -05:00
Patrick Mezard
a4c03168e1 tests: enable even more Windows server tests 2012-09-14 21:05:24 +02:00
Mads Kiilerich
8415df7277 tests: use 'hghave serve' to guard tests that requires serve daemon management 2011-11-07 03:24:53 +01:00
Peter Arrenbrecht
d542bac8c7 wireproto: add known([id]) function
known([Node]) -> [1/0]

Returns 1/0 for each node, indicating whether it's known by the server.
Needed for new discovery protocols introduced in later patches.
2011-03-22 09:22:21 +01:00