xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/mirror-permissions-unix.test (revision 1233e2e66831e07c0fd925155fc637020614dc40)
1## The Unix version of this test must use umask(1) because
2## llvm-dwarfutil respects the umask in setting output permissions.
3## Setting the umask to 0 ensures deterministic permissions across
4## test environments.
5# UNSUPPORTED: system-windows
6# REQUIRES: shell
7
8# RUN: touch %t
9# RUN: chmod 0777 %t
10# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0777
11# RUN: chmod 0666 %t
12# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0666
13# RUN: chmod 0640 %t
14# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0640
15
16## Set umask to be permissive of all permissions,
17## only test mirroring of permissions.
18# RUN: umask 0
19
20# RUN: yaml2obj %s -o %t
21
22# RUN: chmod 0777 %t
23# RUN: llvm-dwarfutil --no-garbage-collection %t %t1
24# RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
25# RUN: cmp %t1.perms %t.0777
26# RUN: llvm-dwarfutil --garbage-collection --separate-debug-file %t %t2
27# RUN: ls -l %t2 | cut -f 1 -d ' ' > %t2.perms
28# RUN: cmp %t2.perms %t.0777
29
30# RUN: chmod 0666 %t
31# RUN: llvm-dwarfutil --no-garbage-collection %t %t1
32# RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
33# RUN: cmp %t1.perms %t.0666
34# RUN: llvm-dwarfutil --garbage-collection --separate-debug-file %t %t2
35# RUN: ls -l %t2 | cut -f 1 -d ' ' > %t2.perms
36# RUN: cmp %t2.perms %t.0666
37
38# RUN: chmod 0640 %t
39# RUN: llvm-dwarfutil --no-garbage-collection %t %t1
40# RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
41# RUN: cmp %t1.perms %t.0640
42# RUN: llvm-dwarfutil --garbage-collection --separate-debug-file %t %t2
43# RUN: ls -l %t2 | cut -f 1 -d ' ' > %t2.perms
44# RUN: cmp %t2.perms %t.0640
45
46--- !ELF
47FileHeader:
48  Class:   ELFCLASS64
49  Data:    ELFDATA2LSB
50  Type:    ET_EXEC
51  Machine: EM_X86_64
52