[PATCH] selftest: Fix timestamps on FreeBSD 11

Volker Lendecke vl at samba.org
Wed Nov 23 13:07:33 UTC 2016


Hi!

Review appreciated!

Thanks, Volker
-------------- next part --------------
>From 899974db282be8db505430a35e0167ec6ca78af4 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 23 Nov 2016 13:54:39 +0100
Subject: [PATCH] selftest: Fix timestamps on FreeBSD 11

FreeBSD's date does not print the %, and \? does not catch that

Tested this manually:

$ echo 'time: 2016-11-23 12:52:19.123456Z'| sed 's/\..*NZ$/.000000Z/'
time: 2016-11-23 12:52:19.123456Z
$ echo 'time: 2016-11-23 12:52:19.%6NZ'| sed 's/\..*NZ$/.000000Z/'
time: 2016-11-23 12:52:19.000000Z
$ echo 'time: 2016-11-23 12:52:19.6NZ'| sed 's/\..*NZ$/.000000Z/'
time: 2016-11-23 12:52:19.000000Z
$

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 testprogs/blackbox/subunit.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh
index 70fe2d7..0791d77 100755
--- a/testprogs/blackbox/subunit.sh
+++ b/testprogs/blackbox/subunit.sh
@@ -22,7 +22,7 @@ timestamp() {
   # mark the start time. With Gnu date, you get nanoseconds from %N
   # (here truncated to microseconds with %6N), but not on BSDs,
   # Solaris, etc, which will apparently leave either %N or N at the end.
-  date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/%\?NZ$/000000Z/'
+  date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/\..*NZ$/.000000Z/'
 }
 
 subunit_start_test () {
-- 
2.1.4



More information about the samba-technical mailing list