1 ## Test that permissions for ouput files are mirrored
2 ## from their input files.
4 ## The Unix version of this test must use umask(1) because
5 ## llvm-objcopy respects the umask in setting output permissions.
6 ## Setting the umask to 0 ensures deterministic permissions across
8 # UNSUPPORTED: system-windows
13 # RUN: ls -l %t | cut -f 1 -d ' ' > %t.0777
15 # RUN: ls -l %t | cut -f 1 -d ' ' > %t.0666
17 # RUN: ls -l %t | cut -f 1 -d ' ' > %t.0640
19 ## Set umask to be permissive of all permissions,
20 ## only test mirroring of permissions.
23 # RUN: yaml2obj %s -o %t
26 # RUN: llvm-objcopy %t %t1
27 # RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
28 # RUN: cmp %t1.perms %t.0777
31 # RUN: llvm-objcopy %t %t1
32 # RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
33 # RUN: cmp %t1.perms %t.0666
36 # RUN: llvm-objcopy %t %t1
37 # RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
38 # RUN: cmp %t1.perms %t.0640
40 ## Drop S_ISUID/S_ISGID bits.
42 # RUN: llvm-objcopy %t %t1
43 # RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
44 # RUN: cmp %t1.perms %t.0640
46 ## Don't set the permission of a character special file, otherwise there will
47 ## be an EPERM error (or worse: root may change the permission).
48 # RUN: ls -l /dev/null | cut -f 1 -d ' ' > %tnull.perms
49 # RUN: llvm-objcopy %t /dev/null
50 # RUN: ls -l /dev/null | cut -f 1 -d ' ' | diff - %tnull.perms
52 ## Ignore umask if the output filename is the same as the input filename.
54 # RUN: cp %t %t1 && chmod 0777 %t1 && llvm-objcopy %t1
55 # RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
56 # RUN: cmp %t1.perms %t.0777