Mercurial > pub > dyncall > dyncall
diff test/syscall/syscall.c @ 410:7608e34098b0
- cleanups, simplifications, some api clarification, ...
- test cases consistency:
* return status code depending on test results (for actual conformance tests, not stuff that is not an example or hack to check something, ..)
* platform init helper added for some
author | Tassilo Philipp |
---|---|
date | Tue, 05 Oct 2021 21:53:04 +0200 |
parents | f5577f6bf97a |
children | dfc2e6ee8782 |
line wrap: on
line diff
--- a/test/syscall/syscall.c Sun Oct 03 19:41:41 2021 +0200 +++ b/test/syscall/syscall.c Tue Oct 05 21:53:04 2021 +0200 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2011-2018 Daniel Adler <dadler@uni-goettingen.de>, + Copyright (c) 2011-2021 Daniel Adler <dadler@uni-goettingen.de>, Tassilo Philipp <tphilipp@potion-studios.com> Permission to use, copy, modify, and distribute this software for any @@ -25,15 +25,8 @@ #include "dyncall.h" #include <sys/syscall.h> -#include <assert.h> DCCallVM* callvm; -void syscallvm_init() -{ - callvm = dcNewCallVM(4096); - dcMode(callvm, DC_CALL_SYS_DEFAULT); - assert( dcGetError(callvm) == DC_ERROR_NONE ); -} int syscall_write(int fd, char* buf, size_t len) { @@ -46,8 +39,15 @@ int main(int argc, char* argv[]) { - syscallvm_init(); - syscall_write(1/*stdout*/, "result: syscall: 1\n", 19); - return 0; + int r = -1; + callvm = dcNewCallVM(4096); + dcMode(callvm, DC_CALL_SYS_DEFAULT); + + if(dcGetError(callvm) == DC_ERROR_NONE) + { + r = syscall_write(1/*stdout*/, "result: syscall: ", 17); + r += syscall_write(1/*stdout*/, r==17?"1":"0", 2); + } + return !(r == 19); }