52 lines · plain
1Test the 'u' option of llvm-ar2 3RUN: rm -rf %t && mkdir -p %t && cd %t4RUN: rm -f %t/tmp.a5 6Create a file named evenlen that is newer than the evenlen on the source dir.7RUN: mkdir -p %t/tmp.older8RUN: echo older > %t/tmp.older/evenlen9 10RUN: mkdir -p %t/tmp.newer11 12Either the shell supports the 'touch' command with a flag to manually set the13mtime or we sleep for over two seconds so that the mtime is definitely14observable.15RUN: touch -m -t 200001010000 %t/tmp.older/evenlen || sleep 2.116 17RUN: echo newer > %t/tmp.newer/evenlen18RUN: touch %t/tmp.newer/evenlen19 20Create an archive with the newest file21RUN: llvm-ar rU %t/tmp.a %t/tmp.newer/evenlen22RUN: llvm-ar p %t/tmp.a | FileCheck --check-prefix=NEWER %s23 24Check that without the 'u' option the member is replaced with an older file.25RUN: llvm-ar rU %t/tmp.a %t/tmp.older/evenlen26RUN: llvm-ar p %t/tmp.a | FileCheck --check-prefix=OLDER %s27 28Check that with the 'u' option the member is replaced with a newer file.29RUN: llvm-ar ruU %t/tmp.a %t/tmp.newer/evenlen30RUN: llvm-ar p %t/tmp.a | FileCheck --check-prefix=NEWER %s31 32Check that with the 'u' option the member is not replaced with an older file.33RUN: llvm-ar ruU %t/tmp.a %t/tmp.older/evenlen34RUN: llvm-ar p %t/tmp.a | FileCheck --check-prefix=NEWER %s35 36NEWER: newer37OLDER: older38 39RUN: rm -f %t/tmp.a40RUN: echo foo > foo41RUN: echo bar > bar42RUN: llvm-ar --format=gnu rcT %t/tmp.a foo43RUN: llvm-ar --format=gnu rcT %t/tmp.a bar44RUN: llvm-ar t %t/tmp.a | FileCheck --check-prefix=BOTH-FILES %s45BOTH-FILES: foo46BOTH-FILES: bar47 48RUN: rm -f %t/tmp.a49RUN: llvm-ar --format=gnu rc %t/tmp.a foo50RUN: not llvm-ar --format=gnu rcT %t/tmp.a bar 2>&1 | FileCheck --check-prefix=ERROR %s51ERROR: error: cannot convert a regular archive to a thin one52