1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/test/tools/llvm-objcopy/cannot-delete-dest.test
Rafael Espindola d8d1aa83ad Delete temp file if rename fails.
Without this when lld failed to replace the output file it would leave
the temporary behind. The problem is that the existing logic is

- cancel the delete flag
- rename

We have to cancel first to avoid renaming and then crashing and
deleting the old version. What is missing then is deleting the
temporary file if the rename fails.

This can be an issue on both unix and windows, but I am not sure how
to cause the rename to fail reliably on unix. I think it can be done
on ZFS since it has an ACL system similar to what windows uses, but
adding support for checking that in llvm-lit is probably not worth it.

llvm-svn: 319786
2017-12-05 16:40:56 +00:00

23 lines
549 B
Plaintext

# REQUIRES: system-windows
# RUN: icacls %t /grant Everyone:(DC) || true
# RUN: rm -rf %t
# RUN: mkdir %t
# RUN: cd %t
# RUN: yaml2obj %s > test.o
# RUN: cp test.o test2.o
# RUN: icacls test2.o /deny Everyone:(D)
# RUN: icacls . /deny Everyone:(DC)
# This fails because it cannot replace test2.o
# RUN: not llvm-objcopy test.o test2.o
# But it doesn't leave any temporary files behind.
# RUN: not ls test2.o.tmp*
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64