summaryrefslogtreecommitdiff
path: root/bolt/test/permission.test
blob: ecb51fc7466c2784463d6309221007927ced50ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Ensure that the permissions of the optimized binary file comply with the
# system's umask.

# This test uses umask, which is Linux specific.
REQUIRES: system-linux

# RUN: rm -f %t
# RUN: touch %t
# RUN: chmod 0755 %t
# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0755
# RUN: chmod 0600 %t
# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0600
# RUN: chmod 0655 %t
# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0655

RUN: %clang %cflags %p/Inputs/hello.c -o %t.exe -Wl,-q

RUN: umask 0022
RUN: llvm-bolt %t.exe -o %t1
RUN: ls -l %t1 | cut -f 1 -d ' ' | cmp - %t.0755

RUN: umask 0177
RUN: llvm-bolt %t.exe -o %t2
RUN: ls -l %t2 | cut -f 1 -d ' ' | cmp - %t.0600

RUN: umask 0122
RUN: llvm-bolt %t.exe -o %t3
RUN: ls -l %t3 | cut -f 1 -d ' ' | cmp - %t.0655