diff options
author | Chris Parsons <cparsons@google.com> | 2016-08-12 13:18:51 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2016-08-16 15:19:58 +0000 |
commit | 56e64460c586f5b69cffc99d1f52152a6a47cfbc (patch) | |
tree | 87688e1d4947d90d72f5029a489c5019625b4a1e /src/test | |
parent | f7a0818574e23d0a542a1f336761261dd1dbadd5 (diff) |
Add export ZERO_AR_DATE=1 to libtool.sh to make the output hermetic, and touch the output of libtool to avoid hitting a bug in ld.
--
MOS_MIGRATED_REVID=130093791
Diffstat (limited to 'src/test')
-rwxr-xr-x | src/test/shell/bazel/bazel_objc_test.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/shell/bazel/bazel_objc_test.sh b/src/test/shell/bazel/bazel_objc_test.sh index 125392cb00..fc8bdfd9f6 100755 --- a/src/test/shell/bazel/bazel_objc_test.sh +++ b/src/test/shell/bazel/bazel_objc_test.sh @@ -179,4 +179,35 @@ EOF || fail "should be able to resolve xcode-locator" } +# Verifies contents of .a files do not contain timestamps -- if they did, the +# results would not be hermetic. +function test_archive_timestamps() { + mkdir -p objclib + cat > objclib/BUILD <<EOF +objc_library( + name = "objclib", + srcs = ["mysrc.m"], +) +EOF + + cat > objclib/mysrc.m <<EOF +int aFunction() { + return 0; +} +EOF + + bazel build --verbose_failures //objclib:objclib >"$TEST_log" 2>&1 || \ + fail "Should build objc_library" + + # Based on timezones, ar -tv may show the timestamp of the contents as either + # Dec 31 1969 or Jan 1 1970 -- either is fine. + # We would use 'date' here, but the format is slightly different (Jan 1 vs. + # Jan 01). + ar -tv bazel-bin/objclib/libobjclib.a \ + | grep "mysrc" | grep "Dec 31" | grep "1969" \ + || ar -tv bazel-bin/objclib/libobjclib.a \ + | grep "mysrc" | grep "Jan 1" | grep "1970" || \ + fail "Timestamp of contents of archive file should be zero" +} + run_suite "objc/ios test suite" |