##// END OF EJS Templates
Don't use sed -r; instead use old-style regexp...
Martijn Pieters -
r8245:0eade101 default
parent child Browse files
Show More
@@ -1,106 +1,106
1 #!/bin/sh
1 #!/bin/sh
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
3 # collection, different forms of 404s and the subdirectory support.
3 # collection, different forms of 404s and the subdirectory support.
4
4
5 mkdir webdir
5 mkdir webdir
6 cd webdir
6 cd webdir
7
7
8 hg init a
8 hg init a
9 echo a > a/a
9 echo a > a/a
10 hg --cwd a ci -Ama -d'1 0'
10 hg --cwd a ci -Ama -d'1 0'
11 # create a mercurial queue repository
11 # create a mercurial queue repository
12 hg --cwd a qinit --config extensions.hgext.mq= -c
12 hg --cwd a qinit --config extensions.hgext.mq= -c
13
13
14 hg init b
14 hg init b
15 echo b > b/b
15 echo b > b/b
16 hg --cwd b ci -Amb -d'2 0'
16 hg --cwd b ci -Amb -d'2 0'
17
17
18 # create a nested repository
18 # create a nested repository
19 cd b
19 cd b
20 hg init d
20 hg init d
21 echo d > d/d
21 echo d > d/d
22 hg --cwd d ci -Amd -d'3 0'
22 hg --cwd d ci -Amd -d'3 0'
23 cd ..
23 cd ..
24
24
25 hg init c
25 hg init c
26 echo c > c/c
26 echo c > c/c
27 hg --cwd c ci -Amc -d'3 0'
27 hg --cwd c ci -Amc -d'3 0'
28
28
29 root=`pwd`
29 root=`pwd`
30 cd ..
30 cd ..
31
31
32 cat > paths.conf <<EOF
32 cat > paths.conf <<EOF
33 [paths]
33 [paths]
34 a=$root/a
34 a=$root/a
35 b=$root/b
35 b=$root/b
36 EOF
36 EOF
37
37
38 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
38 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
39 -A access-paths.log -E error-paths-1.log
39 -A access-paths.log -E error-paths-1.log
40 cat hg.pid >> $DAEMON_PIDS
40 cat hg.pid >> $DAEMON_PIDS
41
41
42 echo % should give a 404 - file does not exist
42 echo % should give a 404 - file does not exist
43 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
43 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
44
44
45 echo % should succeed
45 echo % should succeed
46 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
46 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
47 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
47 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
48 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
48 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
49
49
50 echo % should give a 404 - repo is not published
50 echo % should give a 404 - repo is not published
51 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
51 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
52
52
53 cat > paths.conf <<EOF
53 cat > paths.conf <<EOF
54 [paths]
54 [paths]
55 t/a/=$root/a
55 t/a/=$root/a
56 b=$root/b
56 b=$root/b
57 coll=$root/*
57 coll=$root/*
58 rcoll=$root/**
58 rcoll=$root/**
59 EOF
59 EOF
60
60
61 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
61 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
62 -A access-paths.log -E error-paths-2.log
62 -A access-paths.log -E error-paths-2.log
63 cat hg.pid >> $DAEMON_PIDS
63 cat hg.pid >> $DAEMON_PIDS
64
64
65 echo % should succeed, slashy names
65 echo % should succeed, slashy names
66 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
66 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
67 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' \
67 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' \
68 | sed -r "s/[0-9]+ seconds? ago/seconds ago/"
68 | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/"
69 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
69 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
70 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
70 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
71 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' \
71 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' \
72 | sed -r "s/[0-9]+ seconds? ago/seconds ago/"
72 | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/"
73 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
73 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
74 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
74 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
75 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
75 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
76 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
76 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
77 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
77 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
78 # Test [paths] '*' extension
78 # Test [paths] '*' extension
79 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw'
79 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw'
80 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw'
80 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw'
81 #test [paths] '**' extension
81 #test [paths] '**' extension
82 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw'
82 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw'
83 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw'
83 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw'
84
84
85
85
86 cat > collections.conf <<EOF
86 cat > collections.conf <<EOF
87 [collections]
87 [collections]
88 $root=$root
88 $root=$root
89 EOF
89 EOF
90
90
91 hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \
91 hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \
92 -A access-collections.log -E error-collections.log
92 -A access-collections.log -E error-collections.log
93 cat hg.pid >> $DAEMON_PIDS
93 cat hg.pid >> $DAEMON_PIDS
94
94
95 echo % collections: should succeed
95 echo % collections: should succeed
96 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
96 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
97 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
97 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
98 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
98 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
99 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
99 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
100
100
101 echo % paths errors 1
101 echo % paths errors 1
102 cat error-paths-1.log
102 cat error-paths-1.log
103 echo % paths errors 2
103 echo % paths errors 2
104 cat error-paths-2.log
104 cat error-paths-2.log
105 echo % collections errors
105 echo % collections errors
106 cat error-collections.log
106 cat error-collections.log
General Comments 0
You need to be logged in to leave comments. Login now