63 lines · plain
1## Test that permissions for ouput files are mirrored2## from their input files.3 4## The Unix version of this test must use umask(1) because5## llvm-objcopy respects the umask in setting output permissions.6## Setting the umask to 0 ensures deterministic permissions across7## test environments.8# UNSUPPORTED: system-windows9 10# RUN: touch %t11# RUN: chmod 0777 %t12# RUN: ls -l %t | cut -f 1 -d ' ' > %t.077713# RUN: chmod 0666 %t14# RUN: ls -l %t | cut -f 1 -d ' ' > %t.066615# RUN: chmod 0640 %t16# RUN: ls -l %t | cut -f 1 -d ' ' > %t.064017 18## Set umask to be permissive of all permissions,19## only test mirroring of permissions.20# RUN: umask 021 22# RUN: yaml2obj %s -o %t23 24# RUN: chmod 0777 %t25# RUN: llvm-objcopy %t %t126# RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms27# RUN: cmp %t1.perms %t.077728 29# RUN: chmod 0666 %t30# RUN: llvm-objcopy %t %t131# RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms32# RUN: cmp %t1.perms %t.066633 34# RUN: chmod 0640 %t35# RUN: llvm-objcopy %t %t136# RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms37# RUN: cmp %t1.perms %t.064038 39## Drop S_ISUID/S_ISGID bits.40# RUN: chmod 6640 %t41# RUN: llvm-objcopy %t %t142# RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms43# RUN: cmp %t1.perms %t.064044 45## Don't set the permission of a character special file, otherwise there will46## be an EPERM error (or worse: root may change the permission).47# RUN: ls -l /dev/null | cut -f 1 -d ' ' > %tnull.perms48# RUN: llvm-objcopy %t /dev/null49# RUN: ls -l /dev/null | cut -f 1 -d ' ' | diff - %tnull.perms50 51## Ignore umask if the output filename is the same as the input filename.52# RUN: umask 02253# RUN: cp %t %t1 && chmod 0777 %t1 && llvm-objcopy %t154# RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms55# RUN: cmp %t1.perms %t.077756 57--- !ELF58FileHeader:59 Class: ELFCLASS6460 Data: ELFDATA2LSB61 Type: ET_EXEC62 Machine: EM_X86_6463