Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move test_support_errno.c to other and use a different JS library function. NFC #16442

Merged
merged 1 commit into from
Mar 8, 2022
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
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