diff options
author | Rickard Green <[email protected]> | 2014-08-05 18:04:46 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2014-08-06 15:47:28 +0200 |
commit | cde6c2e042834d66649308093d5522c1a2001949 (patch) | |
tree | f265470037ddbe08bd0da1a915076b258c880484 | |
parent | ace34ce01c9378525d024246c7d76ab01add4a8d (diff) | |
download | otp-cde6c2e042834d66649308093d5522c1a2001949.tar.gz otp-cde6c2e042834d66649308093d5522c1a2001949.tar.bz2 otp-cde6c2e042834d66649308093d5522c1a2001949.zip |
Fix build of test port program
-rw-r--r-- | erts/emulator/test/async_ports_SUITE.erl | 1 | ||||
-rw-r--r-- | erts/emulator/test/async_ports_SUITE_data/Makefile.src | 14 | ||||
-rw-r--r-- | erts/emulator/test/async_ports_SUITE_data/cport.c | 22 |
3 files changed, 32 insertions, 5 deletions
diff --git a/erts/emulator/test/async_ports_SUITE.erl b/erts/emulator/test/async_ports_SUITE.erl index 9e0cc8ffab..c89b3655ff 100644 --- a/erts/emulator/test/async_ports_SUITE.erl +++ b/erts/emulator/test/async_ports_SUITE.erl @@ -11,6 +11,7 @@ -define(TEST_PROCS_COUNT, 2). -define(TC_TIMETRAP_SECONDS, 10). +suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [ diff --git a/erts/emulator/test/async_ports_SUITE_data/Makefile.src b/erts/emulator/test/async_ports_SUITE_data/Makefile.src index d2cd90f5b3..56da3fbe12 100644 --- a/erts/emulator/test/async_ports_SUITE_data/Makefile.src +++ b/erts/emulator/test/async_ports_SUITE_data/Makefile.src @@ -1,5 +1,15 @@ -all: cport@obj@ +CC = @CC@ +LD = @LD@ +CFLAGS = @CFLAGS@ @DEFS@ +CROSSLDFLAGS = @CROSSLDFLAGS@ -@SHLIB_RULES@ +PROGS = cport@exe@ + + +all: $(PROGS) + +cport@exe@: cport@obj@ + $(LD) $(CROSSLDFLAGS) -o cport cport@obj@ @LIBS@ cport@obj@: cport.c + $(CC) -c -o cport@obj@ $(CFLAGS) cport.c diff --git a/erts/emulator/test/async_ports_SUITE_data/cport.c b/erts/emulator/test/async_ports_SUITE_data/cport.c index 179cdc4b8b..033aff382a 100644 --- a/erts/emulator/test/async_ports_SUITE_data/cport.c +++ b/erts/emulator/test/async_ports_SUITE_data/cport.c @@ -1,9 +1,13 @@ #include <stdlib.h> #include <stdio.h> -#include <malloc.h> #include <errno.h> #include <string.h> -#include <unistd.h> +#ifdef __WIN32__ +# include "windows.h" +# include "winbase.h" +#else +# include <unistd.h> +#endif typedef unsigned char byte; @@ -53,13 +57,25 @@ int write_exact(byte *buf, int len) return len; } +byte static_buf[31457280]; // 30 mb + int main(int argc, char **argv) { int sleep_time = atoi(argv[1]); int fn, arg, res; - byte *buf = malloc(31457280); // 30 mb + byte *buf = &static_buf[0]; int len = 0; + if (sleep_time <= 0) + sleep_time = 0; +#ifdef __WIN32__ + else + sleep_time = ((sleep_time - 1) / 1000) + 1; /* Milli seconds */ +#endif while ((len = read_cmd(buf)) > 0) { +#ifdef __WIN32__ + Sleep((DWORD) sleep_time); +#else usleep(sleep_time); +#endif write_cmd(buf, len); } } |