Skip to content

Commit

Permalink
Move test_support_errno.c to other and use a different JS library f…
Browse files Browse the repository at this point in the history
…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
1 parent 9af72c0 commit 942b2cf
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
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

0 comments on commit 942b2cf

Please sign in to comment.