48 lines · plain
1## Test the -D and -U flags of llvm-ranlib2## Create an archive with timestamps but without symbol table3## Important: all `llvm-ar tv` calls must use TZ=UTC to produce identical values4# RUN: yaml2obj %S/../llvm-ar/Inputs/add-lib1.yaml -o %t.o5# RUN: env TZ=UTC touch -t 200001020304 %t.o6# RUN: rm -f %t.a %t-no-index.a && llvm-ar cqSU %t-no-index.a %t.o7 8## Check that the intial listing has real values:9# RUN: env TZ=UTC llvm-ar tv %t-no-index.a | FileCheck %s --check-prefix=REAL-VALUES10 11## Check that the -D flag clears the timestamps:12# RUN: cp %t-no-index.a %t.a && llvm-ranlib -D %t.a13# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=DETERMINISTIC-VALUES14 15## Check that the -U flag maintains the timestamps:16# RUN: cp %t-no-index.a %t.a && llvm-ranlib -U %t.a17# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=REAL-VALUES18 19## Check that we accept multiple values and the last one wins:20# RUN: cp %t-no-index.a %t.a && llvm-ranlib -UDU %t.a21# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=REAL-VALUES22# RUN: cp %t-no-index.a %t.a && llvm-ranlib -UUD %t.a23# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=DETERMINISTIC-VALUES24 25## Check multiple archives can be specified and arguments can be specified anywhere.26# RUN: cp %t-no-index.a %t.a && cp %t-no-index.a %t2.a27# RUN: llvm-ranlib -U %t.a -D %t2.a -U28# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=REAL-VALUES29# RUN: env TZ=UTC llvm-ar tv %t2.a | FileCheck %s --check-prefix=REAL-VALUES30 31## Check that the -D/-U option is only accepted with a single dash. This matches32## the GNU ranlib behaviour.33# RUN: not llvm-ranlib --D %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-D34# BAD-OPT-D: error: Invalid option: '--D'35# RUN: not llvm-ranlib --U %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-U36# BAD-OPT-U: error: Invalid option: '--U'37# RUN: not llvm-ranlib -x %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-x38# BAD-OPT-x: error: Invalid option: '-x'39 40## If the first argument starts with value flags, the error message only shows41## the remainder of the parsed string:42# RUN: not llvm-ranlib -Dx %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-x43# RUN: not llvm-ranlib -DxD %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-xD44# BAD-OPT-xD: error: Invalid option: '-xD'45 46# DETERMINISTIC-VALUES: {{[-rwx]+}} 0/0 712 Jan 1 00:00 1970 D-flag.test.tmp.o47# REAL-VALUES: {{[-rwx]+}} {{[0-9]+}}/{{[0-9]+}} 712 Jan 2 03:04 2000 D-flag.test.tmp.o48