summaryrefslogtreecommitdiff
path: root/test/verify_archive_timestamps.sh
blob: b6d26fa3e89d29bcabedfeb2e513bbc6b9871b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

set -euo pipefail
set -x

readonly binary="%{binary}s"

if [[ "$binary" != *_lipo.a ]]; then
  echo "$binary: error: binary name does not end in _lipo.a" >&2
  exit 1
fi

ar -tv "$binary"

# 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).
if ! ar -tv "$binary" | grep "objc_lib" | grep "Dec 31" | grep "1969" \
  && ! ar -tv "$binary" | grep "objc_lib" | grep "Jan  1" | grep "1970"
then
  echo "error: timestamp of contents of archive file should be zero" >&2
  exit 1
fi