Patchwork [3,of,3] test-http-*: use sed instead of fixed-with cut for reading access.log

login
register
mail settings
Submitter Augie Fackler
Date July 15, 2016, 4:50 p.m.
Message ID <c076f1e1df98ee50d55f.1468601430@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/15885/
State Accepted
Headers show

Comments

Augie Fackler - July 15, 2016, 4:50 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1468600776 14400
#      Fri Jul 15 12:39:36 2016 -0400
# Node ID c076f1e1df98ee50d55fd0d1b3460ad189174fd0
# Parent  9c608109b64b2212fd1f53f0131d1c8d15ca887a
test-http-*: use sed instead of fixed-with cut for reading access.log

Some systems (like FreeBSD jails) use something other than 127.0.0.1
for localhost, and it's not safe to assume it'll always be the same
width. Using sed with a replacement like this sidesteps the problem.
Yuya Nishihara - July 17, 2016, 9:12 a.m.
On Fri, 15 Jul 2016 12:50:30 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1468600776 14400
> #      Fri Jul 15 12:39:36 2016 -0400
> # Node ID c076f1e1df98ee50d55fd0d1b3460ad189174fd0
> # Parent  9c608109b64b2212fd1f53f0131d1c8d15ca887a
> test-http-*: use sed instead of fixed-with cut for reading access.log

s/test-http-\*/test-http/ to silence test-check-commit.t.

Patch

diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t
--- a/tests/test-http-bundle1.t
+++ b/tests/test-http-bundle1.t
@@ -234,7 +234,7 @@  test http authentication
   remote: added 1 changesets with 1 changes to 1 files
   $ hg rollback -q
 
-  $ cut -c38- ../access.log
+  $ sed 's/.*] "/"/' < ../access.log
   "GET /?cmd=capabilities HTTP/1.1" 200 -
   "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
   "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
diff --git a/tests/test-http.t b/tests/test-http.t
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -225,7 +225,7 @@  test http authentication
   remote: added 1 changesets with 1 changes to 1 files
   $ hg rollback -q
 
-  $ cut -c38- ../access.log
+  $ sed 's/.*] "/"/' < ../access.log
   "GET /?cmd=capabilities HTTP/1.1" 200 -
   "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
   "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces