changeset 34925:8b95e420e248 stable

test-static-http: show all files accessed over HTTP This provides some confidence on files that should be loadable over HTTP. Hopefully it will prevent future bugs.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 25 Oct 2017 21:21:42 +0900
parents bfcd0d227972
children f7e4d6c20095
files tests/dumbhttp.py tests/test-static-http.t
diffstat 2 files changed, 66 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/dumbhttp.py	Wed Oct 25 21:20:01 2017 +0900
+++ b/tests/dumbhttp.py	Wed Oct 25 21:21:42 2017 +0900
@@ -41,6 +41,7 @@
         help='TCP port to listen on', metavar='PORT')
     parser.add_option('-H', '--host', dest='host', default='localhost',
         help='hostname or IP to listen on', metavar='HOST')
+    parser.add_option('--logfile', help='file name of access/error log')
     parser.add_option('--pid', dest='pid',
         help='file name where the PID of the server is stored')
     parser.add_option('-f', '--foreground', dest='foreground',
@@ -52,6 +53,9 @@
 
     signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
 
+    if options.foreground and options.logfile:
+        parser.error("options --logfile and --foreground are mutually "
+                     "exclusive")
     if options.foreground and options.pid:
         parser.error("options --pid and --foreground are mutually exclusive")
 
@@ -60,4 +64,5 @@
             'daemon_postexec': options.daemon_postexec}
     service = simplehttpservice(options.host, options.port)
     server.runservice(opts, initfn=service.init, runfn=service.run,
+                      logfile=options.logfile,
                       runargs=[sys.executable, __file__] + sys.argv[1:])
--- a/tests/test-static-http.t	Wed Oct 25 21:20:01 2017 +0900
+++ b/tests/test-static-http.t	Wed Oct 25 21:21:42 2017 +0900
@@ -9,7 +9,8 @@
 This server doesn't do range requests so it's basically only good for
 one pull
 
-  $ $PYTHON "$TESTDIR/dumbhttp.py" -p $HGPORT --pid dumb.pid
+  $ $PYTHON "$TESTDIR/dumbhttp.py" -p $HGPORT --pid dumb.pid \
+  > --logfile server.log
   $ cat dumb.pid >> $DAEMON_PIDS
   $ hg init remote
   $ cd remote
@@ -214,3 +215,62 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ killdaemons.py
+
+List of files accessed over HTTP:
+
+  $ cat server.log | sed -n -e 's|.*GET \(/[^ ]*\).*|\1|p' | sort -u
+  /.hg/bookmarks
+  /.hg/bookmarks.current
+  /.hg/cache/hgtagsfnodes1
+  /.hg/dirstate
+  /.hg/requires
+  /.hg/store/00changelog.i
+  /.hg/store/00manifest.i
+  /.hg/store/data/%7E2ehgsub.i
+  /.hg/store/data/%7E2ehgsubstate.i
+  /.hg/store/data/a.i
+  /notarepo/.hg/00changelog.i
+  /notarepo/.hg/requires
+  /remote-with-names/.hg/bookmarks
+  /remote-with-names/.hg/bookmarks.current
+  /remote-with-names/.hg/cache/branch2-served
+  /remote-with-names/.hg/cache/hgtagsfnodes1
+  /remote-with-names/.hg/cache/tags2-served
+  /remote-with-names/.hg/dirstate
+  /remote-with-names/.hg/localtags
+  /remote-with-names/.hg/requires
+  /remote-with-names/.hg/store/00changelog.i
+  /remote-with-names/.hg/store/00manifest.i
+  /remote-with-names/.hg/store/data/%7E2ehgtags.i
+  /remote-with-names/.hg/store/data/foo.i
+  /remote/.hg/bookmarks
+  /remote/.hg/bookmarks.current
+  /remote/.hg/cache/branch2-base
+  /remote/.hg/cache/branch2-immutable
+  /remote/.hg/cache/branch2-served
+  /remote/.hg/cache/hgtagsfnodes1
+  /remote/.hg/cache/rbc-names-v1
+  /remote/.hg/cache/tags2-served
+  /remote/.hg/dirstate
+  /remote/.hg/localtags
+  /remote/.hg/requires
+  /remote/.hg/store/00changelog.i
+  /remote/.hg/store/00manifest.i
+  /remote/.hg/store/data/%7E2edotfile%20with%20spaces.i
+  /remote/.hg/store/data/%7E2ehgtags.i
+  /remote/.hg/store/data/bar.i
+  /remote/.hg/store/data/quux.i
+  /remotempty/.hg/bookmarks
+  /remotempty/.hg/bookmarks.current
+  /remotempty/.hg/requires
+  /remotempty/.hg/store/00changelog.i
+  /remotempty/.hg/store/00manifest.i
+  /sub/.hg/bookmarks
+  /sub/.hg/bookmarks.current
+  /sub/.hg/cache/hgtagsfnodes1
+  /sub/.hg/dirstate
+  /sub/.hg/requires
+  /sub/.hg/store/00changelog.i
+  /sub/.hg/store/00manifest.i
+  /sub/.hg/store/data/%7E2ehgtags.i
+  /sub/.hg/store/data/test.i