login
Header Space

 
 

[PATCH 2/4] t5000: tar portability fix

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: <git@...>
Date: Tuesday, May 13, 2008 - 4:45 am

The output of 'tar tv' varies from system to system. In
particular, the t5000 was expecting to parse the date from
something like:

  -rw-rw-r-- root/root         0 2008-05-13 04:27 file

but FreeBSD's tar produces this:

  -rw-rw-r--  0 root   root        0 May 13 04:27 file

Instead of relying on tar's output, let's just extract the
file using tar and stat the result using perl.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t5000-tar-tree.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index fa62b6a..9b0baac 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -67,10 +67,10 @@ test_expect_success \
 
 test_expect_success \
     'validate file modification time' \
-    'TZ=GMT $TAR tvf b.tar a/a |
-     awk \{print\ \$4,\ \(length\(\$5\)\<7\)\ ?\ \$5\":00\"\ :\ \$5\} \
-     >b.mtime &&
-     echo "2005-05-27 22:00:00" >expected.mtime &&
+    'mkdir extract &&
+     $TAR xf b.tar -C extract a/a &&
+     perl -e '\''print((stat("extract/a/a"))[9], "\n")'\'' >b.mtime &&
+     echo "1117231200" >expected.mtime &&
      diff expected.mtime b.mtime'
 
 test_expect_success \
-- 
1.5.5.1.296.gf618c

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/4] freebsd portability fixes, Jeff King, (Tue May 13, 4:43 am)
Re: [PATCH 0/4] freebsd portability fixes, Jeff King, (Tue May 13, 5:04 am)
Re: [PATCH 0/4] freebsd portability fixes, Alex Riesen, (Tue May 13, 4:39 pm)
Re: [PATCH 0/4] freebsd portability fixes, Alex Riesen, (Tue May 13, 4:44 pm)
Re: [PATCH 4/4] filter-branch: fix variable export logic, Junio C Hamano, (Wed May 14, 12:18 am)
Re: [PATCH 4/4] filter-branch: fix variable export logic, Paolo Bonzini, (Wed May 14, 5:33 am)
[PATCH 3/4] clone: bsd shell portability fix, Jeff King, (Tue May 13, 4:45 am)
[PATCH 2/4] t5000: tar portability fix, Jeff King, (Tue May 13, 4:45 am)
[PATCH 1/4] fix bsd shell negation, Jeff King, (Tue May 13, 4:44 am)
Re: [PATCH 1/4] fix bsd shell negation, Junio C Hamano, (Tue May 13, 10:27 pm)
Re: [PATCH 1/4] fix bsd shell negation, Jeff King, (Wed May 14, 12:01 am)
speck-geostationary