[PATCH 2 of 3 STABLE] test-static-http: show all files accessed over HTTP

Yuya Nishihara yuya at tcha.org
Wed Oct 25 09:51:01 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1508934102 -32400
#      Wed Oct 25 21:21:42 2017 +0900
# Branch stable
# Node ID 6a3ea1e90c40e0d67602116f04b985efc135470a
# Parent  8fe892cbca35e4bc0922e9383b186f870e3489e3
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.

diff --git a/tests/dumbhttp.py b/tests/dumbhttp.py
--- a/tests/dumbhttp.py
+++ b/tests/dumbhttp.py
@@ -41,6 +41,7 @@ if __name__ == '__main__':
         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 @@ if __name__ == '__main__':
 
     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 @@ if __name__ == '__main__':
             '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:])
diff --git a/tests/test-static-http.t b/tests/test-static-http.t
--- a/tests/test-static-http.t
+++ b/tests/test-static-http.t
@@ -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 @@ Clone a specific tag works
   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


More information about the Mercurial-devel mailing list