t0006 & t5000: skip "far in the future" test when time_t is too limited
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 20 Apr 2017 20:58:21 +0000 (22:58 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Apr 2017 05:07:15 +0000 (22:07 -0700)
Git's source code refers to timestamps as unsigned long, which is
ill-defined, as there is no guarantee about the number of bits that
data type has.

In preparation of switching to another data type that is large enough
to hold "far in the future" dates, we need to prepare the t0006-date.sh
script for the case where we *still* cannot format those dates if the
system library uses 32-bit time_t.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-date.c
t/t0006-date.sh
t/t5000-tar-tree.sh
t/test-lib.sh
index 4727bea255c10bf56be0a65d0e432e06252b27b0..ac7c66c733b5294249873e40a4491cb4ce1e4306 100644 (file)
@@ -5,7 +5,8 @@ static const char *usage_msg = "\n"
 "  test-date show:<format> [time_t]...\n"
 "  test-date parse [date]...\n"
 "  test-date approxidate [date]...\n"
-"  test-date is64bit\n";
+"  test-date is64bit\n"
+"  test-date time_t-is64bit\n";
 
 static void show_relative_dates(const char **argv, struct timeval *now)
 {
@@ -96,6 +97,8 @@ int cmd_main(int argc, const char **argv)
                parse_approxidate(argv+1, &now);
        else if (!strcmp(*argv, "is64bit"))
                return sizeof(unsigned long) == 8 ? 0 : 1;
+       else if (!strcmp(*argv, "time_t-is64bit"))
+               return sizeof(time_t) == 8 ? 0 : 1;
        else
                usage(usage_msg);
        return 0;
index 9539b425ffbfc3f84b56e6b40944c108092ad608..42d4ea61ef531d8c495c5c2216d434982f1c6182 100755 (executable)
@@ -53,8 +53,8 @@ check_show unix-local "$TIME" '1466000000'
 
 # arbitrary time absurdly far in the future
 FUTURE="5758122296 -0400"
-check_show iso       "$FUTURE" "2152-06-19 18:24:56 -0400" TIME_IS_64BIT
-check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT
+check_show iso       "$FUTURE" "2152-06-19 18:24:56 -0400" TIME_IS_64BIT,TIME_T_IS_64BIT
+check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT,TIME_T_IS_64BIT
 
 check_parse() {
        echo "$1 -> $2" >expect
index 997aa9dea28541eda6bc9f27296ac9fea9fc0a95..fe2d4f15a73f082c516a03b1877c4cf82982138a 100755 (executable)
@@ -402,7 +402,7 @@ test_expect_success TIME_IS_64BIT 'generate tar with future mtime' '
        git archive HEAD >future.tar
 '
 
-test_expect_success TAR_HUGE,TIME_IS_64BIT 'system tar can read our future mtime' '
+test_expect_success TAR_HUGE,TIME_IS_64BIT,TIME_T_IS_64BIT 'system tar can read our future mtime' '
        echo 4147 >expect &&
        tar_info future.tar | cut -d" " -f2 >actual &&
        test_cmp expect actual
index beee1d847ff9084ff5b8c686548667340f480c51..8d25cb7c18343232eee39b54b55e890b682af2d9 100644 (file)
@@ -1166,3 +1166,4 @@ test_lazy_prereq LONG_IS_64BIT '
 '
 
 test_lazy_prereq TIME_IS_64BIT 'test-date is64bit'
+test_lazy_prereq TIME_T_IS_64BIT 'test-date time_t-is64bit'