8000 tests/extmod/select_poll_fd.py: fix limiting · adafruit/circuitpython@aa943b3 · GitHub
[go: up one dir, main page]

Skip to content

Commit aa943b3

Browse files
committed
tests/extmod/select_poll_fd.py: fix limiting
1 parent 342f7a9 commit aa943b3

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.github/workflows/run-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ jobs:
4747
- name: Build unix port
4848
run: make -C ports/unix VARIANT=coverage -j4
4949
- name: Run tests
50-
run: ./run-tests.py -j4 ${{ env[format('TEST_{0}', matrix.test)] }}
50+
run: |
51+
ulimit -n
52+
ulimit -n 1024 && ./run-tests.py -j4 ${{ env[format('TEST_{0}', matrix.test)] }}
5153
working-directory: tests
5254
- name: Print failure info
5355
run: ./run-tests.py -j4 --print-failures

tests/extmod/select_poll_fd.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Test select.poll in combination with file descriptors.
2-
32
try:
43
import select, errno
54

@@ -8,6 +7,14 @@
87
print("SKIP")
98
raise SystemExit
109

10+
# CIRCUITPY-CHANGE: set max number of file descriptors here for CPython comparison test.
11+
# In MicroPython, this is done in ci.sh with `ulimit -n`.
12+
try:
13+
import resource
14+
resource.setrlimit(resource.RLIMIT_NOFILE, (1024, 1024))
15+
except ImportError:
16+
pass
17+
1118
# Check that poll supports registering file descriptors (integers).
1219
try:
1320
select.poll().register(0)
@@ -37,12 +44,7 @@
3744
# Test registering a very large number of file descriptors (will trigger
3845
# EINVAL due to more than OPEN_MAX fds). Typically it's 1024 (and on GitHub CI
3946
# we force this via `ulimit -n 1024`).
40-
# CIRCUITPY-CHANGE: set max number of file descriptors here
41-
try:
42-
import resource
43-
resource.setrlimit(resource.RLIMIT_NOFILE, (1024, 1024))
44-
except ImportError:
45-
pass
47+
# CIRCUITPY-CHANGE: set max number of fd's above.
4648
poller = select.poll()
4749
for fd in range(6000):
4850
poller.register(fd)

0 commit comments

Comments
 (0)
0