Skip to content

Commit a7ad5c7

Browse files
committed
Add test for select without PROXY_TO_PTHREAD
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
1 parent 2451b46 commit a7ad5c7

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

test/core/test_select.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <sys/select.h>
2+
#include <time.h>
3+
#include <assert.h>
4+
#include <stdio.h>
5+
#include <unistd.h>
6+
#include <string.h>
7+
8+
int pipe_a[2];
9+
10+
int main()
11+
{
12+
fd_set readfds;
13+
const char *t = "test\n";
14+
15+
assert(pipe(pipe_a) == 0);
16+
FD_ZERO(&readfds);
17+
FD_SET(pipe_a[0], &readfds);
18+
write(pipe_a[1], t, strlen(t));
19+
assert(select(pipe_a[0] + 1, &readfds, NULL, NULL, NULL) == 1);
20+
assert(FD_ISSET(pipe_a[0], &readfds));
21+
22+
close(pipe_a[0]); close(pipe_a[1]);
23+
24+
return 0;
25+
}

test/test_core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9683,6 +9683,9 @@ def test_syscall_intercept(self):
96839683
def test_pthread_select_timeout(self):
96849684
self.do_runf('core/test_pthread_select_timeout.c', cflags=['-pthread', '-sPROXY_TO_PTHREAD=1', '-sEXIT_RUNTIME=1', '-Wno-pthreads-mem-growth'])
96859685

9686+
def test_select(self):
9687+
self.do_runf('core/test_select.c')
9688+
96869689
@also_without_bigint
96879690
def test_jslib_i64_params(self):
96889691
# Tests the defineI64Param and receiveI64ParamAsI53 helpers that are

0 commit comments

Comments
 (0)