Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move test_support_errno.c to other and use a different JS library f…
…unction. 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.
  • Loading branch information
sbc100 committed Mar 8, 2022
commit 942b2cf74208014c69fa982f628e2b2f391aa694
2 changes: 1 addition & 1 deletion src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions tests/core/test_support_errno.out

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <netdb.h>

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;
Expand Down
3 changes: 3 additions & 0 deletions tests/other/test_support_errno.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rtn : 0
errno : 5
strerror: Address family not supported by protocol
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rtn : -1
rtn : 0
errno : 0
strerror: No error information
6 changes: 3 additions & 3 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -10447,16 +10447,16 @@ 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')

# 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
Expand Down