##// END OF EJS Templates
tests: eliminate shutdown race and sleeps in test-serve
Matt Mackall -
r16297:1791d766 stable
parent child Browse files
Show More
@@ -1,83 +1,82
1 1 $ "$TESTDIR/hghave" serve || exit 80
2 2
3 3 $ hgserve()
4 4 > {
5 5 > hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \
6 6 > | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
7 7 > -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
8 8 > -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
9 9 > cat hg.pid >> "$DAEMON_PIDS"
10 10 > echo % errors
11 11 > cat errors.log
12 > sleep 1
13 12 > if [ "$KILLQUIETLY" = "Y" ]; then
14 13 > kill `cat hg.pid` 2>/dev/null
15 14 > else
16 15 > kill `cat hg.pid`
17 16 > fi
18 > sleep 1
17 > while kill -0 `cat hg.pid` 2>/dev/null; do true; done
19 18 > }
20 19
21 20 $ hg init test
22 21 $ cd test
23 22 $ echo '[web]' > .hg/hgrc
24 23 $ echo 'accesslog = access.log' >> .hg/hgrc
25 24 $ echo "port = $HGPORT1" >> .hg/hgrc
26 25
27 26 Without -v
28 27
29 28 $ hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
30 29 $ cat hg.pid >> "$DAEMON_PIDS"
31 30 $ if [ -f access.log ]; then
32 31 $ echo 'access log created - .hg/hgrc respected'
33 32 access log created - .hg/hgrc respected
34 33 $ fi
35 34
36 35 errors
37 36
38 37 $ cat errors.log
39 38
40 39 With -v
41 40
42 41 $ hgserve
43 42 listening at http://localhost/ (bound to 127.0.0.1:HGPORT1)
44 43 % errors
45 44
46 45 With -v and -p HGPORT2
47 46
48 47 $ hgserve -p "$HGPORT2"
49 48 listening at http://localhost/ (bound to 127.0.0.1:HGPORT2)
50 49 % errors
51 50
52 51 With -v and -p daytime (should fail because low port)
53 52
54 53 $ KILLQUIETLY=Y
55 54 $ hgserve -p daytime
56 55 abort: cannot start server at 'localhost:13': Permission denied
57 56 abort: child process failed to start
58 57 % errors
59 58 $ KILLQUIETLY=N
60 59
61 60 With --prefix foo
62 61
63 62 $ hgserve --prefix foo
64 63 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
65 64 % errors
66 65
67 66 With --prefix /foo
68 67
69 68 $ hgserve --prefix /foo
70 69 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
71 70 % errors
72 71
73 72 With --prefix foo/
74 73
75 74 $ hgserve --prefix foo/
76 75 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
77 76 % errors
78 77
79 78 With --prefix /foo/
80 79
81 80 $ hgserve --prefix /foo/
82 81 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
83 82 % errors
General Comments 0
You need to be logged in to leave comments. Login now