Re: [PATCH] git-cvsimport: allow author-specific timezones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Rorvick <chris@xxxxxxxxxxx> writes:

> It occurred to me that the success of the unit test depends on the
> host platform's zoneinfo database.  I think this problem is inherent
> with this functionality.  Should the unit test attempt to detect
> support for the used timezones and short circuit if this fails?  Not
> sure exactly how I'd do this, but wondering if it's worth thinking
> about.

Yeah, that did indeed cross my mind.

You could say TZ=QST6QDT or something silly like that but that in
turn has to assume your tzset() is POSIX.1 compliant anyway.

We should at least protect the tests with prerequiste, perhaps like
this.

 t/t9604-cvsimport-timestamps.sh | 53 ++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 30 deletions(-)

diff --git i/t/t9604-cvsimport-timestamps.sh w/t/t9604-cvsimport-timestamps.sh
index 6af41b7..f7683da 100755
--- i/t/t9604-cvsimport-timestamps.sh
+++ w/t/t9604-cvsimport-timestamps.sh
@@ -3,9 +3,30 @@
 test_description='git cvsimport timestamps'
 . ./lib-cvs.sh
 
+# Can your Perl grok these TZ settings correctly?
+test_lazy_prereq TZNAME '
+	perl -e '\''
+		use POSIX qw(strftime);
+		while (<STDIN>) {
+			my ($zone, $time, $expect) = split(q/ /);
+			$ENV{TZ} = $zone;
+			if (strftime(q/%z/, localtime($time)) ne $expect) {
+				exit(1);
+			}
+		}
+		exit(0);
+	'\'' <<-\EOF
+	America/Chicago 1345174000 -0500
+	America/Chicago 1329622000 -0600
+	Australia/Sydney 1345174000 +1000
+	Australia/Sydney 1329622000 +1100
+	Asia/Shanghai 1329622000 +0800
+	EOF
+'
+
 setup_cvs_test_repository t9604
 
-test_expect_success 'check timestamps are UTC (TZ=America/Chicago)' '
+test_expect_success TZNAME 'check timestamps are UTC (TZ=America/Chicago)' '
 	TZ=America/Chicago git cvsimport -p"-x" -C module-1 module &&
 	git cvsimport -p"-x" -C module-1 module &&
 	(
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]