Skip to content

Commit 80c2179

Browse files
[BOLT] Fix tests that were unresolved when using lit's internal shell
These two tests were unresolved when using lit's internal shell. In the case of tail-duplication-constant-prop, it was because they were using a echo $? line, and lit's internal echo implementation does not support $? to get the return code. The test was never actually asserting anything about the return code though, so I've removed the echo commands. In the case of permission.test, it was because umask was not supported before llvm#155850, and afterwards not without an argument. The test also was not great at capturing what it was supposed to (leaving open possibilites like the system umask and what Bolt was using happening to match), so I've rewritten the test in the style of llvm/test/tools/llvm-objcopy/ELF/respect-umask.test. This fixes llvm#102693. Reviewers: maksfb, yota9, ayermolo, yozhu, aaupov, rafaelauler, paschalis-mpeis Reviewed By: maksfb Pull Request: llvm#156082
1 parent dfc376a commit 80c2179

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

bolt/test/permission.test

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
# Ensure that the permissions of the optimized binary file comply with the
22
# system's umask.
33

4-
# This test performs a logical AND operation on the results of the `stat -c %a
5-
# %t.bolt` and `umask` commands (both results are displayed in octal), and
6-
# checks whether the result is equal to 0.
7-
REQUIRES: shell, system-linux
4+
# This test uses umask, which is Linux specific.
5+
REQUIRES: system-linux
86

9-
RUN: %clang %cflags %p/Inputs/hello.c -o %t -Wl,-q
10-
RUN: llvm-bolt %t -o %t.bolt
11-
RUN: echo $(( 8#$(stat -c %a %t.bolt) & 8#$(umask) )) | FileCheck %s
7+
# RUN: rm -f %t
8+
# RUN: touch %t
9+
# RUN: chmod 0755 %t
10+
# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0755
11+
# RUN: chmod 0600 %t
12+
# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0600
13+
# RUN: chmod 0655 %t
14+
# RUN: ls -l %t | cut -f 1 -d ' ' > %t.0655
1215

13-
CHECK: 0
16+
RUN: %clang %cflags %p/Inputs/hello.c -o %t.exe -Wl,-q
17+
18+
RUN: umask 0022
19+
RUN: llvm-bolt %t.exe -o %t1
20+
RUN: ls -l %t1 | cut -f 1 -d ' ' | cmp - %t.0755
21+
22+
RUN: umask 0177
23+
RUN: llvm-bolt %t.exe -o %t2
24+
RUN: ls -l %t2 | cut -f 1 -d ' ' | cmp - %t.0600
25+
26+
RUN: umask 0122
27+
RUN: llvm-bolt %t.exe -o %t3
28+
RUN: ls -l %t3 | cut -f 1 -d ' ' | cmp - %t.0655

bolt/test/runtime/X86/tail-duplication-constant-prop.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# RUN: --print-finalized \
99
# RUN: --tail-duplication=moderate --tail-duplication-minimum-offset=1 \
1010
# RUN: --tail-duplication-const-copy-propagation=1 -o %t.out | FileCheck %s
11-
# RUN: %t.exe; echo $?
12-
# RUN: %t.out; echo $?
11+
# RUN: not %t.exe
12+
# RUN: not %t.out
1313

1414
# FDATA: 1 main 14 1 main #.BB2# 0 10
1515
# FDATA: 1 main 16 1 main #.BB2# 0 20

0 commit comments

Comments
 (0)