[lld] r336340 - [ELF] - Add test to check we produce an error if unable to write an empty index file.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 05:12:30 PDT 2018


Author: grimar
Date: Thu Jul  5 05:12:30 2018
New Revision: 336340

URL: http://llvm.org/viewvc/llvm-project?rev=336340&view=rev
Log:
[ELF] - Add test to check we produce an error if unable to write an empty index file.

Test case ensures lld generates an error if unable to
write an empty index file for lazy object file that is not added to link.

This covers the following line with a test:
https://github.com/llvm-mirror/lld/blob/master/ELF/LTO.cpp#L206

Modified:
    lld/trunk/test/ELF/lto/thinlto-index-only.ll

Modified: lld/trunk/test/ELF/lto/thinlto-index-only.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/thinlto-index-only.ll?rev=336340&r1=336339&r2=336340&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/thinlto-index-only.ll (original)
+++ lld/trunk/test/ELF/lto/thinlto-index-only.ll Thu Jul  5 05:12:30 2018
@@ -34,6 +34,16 @@
 ; RUN: ld.lld --plugin-opt=thinlto-index-only -shared %t2.o --start-lib %t1.o --end-lib -o %t3
 ; RUN: ls %t1.o.thinlto.bc
 
+; Ensure lld generates an error if unable to write an empty index file
+; for lazy object file that is not added to link.
+; RUN: rm -f %t1.o.thinlto.bc
+; RUN: touch %t1.o.thinlto.bc
+; RUN: chmod 400 %t1.o.thinlto.bc
+; RUN: not ld.lld --plugin-opt=thinlto-index-only -shared %t2.o --start-lib %t1.o --end-lib \
+; RUN:   -o %t3 2>&1 | FileCheck %s
+; CHECK: cannot open {{.*}}1.o.thinlto.bc: {{P|p}}ermission denied
+; RUN: rm -f %t1.o.thinlto.bc
+
 ; NM: T f
 
 ; The backend index for this module contains summaries from itself and




More information about the llvm-commits mailing list