t0006: skip "far in the future" test when unsigned long is not long enough
Git's source code refers to timestamps as unsigned longs. On 32-bit platforms, as well as on Windows, unsigned long is not large enough to capture dates that are "absurdly far in the future". While we can fix this issue properly by replacing unsigned long with a larger type, we want to be a bit more conservative and just skip those tests on the maint track. Signed-off-by: Jeff King <peff@peff.net> Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jul 11, 2016 at 19:54 UTC
6b9c38e14cd3abf9b95cabe8b86954f0c4e94a38
3 files changed
+18
-3
help.c
+6
@@ -419,6 +419,12 @@ int cmd_version(int argc, const char **argv, const char *prefix)
419
* with external projects that rely on the output of "git version".
420
*/
421
printf("git version %s\n", git_version_string);
422
+ while (*++argv) {
423
+ if (!strcmp(*argv, "--build-options")) {
424
+ printf("sizeof-long: %d\n", (int)sizeof(long));
425
+ /* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
426
+ }
427
+ }
428
return 0;
429
}
430
t/t0006-date.sh
+3
-3
@@ -31,7 +31,7 @@ check_show () {
31
format=$1
32
time=$2
33
expect=$3
34
- test_expect_${4:-success} "show date ($format:$time)" '
34
+ test_expect_success $4 "show date ($format:$time)" '
35
echo "$time -> $expect" >expect &&
36
test-date show:$format "$time" >actual &&
37
test_cmp expect actual
@@ -50,8 +50,8 @@ check_show iso-local "$TIME" '2016-06-15 14:13:20 +0000'
50
51
# arbitrary time absurdly far in the future
52
FUTURE="5758122296 -0400"
53
-check_show iso "$FUTURE" "2152-06-19 18:24:56 -0400"
54
-check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000"
53
+check_show iso "$FUTURE" "2152-06-19 18:24:56 -0400" LONG_IS_64BIT
54
+check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" LONG_IS_64BIT
55
56
check_parse() {
57
echo "$1 -> $2" >expect
t/test-lib.sh
+9
@@ -1098,3 +1098,12 @@ run_with_limited_cmdline () {
1098
}
1099
1100
test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
1101
+
1102
+build_option () {
1103
+ git version --build-options |
1104
+ sed -ne "s/^$1: //p"
1105
+}
1106
+
1107
+test_lazy_prereq LONG_IS_64BIT '
1108
+ test 8 -le "$(build_option sizeof-long)"
1109
+'