Rafael Espindola | 9cef215 | 2013-07-12 19:34:24 +0000 | [diff] [blame] | 1 | Test the 'u' option of llvm-ar |
| 2 | |
Rafael Espindola | 9cef215 | 2013-07-12 19:34:24 +0000 | [diff] [blame] | 3 | RUN: cd %T |
| 4 | RUN: rm -f %t.a |
| 5 | |
Rafael Espindola | 04397c1 | 2013-07-12 21:17:17 +0000 | [diff] [blame] | 6 | Create a file named evenlen that is newer than the evenlen on the source dir. |
Chandler Carruth | ba310c4 | 2013-07-14 10:46:51 +0000 | [diff] [blame] | 7 | RUN: mkdir -p %t.older |
| 8 | RUN: echo older > %t.older/evenlen |
| 9 | |
NAKAMURA Takumi | b4398d8 | 2015-12-07 23:15:57 +0000 | [diff] [blame] | 10 | RUN: mkdir -p %t.newer |
| 11 | |
Chandler Carruth | ba310c4 | 2013-07-14 10:46:51 +0000 | [diff] [blame] | 12 | Either the shell supports the 'touch' command with a flag to manually set the |
Rafael Espindola | 4ae7843 | 2015-07-14 16:34:23 +0000 | [diff] [blame] | 13 | mtime or we sleep for over two seconds so that the mtime is definitely |
| 14 | observable. |
| 15 | RUN: touch -m -t 200001010000 %t.older/evenlen || sleep 2.1 |
Chandler Carruth | ba310c4 | 2013-07-14 10:46:51 +0000 | [diff] [blame] | 16 | |
Chandler Carruth | ba310c4 | 2013-07-14 10:46:51 +0000 | [diff] [blame] | 17 | RUN: echo newer > %t.newer/evenlen |
| 18 | RUN: touch %t.newer/evenlen |
Rafael Espindola | 04397c1 | 2013-07-12 21:17:17 +0000 | [diff] [blame] | 19 | |
Rafael Espindola | 9cef215 | 2013-07-12 19:34:24 +0000 | [diff] [blame] | 20 | Create an achive with the newest file |
Rafael Espindola | 6a8e86f | 2015-07-13 20:38:09 +0000 | [diff] [blame] | 21 | RUN: llvm-ar rU %t.a %t.newer/evenlen |
Rafael Espindola | 9cef215 | 2013-07-12 19:34:24 +0000 | [diff] [blame] | 22 | RUN: llvm-ar p %t.a | FileCheck --check-prefix=NEWER %s |
| 23 | |
| 24 | Check that without the 'u' option the member is replaced with an older file. |
Rafael Espindola | 6a8e86f | 2015-07-13 20:38:09 +0000 | [diff] [blame] | 25 | RUN: llvm-ar rU %t.a %t.older/evenlen |
Rafael Espindola | 9cef215 | 2013-07-12 19:34:24 +0000 | [diff] [blame] | 26 | RUN: llvm-ar p %t.a | FileCheck --check-prefix=OLDER %s |
| 27 | |
| 28 | Check that with the 'u' option the member is replaced with a newer file. |
Rafael Espindola | 6a8e86f | 2015-07-13 20:38:09 +0000 | [diff] [blame] | 29 | RUN: llvm-ar ruU %t.a %t.newer/evenlen |
Rafael Espindola | 9cef215 | 2013-07-12 19:34:24 +0000 | [diff] [blame] | 30 | RUN: llvm-ar p %t.a | FileCheck --check-prefix=NEWER %s |
| 31 | |
| 32 | Check that with the 'u' option the member is not replaced with an older file. |
Rafael Espindola | 6a8e86f | 2015-07-13 20:38:09 +0000 | [diff] [blame] | 33 | RUN: llvm-ar ruU %t.a %t.older/evenlen |
Rafael Espindola | 9cef215 | 2013-07-12 19:34:24 +0000 | [diff] [blame] | 34 | RUN: llvm-ar p %t.a | FileCheck --check-prefix=NEWER %s |
| 35 | |
| 36 | NEWER: newer |
Chandler Carruth | ba310c4 | 2013-07-14 10:46:51 +0000 | [diff] [blame] | 37 | OLDER: older |
Rafael Espindola | 449208d | 2015-07-15 20:45:56 +0000 | [diff] [blame] | 38 | |
| 39 | RUN: rm -f %t.a |
| 40 | RUN: echo foo > foo |
| 41 | RUN: echo bar > bar |
| 42 | RUN: llvm-ar --format=gnu rcT %t.a foo |
| 43 | RUN: llvm-ar --format=gnu rcT %t.a bar |
| 44 | RUN: llvm-ar t %t.a | FileCheck --check-prefix=BOTH-FILES %s |
| 45 | BOTH-FILES: foo |
| 46 | BOTH-FILES: bar |
| 47 | |
| 48 | RUN: rm -f %t.a |
| 49 | RUN: llvm-ar --format=gnu rc %t.a foo |
| 50 | RUN: not llvm-ar --format=gnu rcT %t.a bar 2>&1 | FileCheck --check-prefix=ERROR %s |
| 51 | ERROR: Cannot convert a regular archive to a thin one. |