2013-07-13 03:34:24 +08:00
|
|
|
Test the 'u' option of llvm-ar
|
|
|
|
|
2017-08-21 02:18:44 +08:00
|
|
|
RUN: rm -rf %t && mkdir -p %t && cd %t
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: rm -f %t/tmp.a
|
2013-07-13 03:34:24 +08:00
|
|
|
|
2013-07-13 05:17:17 +08:00
|
|
|
Create a file named evenlen that is newer than the evenlen on the source dir.
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: mkdir -p %t/tmp.older
|
|
|
|
RUN: echo older > %t/tmp.older/evenlen
|
2013-07-14 18:46:51 +08:00
|
|
|
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: mkdir -p %t/tmp.newer
|
2015-12-08 07:15:57 +08:00
|
|
|
|
2013-07-14 18:46:51 +08:00
|
|
|
Either the shell supports the 'touch' command with a flag to manually set the
|
2015-07-15 00:34:23 +08:00
|
|
|
mtime or we sleep for over two seconds so that the mtime is definitely
|
|
|
|
observable.
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: touch -m -t 200001010000 %t/tmp.older/evenlen || sleep 2.1
|
2013-07-14 18:46:51 +08:00
|
|
|
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: echo newer > %t/tmp.newer/evenlen
|
|
|
|
RUN: touch %t/tmp.newer/evenlen
|
2013-07-13 05:17:17 +08:00
|
|
|
|
2013-07-13 03:34:24 +08:00
|
|
|
Create an achive with the newest file
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: llvm-ar rU %t/tmp.a %t/tmp.newer/evenlen
|
|
|
|
RUN: llvm-ar p %t/tmp.a | FileCheck --check-prefix=NEWER %s
|
2013-07-13 03:34:24 +08:00
|
|
|
|
|
|
|
Check that without the 'u' option the member is replaced with an older file.
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: llvm-ar rU %t/tmp.a %t/tmp.older/evenlen
|
|
|
|
RUN: llvm-ar p %t/tmp.a | FileCheck --check-prefix=OLDER %s
|
2013-07-13 03:34:24 +08:00
|
|
|
|
|
|
|
Check that with the 'u' option the member is replaced with a newer file.
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: llvm-ar ruU %t/tmp.a %t/tmp.newer/evenlen
|
|
|
|
RUN: llvm-ar p %t/tmp.a | FileCheck --check-prefix=NEWER %s
|
2013-07-13 03:34:24 +08:00
|
|
|
|
|
|
|
Check that with the 'u' option the member is not replaced with an older file.
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: llvm-ar ruU %t/tmp.a %t/tmp.older/evenlen
|
|
|
|
RUN: llvm-ar p %t/tmp.a | FileCheck --check-prefix=NEWER %s
|
2013-07-13 03:34:24 +08:00
|
|
|
|
|
|
|
NEWER: newer
|
2013-07-14 18:46:51 +08:00
|
|
|
OLDER: older
|
2015-07-16 04:45:56 +08:00
|
|
|
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: rm -f %t/tmp.a
|
2015-07-16 04:45:56 +08:00
|
|
|
RUN: echo foo > foo
|
|
|
|
RUN: echo bar > bar
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: llvm-ar --format=gnu rcT %t/tmp.a foo
|
|
|
|
RUN: llvm-ar --format=gnu rcT %t/tmp.a bar
|
|
|
|
RUN: llvm-ar t %t/tmp.a | FileCheck --check-prefix=BOTH-FILES %s
|
2015-07-16 04:45:56 +08:00
|
|
|
BOTH-FILES: foo
|
|
|
|
BOTH-FILES: bar
|
|
|
|
|
2017-08-21 02:31:30 +08:00
|
|
|
RUN: rm -f %t/tmp.a
|
|
|
|
RUN: llvm-ar --format=gnu rc %t/tmp.a foo
|
|
|
|
RUN: not llvm-ar --format=gnu rcT %t/tmp.a bar 2>&1 | FileCheck --check-prefix=ERROR %s
|
2015-07-16 04:45:56 +08:00
|
|
|
ERROR: Cannot convert a regular archive to a thin one.
|