From 3e83d355fc049edb47d8d7c1e891eedcba629c53 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 8 Mar 2022 01:51:02 +0000 Subject: [PATCH] Move test_support_errno.c to `other` and use a different JS library function. NFC (#16442) This test was under `core` instead of `other`. Avoiding the use of `clock_gettime` since I'm about move that to native code with #16439. --- src/library.js | 2 +- tests/core/test_support_errno.out | 3 --- tests/{core => other}/test_support_errno.c | 6 +++--- tests/other/test_support_errno.out | 3 +++ tests/{core => other}/test_support_errno_disabled.out | 2 +- tests/test_other.py | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 tests/core/test_support_errno.out rename tests/{core => other}/test_support_errno.c (82%) create mode 100644 tests/other/test_support_errno.out rename tests/{core => other}/test_support_errno_disabled.out (76%) diff --git a/src/library.js b/src/library.js index 10cfb26ab68a2..33cd1392e84cf 100644 --- a/src/library.js +++ b/src/library.js @@ -1911,7 +1911,7 @@ LibraryManager.library = { }, // note: lots of leaking here! - gethostbyaddr__deps: ['$DNS', '$getHostByName', '$inetNtop4'], + gethostbyaddr__deps: ['$DNS', '$getHostByName', '$inetNtop4', '$setErrNo'], gethostbyaddr__proxy: 'sync', gethostbyaddr__sig: 'iiii', gethostbyaddr: function (addr, addrlen, type) { diff --git a/tests/core/test_support_errno.out b/tests/core/test_support_errno.out deleted file mode 100644 index 468b7010e4940..0000000000000 --- a/tests/core/test_support_errno.out +++ /dev/null @@ -1,3 +0,0 @@ -rtn : -1 -errno : 28 -strerror: Invalid argument diff --git a/tests/core/test_support_errno.c b/tests/other/test_support_errno.c similarity index 82% rename from tests/core/test_support_errno.c rename to tests/other/test_support_errno.c index 59a1936d0e76c..c37711ca8c50d 100644 --- a/tests/core/test_support_errno.c +++ b/tests/other/test_support_errno.c @@ -9,11 +9,11 @@ #include #include #include -#include +#include int main() { - int rtn = clock_gettime(-1, NULL); - printf("rtn : %d\n", rtn); + void* rtn = gethostbyaddr(NULL, 0, 0); + printf("rtn : %p\n", rtn); printf("errno : %d\n", errno); printf("strerror: %s\n", strerror(errno)); return 0; diff --git a/tests/other/test_support_errno.out b/tests/other/test_support_errno.out new file mode 100644 index 0000000000000..525fbcb751c76 --- /dev/null +++ b/tests/other/test_support_errno.out @@ -0,0 +1,3 @@ +rtn : 0 +errno : 5 +strerror: Address family not supported by protocol diff --git a/tests/core/test_support_errno_disabled.out b/tests/other/test_support_errno_disabled.out similarity index 76% rename from tests/core/test_support_errno_disabled.out rename to tests/other/test_support_errno_disabled.out index 189b87c9a7770..1ea1bcd89ff8e 100644 --- a/tests/core/test_support_errno_disabled.out +++ b/tests/other/test_support_errno_disabled.out @@ -1,3 +1,3 @@ -rtn : -1 +rtn : 0 errno : 0 strerror: No error information diff --git a/tests/test_other.py b/tests/test_other.py index 839bf25d33b03..061f1d0e0db73 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -10447,8 +10447,8 @@ def test_default_to_cxx(self): }) def test_support_errno(self, args): self.emcc_args += args - src = test_file('core/test_support_errno.c') - output = test_file('core/test_support_errno.out') + src = test_file('other/test_support_errno.c') + output = test_file('other/test_support_errno.out') self.do_run_from_file(src, output) size_default = os.path.getsize('test_support_errno.js') @@ -10456,7 +10456,7 @@ def test_support_errno(self, args): # Run the same test again but with SUPPORT_ERRNO disabled. This time we don't expect errno # to be set after the failing syscall. self.emcc_args += ['-sSUPPORT_ERRNO=0'] - output = test_file('core/test_support_errno_disabled.out') + output = test_file('other/test_support_errno_disabled.out') self.do_run_from_file(src, output) # Verify the JS output was smaller