Skip to content

Commit 93fd2e4

Browse files
[lit] Split Linux specific ulimit tests
Some of the ulimit limits do not work on some POSIX platforms. THe motivating example here is ulimit -v on MacOS as the relevant system calls are not implemented in XNU. Splitting the tests lets us keep test coverage on POSIX (non-Linux) platforms.
1 parent ba3b3e3 commit 93fd2e4

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import lit.formats
2+
3+
config.name = "shtest-ulimit"
4+
config.suffixes = [".txt"]
5+
config.test_format = lit.formats.ShTest(execute_external=False)
6+
config.test_source_root = None
7+
config.test_exec_root = None
8+
config.substitutions.append(("%{python}", '"%s"' % (sys.executable)))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# RUN: ulimit -v 1048576
2+
# RUN: %{python} %S/../shtest-ulimit/print_limits.py
3+
# Fail the test so that we can assert on the output.
4+
# RUN: not echo return

llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_okay.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# RUN: ulimit -v 1048576
21
# RUN: ulimit -n 50
32
# RUN: %{python} %S/print_limits.py
43
# Fail the test so that we can assert on the output.

llvm/utils/lit/tests/shtest-ulimit.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@
33
# ulimit does not work on non-POSIX platforms.
44
# UNSUPPORTED: system-windows
55

6-
# TODO(boomanaiden154): The test fails on some non-Linux POSIX
7-
# platforms (like MacOS) due to the underlying system not supporting
8-
# ulimit -v. This test needs to be carved up so we keep full test
9-
# coverage on Linux and as much as possible on other platforms.
10-
# REQUIRES: system-linux
11-
126
# RUN: not %{lit} -a -v %{inputs}/shtest-ulimit | FileCheck %s
7+
# RUN: %if system-linux %{ not %{lit} -a -v %{inputs}/shtest-ulimit-linux | FileCheck %s --check-prefix CHECK-LINUX %}
138

149
# CHECK: -- Testing: 2 tests{{.*}}
1510

@@ -18,7 +13,11 @@
1813
# CHECK: 'ulimit' requires two arguments
1914

2015
# CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_okay.txt ({{[^)]*}})
21-
# CHECK: ulimit -v 1048576
2216
# CHECK: ulimit -n 50
23-
# CHECK: RLIMIT_AS=1073741824
2417
# CHECK: RLIMIT_NOFILE=50
18+
19+
# CHECK-LINUX: -- Testing: 1 tests{{.*}}
20+
21+
# CHECK-LINUX-LABEL: FAIL: shtest-ulimit :: ulimit_okay.txt ({{[^)]*}})
22+
# CHECK-LINUX: ulimit -v 1048576
23+
# CHECK-LINUX: RLIMIT_AS=1073741824

0 commit comments

Comments
 (0)