| 1 |
# This test relies on locking files which is difficult to do in a way the keeps |
| 2 |
# a test robust on Linux, so it is restricted to Windows. |
| 3 |
REQUIRES: ld.lld,system-windows |
| 4 |
|
| 5 |
# Test that a warning is emitted for each DTLTO temporary file that cannot be |
| 6 |
# removed. This test uses archives because archive handling exercises a superset |
| 7 |
# of the temporary files used for object inputs. |
| 8 |
# |
| 9 |
# This scenario is logically related to the cases in savetemps.test; however, it |
| 10 |
# is placed here to maintain coverage, as this behavior can only be tested |
| 11 |
# effectively on Windows. |
| 12 |
|
| 13 |
RUN: rm -rf %t && split-file %s %t && cd %t |
| 14 |
|
| 15 |
RUN: %clang --target=x86_64-linux-gnu -O2 t1.c t2.c -flto=thin -c |
| 16 |
|
| 17 |
RUN: llvm-ar rcs t.a t1.o t2.o |
| 18 |
|
| 19 |
# Check that a warning is reported for each temporary file that cannot be |
| 20 |
# removed. Note that the use of the name "locked" for the output directory |
| 21 |
# triggers special behaviour in test_temps.py. |
| 22 |
RUN: mkdir locked && %python %S/test_temps.py locked lock \ |
| 23 |
RUN: %clang --target=x86_64-linux-gnu -nostdlib -O2 -flto=thin \ |
| 24 |
RUN: -fuse-ld=lld -Wl,--whole-archive t.a -o locked/t.elf -shared \ |
| 25 |
RUN: -fthinlto-distributor=%python \ |
| 26 |
RUN: -Xthinlto-distributor=%S/local_codegen_and_wait.py 2>&1 \ |
| 27 |
RUN: | FileCheck %s --implicit-check-not=warning |
| 28 |
|
| 29 |
# Sanity check for the expected test_temps.py behaviour. |
| 30 |
CHECK-DAG: Lock any files in the output directory. |
| 31 |
CHECK-DAG: warning: could not remove the file 'locked{{/|\\}}t.[[#PID:]].dist-file.json': {{.*}} |
| 32 |
# Filename composition: <archive>(<member> at <offset>).<task>.<pid>.<task>.<pid>.native.o. |
| 33 |
CHECK-DAG: warning: could not remove the file 'locked{{/|\\}}t.a(t1.o at [[#T1_OFFSET:]]).1.[[#%X,HEXPID:]].1.[[#PID]].native.o': {{.*}} |
| 34 |
CHECK-DAG: warning: could not remove the file 'locked{{/|\\}}t.a(t1.o at [[#T1_OFFSET]]).1.[[#%X,HEXPID]].1.[[#PID]].native.o.thinlto.bc': {{.*}} |
| 35 |
CHECK-DAG: warning: could not remove the file 'locked{{/|\\}}t.a(t2.o at [[#T2_OFFSET:]]).2.[[#%X,HEXPID]].2.[[#PID]].native.o': {{.*}} |
| 36 |
CHECK-DAG: warning: could not remove the file 'locked{{/|\\}}t.a(t2.o at [[#T2_OFFSET]]).2.[[#%X,HEXPID]].2.[[#PID]].native.o.thinlto.bc': {{.*}} |
| 37 |
CHECK-DAG: warning: could not remove temporary DTLTO input file 'locked{{/|\\}}t.a(t1.o at [[#T1_OFFSET]]).1.[[#%X,HEXPID]].o': {{.*}} |
| 38 |
CHECK-DAG: warning: could not remove temporary DTLTO input file 'locked{{/|\\}}t.a(t2.o at [[#T2_OFFSET]]).2.[[#%X,HEXPID]].o': {{.*}} |
| 39 |
|
| 40 |
#--- t1.c |
| 41 |
__attribute__((retain)) int t1(int x) { return x; } |
| 42 |
|
| 43 |
#--- t2.c |
| 44 |
__attribute__((retain)) int t2(int x) { return x; } |