Skip to content

Commit 942b2cf

Browse files
committed
Move test_support_errno.c to other and use a different JS library function. NFC
This test was under `core` instead of `other`. Avoiding the use of `clock_gettime` since I'm about move that to natice code with #16439.
1 parent 9af72c0 commit 942b2cf

6 files changed

+11
-11
lines changed

src/library.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ LibraryManager.library = {
19111911
},
19121912

19131913
// note: lots of leaking here!
1914-
gethostbyaddr__deps: ['$DNS', '$getHostByName', '$inetNtop4'],
1914+
gethostbyaddr__deps: ['$DNS', '$getHostByName', '$inetNtop4', '$setErrNo'],
19151915
gethostbyaddr__proxy: 'sync',
19161916
gethostbyaddr__sig: 'iiii',
19171917
gethostbyaddr: function (addr, addrlen, type) {

tests/core/test_support_errno.out

-3
This file was deleted.

tests/core/test_support_errno.c renamed to tests/other/test_support_errno.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#include <errno.h>
1010
#include <string.h>
1111
#include <sys/types.h>
12-
#include <time.h>
12+
#include <netdb.h>
1313

1414
int main() {
15-
int rtn = clock_gettime(-1, NULL);
16-
printf("rtn : %d\n", rtn);
15+
void* rtn = gethostbyaddr(NULL, 0, 0);
16+
printf("rtn : %p\n", rtn);
1717
printf("errno : %d\n", errno);
1818
printf("strerror: %s\n", strerror(errno));
1919
return 0;

tests/other/test_support_errno.out

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rtn : 0
2+
errno : 5
3+
strerror: Address family not supported by protocol
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
rtn : -1
1+
rtn : 0
22
errno : 0
33
strerror: No error information

tests/test_other.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10447,16 +10447,16 @@ def test_default_to_cxx(self):
1044710447
})
1044810448
def test_support_errno(self, args):
1044910449
self.emcc_args += args
10450-
src = test_file('core/test_support_errno.c')
10451-
output = test_file('core/test_support_errno.out')
10450+
src = test_file('other/test_support_errno.c')
10451+
output = test_file('other/test_support_errno.out')
1045210452

1045310453
self.do_run_from_file(src, output)
1045410454
size_default = os.path.getsize('test_support_errno.js')
1045510455

1045610456
# Run the same test again but with SUPPORT_ERRNO disabled. This time we don't expect errno
1045710457
# to be set after the failing syscall.
1045810458
self.emcc_args += ['-sSUPPORT_ERRNO=0']
10459-
output = test_file('core/test_support_errno_disabled.out')
10459+
output = test_file('other/test_support_errno_disabled.out')
1046010460
self.do_run_from_file(src, output)
1046110461

1046210462
# Verify the JS output was smaller

0 commit comments

Comments
 (0)