From cde6c2e042834d66649308093d5522c1a2001949 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Tue, 5 Aug 2014 18:04:46 +0200 Subject: Fix build of test port program --- .../test/async_ports_SUITE_data/Makefile.src | 14 ++++++++++++-- erts/emulator/test/async_ports_SUITE_data/cport.c | 22 +++++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) (limited to 'erts/emulator/test/async_ports_SUITE_data') 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 #include -#include #include #include -#include +#ifdef __WIN32__ +# include "windows.h" +# include "winbase.h" +#else +# include +#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); } } -- cgit v1.2.3