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