Showing with 22 additions and 23 deletions.
  1. +0 −4 test/benchmark-getaddrinfo.c
  2. +1 −3 test/benchmark-ping-pongs.c
  3. +13 −5 test/run-tests.c
  4. +6 −2 test/runner-unix.c
  5. +0 −4 test/test-getaddrinfo.c
  6. +2 −5 test/test-ping-pong.c
@@ -21,11 +21,7 @@

#include "uv.h"
#include "task.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strlen */


#define CONCURRENT_CALLS 10
#define TOTAL_CALLS 10000
@@ -24,7 +24,6 @@

#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strlen */

/* Run the benchmark for this many ms */
#define TIME 5000
@@ -103,8 +102,7 @@ static void pinger_write_ping(pinger_t* pinger) {
uv_write_t* req;
uv_buf_t buf;

buf.base = (char*)&PING;
buf.len = strlen(PING);
buf = uv_buf_init(PING, sizeof(PING) - 1);

req = malloc(sizeof *req);
if (uv_write(req, (uv_stream_t*) &pinger->tcp, &buf, 1, pinger_write_cb)) {
@@ -19,6 +19,7 @@
* IN THE SOFTWARE.
*/

#include <errno.h>
#include <stdio.h>
#include <string.h>

@@ -99,7 +100,7 @@ static int maybe_run_test(int argc, char **argv) {

if (strcmp(argv[1], "spawn_helper3") == 0) {
char buffer[256];
fgets(buffer, sizeof(buffer) - 1, stdin);
ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin));
buffer[sizeof(buffer) - 1] = '\0';
fputs(buffer, stdout);
return 1;
@@ -111,13 +112,20 @@ static int maybe_run_test(int argc, char **argv) {
}

if (strcmp(argv[1], "spawn_helper5") == 0) {
const char* out = "fourth stdio!\n\0";
const char out[] = "fourth stdio!\n";
#ifdef _WIN32
DWORD bytes;
WriteFile((HANDLE) _get_osfhandle(3), out, strlen(out), &bytes, NULL);
WriteFile((HANDLE) _get_osfhandle(3), out, sizeof(out) - 1, &bytes, NULL);
#else
write(3, out, strlen(out));
fsync(3);
{
ssize_t r;

do
r = write(3, out, sizeof(out) - 1);
while (r == -1 && errno == EINTR);

fsync(3);
}
#endif
return 1;
}
@@ -24,6 +24,7 @@

#include <stdint.h> /* uintptr_t */

#include <errno.h>
#include <unistd.h> /* usleep */
#include <string.h> /* strdup */
#include <stdio.h>
@@ -146,8 +147,11 @@ static void* dowait(void* data) {

if (args->pipe[1] >= 0) {
/* Write a character to the main thread to notify it about this. */
char c = 0;
write(args->pipe[1], &c, 1);
ssize_t r;

do
r = write(args->pipe[1], "", 1);
while (r == -1 && errno == EINTR);
}

return NULL;
@@ -21,11 +21,7 @@

#include "uv.h"
#include "task.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strlen */


#define CONCURRENT_COUNT 10

@@ -24,7 +24,6 @@

#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strlen */

static int completed_pingers = 0;

@@ -77,11 +76,9 @@ static void pinger_write_ping(pinger_t* pinger) {
uv_write_t *req;
uv_buf_t buf;

buf.base = (char*)&PING;
buf.len = strlen(PING);

req = malloc(sizeof(uv_write_t));
buf = uv_buf_init(PING, sizeof(PING) - 1);

req = malloc(sizeof(*req));
if (uv_write(req, (uv_stream_t*)&pinger->stream.tcp, &buf, 1, pinger_after_write)) {
FATAL("uv_write failed");
}