libuv 1.45.0, #include cleanup, probably something else.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4308 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
7
deps/libuv/test/benchmark-async-pummel.c
vendored
7
deps/libuv/test/benchmark-async-pummel.c
vendored
@ -62,6 +62,7 @@ static void pummel(void* arg) {
|
||||
|
||||
|
||||
static int test_async_pummel(int nthreads) {
|
||||
char fmtbuf[2][32];
|
||||
uv_thread_t* tids;
|
||||
uv_async_t handle;
|
||||
uint64_t time;
|
||||
@ -88,13 +89,13 @@ static int test_async_pummel(int nthreads) {
|
||||
|
||||
printf("async_pummel_%d: %s callbacks in %.2f seconds (%s/sec)\n",
|
||||
nthreads,
|
||||
fmt(callbacks),
|
||||
fmt(&fmtbuf[0], callbacks),
|
||||
time / 1e9,
|
||||
fmt(callbacks / (time / 1e9)));
|
||||
fmt(&fmtbuf[1], callbacks / (time / 1e9)));
|
||||
|
||||
free(tids);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
5
deps/libuv/test/benchmark-async.c
vendored
5
deps/libuv/test/benchmark-async.c
vendored
@ -73,6 +73,7 @@ static void worker(void* arg) {
|
||||
|
||||
|
||||
static int test_async(int nthreads) {
|
||||
char fmtbuf[32];
|
||||
struct ctx* threads;
|
||||
struct ctx* ctx;
|
||||
uint64_t time;
|
||||
@ -112,11 +113,11 @@ static int test_async(int nthreads) {
|
||||
printf("async%d: %.2f sec (%s/sec)\n",
|
||||
nthreads,
|
||||
time / 1e9,
|
||||
fmt(NUM_PINGS / (time / 1e9)));
|
||||
fmt(&fmtbuf, NUM_PINGS / (time / 1e9)));
|
||||
|
||||
free(threads);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
12
deps/libuv/test/benchmark-fs-stat.c
vendored
12
deps/libuv/test/benchmark-fs-stat.c
vendored
@ -60,6 +60,7 @@ static void warmup(const char* path) {
|
||||
|
||||
|
||||
static void sync_bench(const char* path) {
|
||||
char fmtbuf[2][32];
|
||||
uint64_t before;
|
||||
uint64_t after;
|
||||
uv_fs_t req;
|
||||
@ -74,9 +75,9 @@ static void sync_bench(const char* path) {
|
||||
after = uv_hrtime();
|
||||
|
||||
printf("%s stats (sync): %.2fs (%s/s)\n",
|
||||
fmt(1.0 * NUM_SYNC_REQS),
|
||||
fmt(&fmtbuf[0], 1.0 * NUM_SYNC_REQS),
|
||||
(after - before) / 1e9,
|
||||
fmt((1.0 * NUM_SYNC_REQS) / ((after - before) / 1e9)));
|
||||
fmt(&fmtbuf[1], (1.0 * NUM_SYNC_REQS) / ((after - before) / 1e9)));
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
@ -93,6 +94,7 @@ static void stat_cb(uv_fs_t* fs_req) {
|
||||
static void async_bench(const char* path) {
|
||||
struct async_req reqs[MAX_CONCURRENT_REQS];
|
||||
struct async_req* req;
|
||||
char fmtbuf[2][32];
|
||||
uint64_t before;
|
||||
uint64_t after;
|
||||
int count;
|
||||
@ -112,10 +114,10 @@ static void async_bench(const char* path) {
|
||||
after = uv_hrtime();
|
||||
|
||||
printf("%s stats (%d concurrent): %.2fs (%s/s)\n",
|
||||
fmt(1.0 * NUM_ASYNC_REQS),
|
||||
fmt(&fmtbuf[0], 1.0 * NUM_ASYNC_REQS),
|
||||
i,
|
||||
(after - before) / 1e9,
|
||||
fmt((1.0 * NUM_ASYNC_REQS) / ((after - before) / 1e9)));
|
||||
fmt(&fmtbuf[1], (1.0 * NUM_ASYNC_REQS) / ((after - before) / 1e9)));
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
@ -131,6 +133,6 @@ BENCHMARK_IMPL(fs_stat) {
|
||||
warmup(path);
|
||||
sync_bench(path);
|
||||
async_bench(path);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/benchmark-getaddrinfo.c
vendored
2
deps/libuv/test/benchmark-getaddrinfo.c
vendored
@ -87,6 +87,6 @@ BENCHMARK_IMPL(getaddrinfo) {
|
||||
(double) calls_completed / (double) (end_time - start_time) * 1000.0);
|
||||
fflush(stderr);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/benchmark-loop-count.c
vendored
4
deps/libuv/test/benchmark-loop-count.c
vendored
@ -68,7 +68,7 @@ BENCHMARK_IMPL(loop_count) {
|
||||
NUM_TICKS / (ns / 1e9));
|
||||
fflush(stderr);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -87,6 +87,6 @@ BENCHMARK_IMPL(loop_count_timed) {
|
||||
fprintf(stderr, "loop_count: %lu ticks (%.0f ticks/s)\n", ticks, ticks / 5.0);
|
||||
fflush(stderr);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
9
deps/libuv/test/benchmark-million-async.c
vendored
9
deps/libuv/test/benchmark-million-async.c
vendored
@ -76,6 +76,7 @@ static void timer_cb(uv_timer_t* handle) {
|
||||
|
||||
|
||||
BENCHMARK_IMPL(million_async) {
|
||||
char fmtbuf[3][32];
|
||||
uv_timer_t timer_handle;
|
||||
uv_async_t* handle;
|
||||
uv_loop_t* loop;
|
||||
@ -101,12 +102,12 @@ BENCHMARK_IMPL(million_async) {
|
||||
ASSERT(0 == uv_thread_create(&thread_id, thread_cb, NULL));
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
printf("%s async events in %.1f seconds (%s/s, %s unique handles seen)\n",
|
||||
fmt(container->async_events),
|
||||
fmt(&fmtbuf[0], container->async_events),
|
||||
timeout / 1000.,
|
||||
fmt(container->async_events / (timeout / 1000.)),
|
||||
fmt(container->handles_seen));
|
||||
fmt(&fmtbuf[1], container->async_events / (timeout / 1000.)),
|
||||
fmt(&fmtbuf[2], container->handles_seen));
|
||||
free(container);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/benchmark-million-timers.c
vendored
2
deps/libuv/test/benchmark-million-timers.c
vendored
@ -81,6 +81,6 @@ BENCHMARK_IMPL(million_timers) {
|
||||
fprintf(stderr, "%.2f seconds cleanup\n", (after_all - after_run) / 1e9);
|
||||
fflush(stderr);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/benchmark-multi-accept.c
vendored
2
deps/libuv/test/benchmark-multi-accept.c
vendored
@ -431,7 +431,7 @@ static int test_tcp(unsigned int num_servers, unsigned int num_clients) {
|
||||
free(clients);
|
||||
free(servers);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
deps/libuv/test/benchmark-ping-pongs.c
vendored
2
deps/libuv/test/benchmark-ping-pongs.c
vendored
@ -216,6 +216,6 @@ BENCHMARK_IMPL(ping_pongs) {
|
||||
|
||||
ASSERT(completed_pingers == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/benchmark-ping-udp.c
vendored
2
deps/libuv/test/benchmark-ping-udp.c
vendored
@ -153,7 +153,7 @@ static int ping_udp(unsigned pingers) {
|
||||
fprintf(stderr, "ping_pongs: %d pingers, ~ %lu roundtrips/s\n",
|
||||
completed_pingers, completed_pings / (TIME/1000));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
deps/libuv/test/benchmark-pound.c
vendored
2
deps/libuv/test/benchmark-pound.c
vendored
@ -306,7 +306,7 @@ static int pound_it(int concurrency,
|
||||
conns_failed);
|
||||
fflush(stderr);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
6
deps/libuv/test/benchmark-pump.c
vendored
6
deps/libuv/test/benchmark-pump.c
vendored
@ -415,7 +415,7 @@ HELPER_IMPL(pipe_pump_server) {
|
||||
notify_parent_process();
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -434,7 +434,7 @@ static void tcp_pump(int n) {
|
||||
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
}
|
||||
|
||||
|
||||
@ -450,7 +450,7 @@ static void pipe_pump(int n) {
|
||||
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
}
|
||||
|
||||
|
||||
|
9
deps/libuv/test/benchmark-queue-work.c
vendored
9
deps/libuv/test/benchmark-queue-work.c
vendored
@ -46,6 +46,7 @@ static void after_work_cb(uv_work_t* req, int status) {
|
||||
static void timer_cb(uv_timer_t* handle) { done = 1; }
|
||||
|
||||
BENCHMARK_IMPL(queue_work) {
|
||||
char fmtbuf[2][32];
|
||||
uv_timer_t timer_handle;
|
||||
uv_work_t work;
|
||||
uv_loop_t* loop;
|
||||
@ -60,9 +61,11 @@ BENCHMARK_IMPL(queue_work) {
|
||||
ASSERT_EQ(0, uv_queue_work(loop, &work, work_cb, after_work_cb));
|
||||
ASSERT_EQ(0, uv_run(loop, UV_RUN_DEFAULT));
|
||||
|
||||
printf("%s async jobs in %.1f seconds (%s/s)\n", fmt(events), timeout / 1000.,
|
||||
fmt(events / (timeout / 1000.)));
|
||||
printf("%s async jobs in %.1f seconds (%s/s)\n",
|
||||
fmt(&fmtbuf[0], events),
|
||||
timeout / 1000.,
|
||||
fmt(&fmtbuf[1], events / (timeout / 1000.)));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/benchmark-spawn.c
vendored
2
deps/libuv/test/benchmark-spawn.c
vendored
@ -159,6 +159,6 @@ BENCHMARK_IMPL(spawn) {
|
||||
(double) N / (double) (end_time - start_time) * 1000.0);
|
||||
fflush(stderr);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/benchmark-tcp-write-batch.c
vendored
2
deps/libuv/test/benchmark-tcp-write-batch.c
vendored
@ -139,6 +139,6 @@ BENCHMARK_IMPL(tcp_write_batch) {
|
||||
(long)NUM_WRITE_REQS,
|
||||
(stop - start) / 1e9);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/benchmark-udp-pummel.c
vendored
2
deps/libuv/test/benchmark-udp-pummel.c
vendored
@ -215,7 +215,7 @@ static int pummel(unsigned int n_senders,
|
||||
send_cb_called,
|
||||
duration / 1000.0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
0
deps/libuv/test/fixtures/one_file/one_file
vendored
Normal file
0
deps/libuv/test/fixtures/one_file/one_file
vendored
Normal file
4
deps/libuv/test/run-tests.c
vendored
4
deps/libuv/test/run-tests.c
vendored
@ -85,10 +85,6 @@ int main(int argc, char **argv) {
|
||||
fflush(stderr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#ifndef __SUNPRO_C
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
1
deps/libuv/test/runner-unix.c
vendored
1
deps/libuv/test/runner-unix.c
vendored
@ -344,6 +344,7 @@ long int process_output_size(process_info_t *p) {
|
||||
/* Size of the p->stdout_file */
|
||||
struct stat buf;
|
||||
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
int r = fstat(fileno(p->stdout_file), &buf);
|
||||
if (r < 0) {
|
||||
return -1;
|
||||
|
30
deps/libuv/test/runner.c
vendored
30
deps/libuv/test/runner.c
vendored
@ -37,28 +37,14 @@ static int compare_task(const void* va, const void* vb) {
|
||||
}
|
||||
|
||||
|
||||
const char* fmt(double d) {
|
||||
static char buf[1024];
|
||||
static char* p;
|
||||
char* fmt(char (*buf)[32], double d) {
|
||||
uint64_t v;
|
||||
char* p;
|
||||
|
||||
if (p == NULL)
|
||||
p = buf;
|
||||
|
||||
p += 31;
|
||||
|
||||
if (p >= buf + sizeof(buf))
|
||||
return "<buffer too small>";
|
||||
|
||||
p = &(*buf)[32];
|
||||
v = (uint64_t) d;
|
||||
|
||||
#if 0 /* works but we don't care about fractional precision */
|
||||
if (d - v >= 0.01) {
|
||||
*--p = '0' + (uint64_t) (d * 100) % 10;
|
||||
*--p = '0' + (uint64_t) (d * 10) % 10;
|
||||
*--p = '.';
|
||||
}
|
||||
#endif
|
||||
*--p = '\0';
|
||||
|
||||
if (v == 0)
|
||||
*--p = '0';
|
||||
@ -77,9 +63,7 @@ const char* fmt(double d) {
|
||||
int run_tests(int benchmark_output) {
|
||||
int actual;
|
||||
int total;
|
||||
int passed;
|
||||
int failed;
|
||||
int skipped;
|
||||
int current;
|
||||
int test_result;
|
||||
int skip;
|
||||
@ -102,9 +86,7 @@ int run_tests(int benchmark_output) {
|
||||
fflush(stdout);
|
||||
|
||||
/* Run all tests. */
|
||||
passed = 0;
|
||||
failed = 0;
|
||||
skipped = 0;
|
||||
current = 1;
|
||||
for (task = TASKS; task->main; task++) {
|
||||
if (task->is_helper) {
|
||||
@ -113,8 +95,8 @@ int run_tests(int benchmark_output) {
|
||||
|
||||
test_result = run_test(task->task_name, benchmark_output, current);
|
||||
switch (test_result) {
|
||||
case TEST_OK: passed++; break;
|
||||
case TEST_SKIP: skipped++; break;
|
||||
case TEST_OK: break;
|
||||
case TEST_SKIP: break;
|
||||
default: failed++;
|
||||
}
|
||||
current++;
|
||||
|
35
deps/libuv/test/task.h
vendored
35
deps/libuv/test/task.h
vendored
@ -29,12 +29,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
# include "uv/stdint-msvc2008.h"
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
# include <sys/time.h>
|
||||
@ -55,9 +50,9 @@
|
||||
#define TEST_PORT_3 9125
|
||||
|
||||
#ifdef _WIN32
|
||||
# define TEST_PIPENAME "\\\\?\\pipe\\uv-test"
|
||||
# define TEST_PIPENAME_2 "\\\\?\\pipe\\uv-test2"
|
||||
# define TEST_PIPENAME_3 "\\\\?\\pipe\\uv-test3"
|
||||
# define TEST_PIPENAME "\\\\.\\pipe\\uv-test"
|
||||
# define TEST_PIPENAME_2 "\\\\.\\pipe\\uv-test2"
|
||||
# define TEST_PIPENAME_3 "\\\\.\\pipe\\uv-test3"
|
||||
#else
|
||||
# define TEST_PIPENAME "/tmp/uv-test-sock"
|
||||
# define TEST_PIPENAME_2 "/tmp/uv-test-sock2"
|
||||
@ -203,6 +198,7 @@ typedef enum {
|
||||
#define ASSERT_LE(a, b) ASSERT_BASE(a, <=, b, int64_t, PRId64)
|
||||
#define ASSERT_LT(a, b) ASSERT_BASE(a, <, b, int64_t, PRId64)
|
||||
#define ASSERT_NE(a, b) ASSERT_BASE(a, !=, b, int64_t, PRId64)
|
||||
#define ASSERT_OK(a) ASSERT_BASE(a, ==, 0, int64_t, PRId64)
|
||||
|
||||
#define ASSERT_UINT64_EQ(a, b) ASSERT_BASE(a, ==, b, uint64_t, PRIu64)
|
||||
#define ASSERT_UINT64_GE(a, b) ASSERT_BASE(a, >=, b, uint64_t, PRIu64)
|
||||
@ -248,13 +244,13 @@ typedef enum {
|
||||
#define ASSERT_PTR_NE(a, b) \
|
||||
ASSERT_BASE(a, !=, b, void*, "p")
|
||||
|
||||
/* This macro cleans up the main loop. This is used to avoid valgrind
|
||||
* warnings about memory being "leaked" by the main event loop.
|
||||
/* This macro cleans up the event loop. This is used to avoid valgrind
|
||||
* warnings about memory being "leaked" by the event loop.
|
||||
*/
|
||||
#define MAKE_VALGRIND_HAPPY() \
|
||||
#define MAKE_VALGRIND_HAPPY(loop) \
|
||||
do { \
|
||||
close_loop(uv_default_loop()); \
|
||||
ASSERT(0 == uv_loop_close(uv_default_loop())); \
|
||||
close_loop(loop); \
|
||||
ASSERT(0 == uv_loop_close(loop)); \
|
||||
uv_library_shutdown(); \
|
||||
} while (0)
|
||||
|
||||
@ -271,8 +267,8 @@ typedef enum {
|
||||
int run_helper_##name(void); \
|
||||
int run_helper_##name(void)
|
||||
|
||||
/* Format big numbers nicely. WARNING: leaks memory. */
|
||||
const char* fmt(double d);
|
||||
/* Format big numbers nicely. */
|
||||
char* fmt(char (*buf)[32], double d);
|
||||
|
||||
/* Reserved test exit codes. */
|
||||
enum test_status {
|
||||
@ -375,4 +371,11 @@ UNUSED static int can_ipv6(void) {
|
||||
"Cygwin runtime hangs on listen+connect in same process."
|
||||
#endif
|
||||
|
||||
#if !defined(__linux__) && \
|
||||
!(defined(__FreeBSD__) && __FreeBSD_version >= 1301000) && \
|
||||
!defined(_WIN32)
|
||||
# define NO_CPU_AFFINITY \
|
||||
"affinity not supported on this platform."
|
||||
#endif
|
||||
|
||||
#endif /* TASK_H_ */
|
||||
|
2
deps/libuv/test/test-active.c
vendored
2
deps/libuv/test/test-active.c
vendored
@ -79,6 +79,6 @@ TEST_IMPL(active) {
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-async-null-cb.c
vendored
2
deps/libuv/test/test-async-null-cb.c
vendored
@ -59,6 +59,6 @@ TEST_IMPL(async_null_cb) {
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
ASSERT(0 == uv_thread_join(&thread));
|
||||
ASSERT(1 == check_cb_called);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-async.c
vendored
2
deps/libuv/test/test-async.c
vendored
@ -129,6 +129,6 @@ TEST_IMPL(async) {
|
||||
|
||||
ASSERT(0 == uv_thread_join(&thread));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
58
deps/libuv/test/test-barrier.c
vendored
58
deps/libuv/test/test-barrier.c
vendored
@ -27,20 +27,22 @@
|
||||
|
||||
typedef struct {
|
||||
uv_barrier_t barrier;
|
||||
int delay;
|
||||
volatile int posted;
|
||||
int main_barrier_wait_rval;
|
||||
int worker_barrier_wait_rval;
|
||||
unsigned delay;
|
||||
unsigned niter;
|
||||
unsigned main_barrier_wait_rval;
|
||||
unsigned worker_barrier_wait_rval;
|
||||
} worker_config;
|
||||
|
||||
|
||||
static void worker(void* arg) {
|
||||
worker_config* c = arg;
|
||||
unsigned i;
|
||||
|
||||
if (c->delay)
|
||||
uv_sleep(c->delay);
|
||||
|
||||
c->worker_barrier_wait_rval = uv_barrier_wait(&c->barrier);
|
||||
for (i = 0; i < c->niter; i++)
|
||||
c->worker_barrier_wait_rval += uv_barrier_wait(&c->barrier);
|
||||
}
|
||||
|
||||
|
||||
@ -49,17 +51,18 @@ TEST_IMPL(barrier_1) {
|
||||
worker_config wc;
|
||||
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.niter = 1;
|
||||
|
||||
ASSERT(0 == uv_barrier_init(&wc.barrier, 2));
|
||||
ASSERT(0 == uv_thread_create(&thread, worker, &wc));
|
||||
ASSERT_EQ(0, uv_barrier_init(&wc.barrier, 2));
|
||||
ASSERT_EQ(0, uv_thread_create(&thread, worker, &wc));
|
||||
|
||||
uv_sleep(100);
|
||||
wc.main_barrier_wait_rval = uv_barrier_wait(&wc.barrier);
|
||||
|
||||
ASSERT(0 == uv_thread_join(&thread));
|
||||
ASSERT_EQ(0, uv_thread_join(&thread));
|
||||
uv_barrier_destroy(&wc.barrier);
|
||||
|
||||
ASSERT(1 == (wc.main_barrier_wait_rval ^ wc.worker_barrier_wait_rval));
|
||||
ASSERT_EQ(1, (wc.main_barrier_wait_rval ^ wc.worker_barrier_wait_rval));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -71,16 +74,17 @@ TEST_IMPL(barrier_2) {
|
||||
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.delay = 100;
|
||||
wc.niter = 1;
|
||||
|
||||
ASSERT(0 == uv_barrier_init(&wc.barrier, 2));
|
||||
ASSERT(0 == uv_thread_create(&thread, worker, &wc));
|
||||
ASSERT_EQ(0, uv_barrier_init(&wc.barrier, 2));
|
||||
ASSERT_EQ(0, uv_thread_create(&thread, worker, &wc));
|
||||
|
||||
wc.main_barrier_wait_rval = uv_barrier_wait(&wc.barrier);
|
||||
|
||||
ASSERT(0 == uv_thread_join(&thread));
|
||||
ASSERT_EQ(0, uv_thread_join(&thread));
|
||||
uv_barrier_destroy(&wc.barrier);
|
||||
|
||||
ASSERT(1 == (wc.main_barrier_wait_rval ^ wc.worker_barrier_wait_rval));
|
||||
ASSERT_EQ(1, (wc.main_barrier_wait_rval ^ wc.worker_barrier_wait_rval));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -89,26 +93,32 @@ TEST_IMPL(barrier_2) {
|
||||
TEST_IMPL(barrier_3) {
|
||||
uv_thread_t thread;
|
||||
worker_config wc;
|
||||
unsigned i;
|
||||
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.niter = 5;
|
||||
|
||||
ASSERT(0 == uv_barrier_init(&wc.barrier, 2));
|
||||
ASSERT(0 == uv_thread_create(&thread, worker, &wc));
|
||||
ASSERT_EQ(0, uv_barrier_init(&wc.barrier, 2));
|
||||
ASSERT_EQ(0, uv_thread_create(&thread, worker, &wc));
|
||||
|
||||
wc.main_barrier_wait_rval = uv_barrier_wait(&wc.barrier);
|
||||
for (i = 0; i < wc.niter; i++)
|
||||
wc.main_barrier_wait_rval += uv_barrier_wait(&wc.barrier);
|
||||
|
||||
ASSERT(0 == uv_thread_join(&thread));
|
||||
ASSERT_EQ(0, uv_thread_join(&thread));
|
||||
uv_barrier_destroy(&wc.barrier);
|
||||
|
||||
ASSERT(1 == (wc.main_barrier_wait_rval ^ wc.worker_barrier_wait_rval));
|
||||
ASSERT_EQ(wc.niter, wc.main_barrier_wait_rval + wc.worker_barrier_wait_rval);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void serial_worker(void* data) {
|
||||
uv_barrier_t* barrier;
|
||||
unsigned i;
|
||||
|
||||
barrier = data;
|
||||
for (i = 0; i < 5; i++)
|
||||
uv_barrier_wait(barrier);
|
||||
if (uv_barrier_wait(barrier) > 0)
|
||||
uv_barrier_destroy(barrier);
|
||||
|
||||
@ -123,16 +133,18 @@ TEST_IMPL(barrier_serial_thread) {
|
||||
uv_barrier_t barrier;
|
||||
unsigned i;
|
||||
|
||||
ASSERT(0 == uv_barrier_init(&barrier, ARRAY_SIZE(threads) + 1));
|
||||
ASSERT_EQ(0, uv_barrier_init(&barrier, ARRAY_SIZE(threads) + 1));
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(threads); ++i)
|
||||
ASSERT(0 == uv_thread_create(&threads[i], serial_worker, &barrier));
|
||||
ASSERT_EQ(0, uv_thread_create(&threads[i], serial_worker, &barrier));
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
uv_barrier_wait(&barrier);
|
||||
if (uv_barrier_wait(&barrier) > 0)
|
||||
uv_barrier_destroy(&barrier);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(threads); ++i)
|
||||
ASSERT(0 == uv_thread_join(&threads[i]));
|
||||
ASSERT_EQ(0, uv_thread_join(&threads[i]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -141,8 +153,8 @@ TEST_IMPL(barrier_serial_thread) {
|
||||
TEST_IMPL(barrier_serial_thread_single) {
|
||||
uv_barrier_t barrier;
|
||||
|
||||
ASSERT(0 == uv_barrier_init(&barrier, 1));
|
||||
ASSERT(0 < uv_barrier_wait(&barrier));
|
||||
ASSERT_EQ(0, uv_barrier_init(&barrier, 1));
|
||||
ASSERT_LT(0, uv_barrier_wait(&barrier));
|
||||
uv_barrier_destroy(&barrier);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-callback-stack.c
vendored
2
deps/libuv/test/test-callback-stack.c
vendored
@ -199,6 +199,6 @@ TEST_IMPL(callback_stack) {
|
||||
ASSERT(shutdown_cb_called == 1 && "shutdown_cb must be called exactly once");
|
||||
ASSERT(close_cb_called == 2 && "close_cb must be called exactly twice");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-close-fd.c
vendored
2
deps/libuv/test/test-close-fd.c
vendored
@ -79,6 +79,6 @@ TEST_IMPL(close_fd) {
|
||||
ASSERT(2 == read_cb_called);
|
||||
ASSERT(0 != uv_is_closing((const uv_handle_t *) &pipe_handle));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-close-order.c
vendored
2
deps/libuv/test/test-close-order.c
vendored
@ -75,6 +75,6 @@ TEST_IMPL(close_order) {
|
||||
ASSERT(close_cb_called == 3);
|
||||
ASSERT(timer_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
23
deps/libuv/test/test-condvar.c
vendored
23
deps/libuv/test/test-condvar.c
vendored
@ -228,11 +228,6 @@ TEST_IMPL(condvar_4) {
|
||||
/* uv_cond_timedwait: One thread waits, no signal. Timeout should be delivered. */
|
||||
TEST_IMPL(condvar_5) {
|
||||
worker_config wc;
|
||||
int r;
|
||||
/* ns */
|
||||
uint64_t before;
|
||||
uint64_t after;
|
||||
uint64_t elapsed;
|
||||
uint64_t timeout;
|
||||
|
||||
timeout = 100 * 1000 * 1000; /* 100 ms in ns */
|
||||
@ -242,25 +237,11 @@ TEST_IMPL(condvar_5) {
|
||||
|
||||
uv_mutex_lock(&wc.mutex);
|
||||
|
||||
/* We wait.
|
||||
* No signaler, so this will only return if timeout is delivered. */
|
||||
before = uv_hrtime();
|
||||
r = uv_cond_timedwait(&wc.cond, &wc.mutex, timeout);
|
||||
after = uv_hrtime();
|
||||
/* We wait. No signaler, so this will only return if timeout is delivered. */
|
||||
ASSERT_EQ(UV_ETIMEDOUT, uv_cond_timedwait(&wc.cond, &wc.mutex, timeout));
|
||||
|
||||
uv_mutex_unlock(&wc.mutex);
|
||||
|
||||
/* It timed out. */
|
||||
ASSERT(r == UV_ETIMEDOUT);
|
||||
|
||||
/* It must have taken at least timeout, modulo system timer ticks.
|
||||
* But it should not take too much longer.
|
||||
* cf. MSDN docs:
|
||||
* https://msdn.microsoft.com/en-us/library/ms687069(VS.85).aspx */
|
||||
elapsed = after - before;
|
||||
ASSERT(0.75 * timeout <= elapsed); /* 1.0 too large for Windows. */
|
||||
ASSERT(elapsed <= 5.0 * timeout); /* MacOS has reported failures up to 1.75. */
|
||||
|
||||
worker_config_destroy(&wc);
|
||||
|
||||
return 0;
|
||||
|
1
deps/libuv/test/test-connect-unspecified.c
vendored
1
deps/libuv/test/test-connect-unspecified.c
vendored
@ -59,5 +59,6 @@ TEST_IMPL(connect_unspecified) {
|
||||
|
||||
ASSERT(uv_run(loop, UV_RUN_DEFAULT) == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-connection-fail.c
vendored
4
deps/libuv/test/test-connection-fail.c
vendored
@ -130,7 +130,7 @@ TEST_IMPL(connection_fail) {
|
||||
ASSERT(timer_close_cb_calls == 0);
|
||||
ASSERT(timer_cb_calls == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -156,6 +156,6 @@ TEST_IMPL(connection_fail_doesnt_auto_close) {
|
||||
ASSERT(timer_close_cb_calls == 1);
|
||||
ASSERT(timer_cb_calls == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
3
deps/libuv/test/test-default-loop-close.c
vendored
3
deps/libuv/test/test-default-loop-close.c
vendored
@ -52,8 +52,7 @@ TEST_IMPL(default_loop_close) {
|
||||
ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 1, 0));
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
ASSERT(2 == timer_cb_called);
|
||||
ASSERT(0 == uv_loop_close(loop));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-delayed-accept.c
vendored
2
deps/libuv/test/test-delayed-accept.c
vendored
@ -184,6 +184,6 @@ TEST_IMPL(delayed_accept) {
|
||||
ASSERT(connect_cb_called == 2);
|
||||
ASSERT(close_cb_called == 7);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
8
deps/libuv/test/test-dlerror.c
vendored
8
deps/libuv/test/test-dlerror.c
vendored
@ -43,7 +43,9 @@ TEST_IMPL(dlerror) {
|
||||
msg = uv_dlerror(&lib);
|
||||
ASSERT_NOT_NULL(msg);
|
||||
#if !defined(__OpenBSD__) && !defined(__QNX__)
|
||||
ASSERT_NOT_NULL(strstr(msg, path));
|
||||
/* musl's libc.a does not support dlopen(), only libc.so does. */
|
||||
if (NULL == strstr(msg, "Dynamic loading not supported"))
|
||||
ASSERT_NOT_NULL(strstr(msg, path));
|
||||
#endif
|
||||
ASSERT_NULL(strstr(msg, dlerror_no_error));
|
||||
|
||||
@ -51,7 +53,9 @@ TEST_IMPL(dlerror) {
|
||||
msg = uv_dlerror(&lib);
|
||||
ASSERT_NOT_NULL(msg);
|
||||
#if !defined(__OpenBSD__) && !defined(__QNX__)
|
||||
ASSERT_NOT_NULL(strstr(msg, path));
|
||||
/* musl's libc.a does not support dlopen(), only libc.so does. */
|
||||
if (NULL == strstr(msg, "Dynamic loading not supported"))
|
||||
ASSERT_NOT_NULL(strstr(msg, path));
|
||||
#endif
|
||||
ASSERT_NULL(strstr(msg, dlerror_no_error));
|
||||
|
||||
|
4
deps/libuv/test/test-eintr-handling.c
vendored
4
deps/libuv/test/test-eintr-handling.c
vendored
@ -87,7 +87,9 @@ TEST_IMPL(eintr_handling) {
|
||||
ASSERT(0 == close(pipe_fds[1]));
|
||||
uv_close((uv_handle_t*) &signal, NULL);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
ASSERT_EQ(0, uv_thread_join(&thread));
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
deps/libuv/test/test-embed.c
vendored
2
deps/libuv/test/test-embed.c
vendored
@ -74,6 +74,6 @@ TEST_IMPL(embed) {
|
||||
ASSERT_EQ(0, uv_thread_join(&thread));
|
||||
uv_barrier_destroy(&barrier);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-emfile.c
vendored
2
deps/libuv/test/test-emfile.c
vendored
@ -94,7 +94,7 @@ TEST_IMPL(emfile) {
|
||||
first_fd += 1;
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
5
deps/libuv/test/test-env-vars.c
vendored
5
deps/libuv/test/test-env-vars.c
vendored
@ -131,7 +131,10 @@ TEST_IMPL(env_vars) {
|
||||
|
||||
ASSERT(found == 2);
|
||||
#ifdef _WIN32
|
||||
ASSERT(found_win_special > 0);
|
||||
ASSERT_GT(found_win_special, 0);
|
||||
#else
|
||||
/* There's no rule saying a key can't start with '='. */
|
||||
(void) &found_win_special;
|
||||
#endif
|
||||
|
||||
uv_os_free_environ(envitems, envcount);
|
||||
|
29
deps/libuv/test/test-fork.c
vendored
29
deps/libuv/test/test-fork.c
vendored
@ -59,17 +59,18 @@ static void socket_cb(uv_poll_t* poll, int status, int events) {
|
||||
|
||||
|
||||
static void run_timer_loop_once(void) {
|
||||
uv_loop_t* loop;
|
||||
uv_loop_t loop;
|
||||
uv_timer_t timer_handle;
|
||||
|
||||
loop = uv_default_loop();
|
||||
ASSERT_EQ(0, uv_loop_init(&loop));
|
||||
|
||||
timer_cb_called = 0; /* Reset for the child. */
|
||||
|
||||
ASSERT(0 == uv_timer_init(loop, &timer_handle));
|
||||
ASSERT(0 == uv_timer_init(&loop, &timer_handle));
|
||||
ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 1, 0));
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT));
|
||||
ASSERT(1 == timer_cb_called);
|
||||
ASSERT_EQ(0, uv_loop_close(&loop));
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +112,7 @@ TEST_IMPL(fork_timer) {
|
||||
run_timer_loop_once();
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -148,7 +149,7 @@ TEST_IMPL(fork_socketpair) {
|
||||
ASSERT(1 == socket_cb_called);
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -212,7 +213,7 @@ TEST_IMPL(fork_socketpair_started) {
|
||||
ASSERT(0 == strcmp("hi\n", socket_cb_read_buf));
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -269,7 +270,7 @@ TEST_IMPL(fork_signal_to_child) {
|
||||
ASSERT(SIGUSR1 == fork_signal_cb_called);
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -342,7 +343,7 @@ TEST_IMPL(fork_signal_to_child_closed) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -500,7 +501,7 @@ static int _do_fork_fs_events_child(int file_or_dir) {
|
||||
printf("Exiting child \n");
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -597,7 +598,7 @@ TEST_IMPL(fork_fs_events_file_parent_child) {
|
||||
}
|
||||
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@ -646,6 +647,10 @@ TEST_IMPL(fork_threadpool_queue_work_simple) {
|
||||
pid_t child_pid;
|
||||
uv_loop_t loop;
|
||||
|
||||
#ifdef __TSAN__
|
||||
RETURN_SKIP("ThreadSanitizer doesn't support multi-threaded fork");
|
||||
#endif
|
||||
|
||||
/* Prime the pool and default loop. */
|
||||
assert_run_work(uv_default_loop());
|
||||
|
||||
@ -671,7 +676,7 @@ TEST_IMPL(fork_threadpool_queue_work_simple) {
|
||||
}
|
||||
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
#endif /* !__MVS__ */
|
||||
|
10
deps/libuv/test/test-fs-copyfile.c
vendored
10
deps/libuv/test/test-fs-copyfile.c
vendored
@ -151,14 +151,18 @@ TEST_IMPL(fs_copyfile) {
|
||||
handle_result(&req);
|
||||
|
||||
/* Fails to overwrites existing file. */
|
||||
ASSERT_EQ(uv_fs_chmod(NULL, &req, dst, 0644, NULL), 0);
|
||||
uv_fs_req_cleanup(&req);
|
||||
r = uv_fs_copyfile(NULL, &req, fixture, dst, UV_FS_COPYFILE_EXCL, NULL);
|
||||
ASSERT(r == UV_EEXIST);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
/* Truncates when an existing destination is larger than the source file. */
|
||||
ASSERT_EQ(uv_fs_chmod(NULL, &req, dst, 0644, NULL), 0);
|
||||
uv_fs_req_cleanup(&req);
|
||||
touch_file(src, 1);
|
||||
r = uv_fs_copyfile(NULL, &req, src, dst, 0, NULL);
|
||||
ASSERT(r == 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
handle_result(&req);
|
||||
|
||||
/* Copies a larger file. */
|
||||
@ -176,6 +180,9 @@ TEST_IMPL(fs_copyfile) {
|
||||
ASSERT(result_check_count == 5);
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(result_check_count == 6);
|
||||
/* Ensure file is user-writable (not copied from src). */
|
||||
ASSERT_EQ(uv_fs_chmod(NULL, &req, dst, 0644, NULL), 0);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
/* If the flags are invalid, the loop should not be kept open */
|
||||
unlink(dst);
|
||||
@ -213,5 +220,6 @@ TEST_IMPL(fs_copyfile) {
|
||||
#endif
|
||||
|
||||
unlink(dst); /* Cleanup */
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
59
deps/libuv/test/test-fs-event.c
vendored
59
deps/libuv/test/test-fs-event.c
vendored
@ -33,19 +33,12 @@
|
||||
# if defined(__APPLE__) || \
|
||||
defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NetBSD__)
|
||||
# define HAVE_KQUEUE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)/* Increase the timeout so the test passes on arm CI bots */
|
||||
# define CREATE_TIMEOUT 100
|
||||
#else
|
||||
# define CREATE_TIMEOUT 1
|
||||
#endif
|
||||
|
||||
static uv_fs_event_t fs_event;
|
||||
static const char file_prefix[] = "fsevent-";
|
||||
static const int fs_event_file_count = 16;
|
||||
@ -163,10 +156,7 @@ static void fs_event_create_files(uv_timer_t* handle) {
|
||||
if (++fs_event_created < fs_event_file_count) {
|
||||
/* Create another file on a different event loop tick. We do it this way
|
||||
* to avoid fs events coalescing into one fs event. */
|
||||
ASSERT(0 == uv_timer_start(&timer,
|
||||
fs_event_create_files,
|
||||
CREATE_TIMEOUT,
|
||||
0));
|
||||
ASSERT_EQ(0, uv_timer_start(&timer, fs_event_create_files, 100, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,7 +232,8 @@ static void fs_event_create_files_in_subdir(uv_timer_t* handle) {
|
||||
if (++fs_event_created < fs_event_file_count) {
|
||||
/* Create another file on a different event loop tick. We do it this way
|
||||
* to avoid fs events coalescing into one fs event. */
|
||||
ASSERT(0 == uv_timer_start(&timer, fs_event_create_files_in_subdir, 1, 0));
|
||||
ASSERT_EQ(0,
|
||||
uv_timer_start(&timer, fs_event_create_files_in_subdir, 100, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,7 +432,7 @@ TEST_IMPL(fs_event_watch_dir) {
|
||||
remove("watch_dir/file1");
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -503,7 +494,7 @@ TEST_IMPL(fs_event_watch_dir_recursive) {
|
||||
remove("watch_dir/subdir");
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
#else
|
||||
RETURN_SKIP("Recursive directory watching not supported on this platform.");
|
||||
@ -550,7 +541,7 @@ TEST_IMPL(fs_event_watch_dir_short_path) {
|
||||
remove("watch_dir/file1");
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
|
||||
if (!has_shortnames)
|
||||
RETURN_SKIP("Was not able to address files with 8.3 short name.");
|
||||
@ -596,7 +587,7 @@ TEST_IMPL(fs_event_watch_file) {
|
||||
remove("watch_dir/file1");
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -623,7 +614,7 @@ TEST_IMPL(fs_event_watch_file_exact_path) {
|
||||
create_file("watch_dir/file.js");
|
||||
create_file("watch_dir/file.jsx");
|
||||
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_12)
|
||||
/* Empirically, FSEvents seems to (reliably) report the preceeding
|
||||
/* Empirically, FSEvents seems to (reliably) report the preceding
|
||||
* create_file events prior to macOS 10.11.6 in the subsequent fs_watch
|
||||
* creation, but that behavior hasn't been observed to occur on newer
|
||||
* versions. Give a long delay here to let the system settle before running
|
||||
@ -649,7 +640,7 @@ TEST_IMPL(fs_event_watch_file_exact_path) {
|
||||
remove("watch_dir/file.jsx");
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -673,7 +664,7 @@ TEST_IMPL(fs_event_watch_file_twice) {
|
||||
ASSERT(0 == uv_timer_start(&timer, timer_cb_watch_twice, 10, 0));
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -691,7 +682,7 @@ TEST_IMPL(fs_event_watch_file_current_dir) {
|
||||
remove("watch_file");
|
||||
create_file("watch_file");
|
||||
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_12)
|
||||
/* Empirically, kevent seems to (sometimes) report the preceeding
|
||||
/* Empirically, kevent seems to (sometimes) report the preceding
|
||||
* create_file events prior to macOS 10.11.6 in the subsequent fs_event_start
|
||||
* So let the system settle before running the test. */
|
||||
uv_sleep(1100);
|
||||
@ -728,7 +719,7 @@ TEST_IMPL(fs_event_watch_file_current_dir) {
|
||||
/* Cleanup */
|
||||
remove("watch_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -754,7 +745,7 @@ TEST_IMPL(fs_event_watch_file_root_dir) {
|
||||
|
||||
uv_close((uv_handle_t*) &fs_event, NULL);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -793,7 +784,7 @@ TEST_IMPL(fs_event_no_callback_after_close) {
|
||||
remove("watch_dir/file1");
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -830,7 +821,7 @@ TEST_IMPL(fs_event_no_callback_on_close) {
|
||||
remove("watch_dir/file1");
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -868,7 +859,7 @@ TEST_IMPL(fs_event_immediate_close) {
|
||||
|
||||
ASSERT(close_cb_called == 2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -903,7 +894,7 @@ TEST_IMPL(fs_event_close_with_pending_event) {
|
||||
remove("watch_dir/file");
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -941,7 +932,7 @@ TEST_IMPL(fs_event_close_with_pending_delete_event) {
|
||||
/* Clean up */
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -982,7 +973,7 @@ TEST_IMPL(fs_event_close_in_callback) {
|
||||
fs_event_unlink_files(NULL);
|
||||
remove("watch_dir/");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1017,7 +1008,7 @@ TEST_IMPL(fs_event_start_and_close) {
|
||||
ASSERT(close_cb_called == 2);
|
||||
|
||||
remove("watch_dir/");
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1070,7 +1061,7 @@ TEST_IMPL(fs_event_getpath) {
|
||||
}
|
||||
|
||||
remove("watch_dir/");
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1159,7 +1150,7 @@ TEST_IMPL(fs_event_error_reporting) {
|
||||
} while (i-- != 0);
|
||||
|
||||
remove("watch_dir/");
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1168,7 +1159,7 @@ TEST_IMPL(fs_event_error_reporting) {
|
||||
TEST_IMPL(fs_event_error_reporting) {
|
||||
/* No-op, needed only for FSEvents backend */
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1191,7 +1182,7 @@ TEST_IMPL(fs_event_watch_invalid_path) {
|
||||
r = uv_fs_event_start(&fs_event, fs_event_cb_file, "", 0);
|
||||
ASSERT(r != 0);
|
||||
ASSERT(uv_is_active((uv_handle_t*) &fs_event) == 0);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1237,6 +1228,6 @@ TEST_IMPL(fs_event_stop_in_cb) {
|
||||
|
||||
remove(path);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-fs-open-flags.c
vendored
2
deps/libuv/test/test-fs-open-flags.c
vendored
@ -424,7 +424,7 @@ TEST_IMPL(fs_open_flags) {
|
||||
/* Cleanup. */
|
||||
rmdir(empty_dir);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
20
deps/libuv/test/test-fs-poll.c
vendored
20
deps/libuv/test/test-fs-poll.c
vendored
@ -164,7 +164,7 @@ TEST_IMPL(fs_poll) {
|
||||
ASSERT(timer_cb_called == 2);
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ TEST_IMPL(fs_poll_getpath) {
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -212,9 +212,7 @@ TEST_IMPL(fs_poll_close_request) {
|
||||
uv_run(&loop, UV_RUN_ONCE);
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
ASSERT(0 == uv_loop_close(&loop));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(&loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -238,9 +236,7 @@ TEST_IMPL(fs_poll_close_request_multi_start_stop) {
|
||||
uv_run(&loop, UV_RUN_ONCE);
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
ASSERT(0 == uv_loop_close(&loop));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(&loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -264,9 +260,7 @@ TEST_IMPL(fs_poll_close_request_multi_stop_start) {
|
||||
uv_run(&loop, UV_RUN_ONCE);
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
ASSERT(0 == uv_loop_close(&loop));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(&loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -293,8 +287,6 @@ TEST_IMPL(fs_poll_close_request_stop_when_active) {
|
||||
uv_run(&loop, UV_RUN_ONCE);
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
ASSERT(0 == uv_loop_close(&loop));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(&loop);
|
||||
return 0;
|
||||
}
|
||||
|
8
deps/libuv/test/test-fs-readdir.c
vendored
8
deps/libuv/test/test-fs-readdir.c
vendored
@ -156,7 +156,7 @@ TEST_IMPL(fs_readdir_empty_dir) {
|
||||
ASSERT(empty_closedir_cb_count == 1);
|
||||
uv_fs_rmdir(uv_default_loop(), &rmdir_req, path, NULL);
|
||||
uv_fs_req_cleanup(&rmdir_req);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ TEST_IMPL(fs_readdir_non_existing_dir) {
|
||||
ASSERT(r == 0);
|
||||
ASSERT(non_existing_opendir_cb_count == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ TEST_IMPL(fs_readdir_file) {
|
||||
r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
ASSERT(r == 0);
|
||||
ASSERT(file_opendir_cb_count == 1);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -457,6 +457,6 @@ TEST_IMPL(fs_readdir_non_empty_dir) {
|
||||
uv_fs_req_cleanup(&rmdir_req);
|
||||
|
||||
cleanup_test_files();
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
346
deps/libuv/test/test-fs.c
vendored
346
deps/libuv/test/test-fs.c
vendored
@ -37,6 +37,9 @@
|
||||
# ifndef ERROR_SYMLINK_NOT_SUPPORTED
|
||||
# define ERROR_SYMLINK_NOT_SUPPORTED 1464
|
||||
# endif
|
||||
# ifndef S_IFIFO
|
||||
# define S_IFIFO _S_IFIFO
|
||||
# endif
|
||||
# define unlink _unlink
|
||||
# define rmdir _rmdir
|
||||
# define open _open
|
||||
@ -219,16 +222,6 @@ static void realpath_cb(uv_fs_t* req) {
|
||||
char test_file_abs_buf[PATHMAX];
|
||||
size_t test_file_abs_size = sizeof(test_file_abs_buf);
|
||||
ASSERT(req->fs_type == UV_FS_REALPATH);
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
|
||||
*/
|
||||
if (req->result == UV_ENOSYS) {
|
||||
realpath_cb_count++;
|
||||
uv_fs_req_cleanup(req);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
ASSERT(req->result == 0);
|
||||
|
||||
uv_cwd(test_file_abs_buf, &test_file_abs_size);
|
||||
@ -669,6 +662,15 @@ static void stat_cb(uv_fs_t* req) {
|
||||
ASSERT(!req->ptr);
|
||||
}
|
||||
|
||||
static void stat_batch_cb(uv_fs_t* req) {
|
||||
ASSERT(req->fs_type == UV_FS_STAT || req->fs_type == UV_FS_LSTAT);
|
||||
ASSERT(req->result == 0);
|
||||
ASSERT(req->ptr);
|
||||
stat_cb_count++;
|
||||
uv_fs_req_cleanup(req);
|
||||
ASSERT(!req->ptr);
|
||||
}
|
||||
|
||||
|
||||
static void sendfile_cb(uv_fs_t* req) {
|
||||
ASSERT(req == &sendfile_req);
|
||||
@ -730,7 +732,7 @@ TEST_IMPL(fs_file_noent) {
|
||||
|
||||
/* TODO add EACCES test */
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -756,7 +758,7 @@ TEST_IMPL(fs_file_nametoolong) {
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(open_cb_count == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -770,11 +772,10 @@ TEST_IMPL(fs_file_loop) {
|
||||
r = uv_fs_symlink(NULL, &req, "test_symlink", "test_symlink", 0, NULL);
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Windows XP and Server 2003 don't support symlinks; we'll get UV_ENOTSUP.
|
||||
* Starting with vista they are supported, but only when elevated, otherwise
|
||||
* Symlinks are only suported but only when elevated, otherwise
|
||||
* we'll see UV_EPERM.
|
||||
*/
|
||||
if (r == UV_ENOTSUP || r == UV_EPERM)
|
||||
if (r == UV_EPERM)
|
||||
return 0;
|
||||
#elif defined(__MSYS__)
|
||||
/* MSYS2's approximation of symlinks with copies does not work for broken
|
||||
@ -799,7 +800,7 @@ TEST_IMPL(fs_file_loop) {
|
||||
|
||||
unlink("test_symlink");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -966,7 +967,7 @@ TEST_IMPL(fs_file_async) {
|
||||
unlink("test_file");
|
||||
unlink("test_file2");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1056,7 +1057,7 @@ TEST_IMPL(fs_file_sync) {
|
||||
fs_file_sync(0);
|
||||
fs_file_sync(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1092,7 +1093,7 @@ TEST_IMPL(fs_file_write_null_buffer) {
|
||||
fs_file_write_null_buffer(0);
|
||||
fs_file_write_null_buffer(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1187,7 +1188,7 @@ TEST_IMPL(fs_async_dir) {
|
||||
unlink("test_dir/file2");
|
||||
rmdir("test_dir");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1239,6 +1240,8 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
|
||||
ASSERT(r == 0);
|
||||
uv_fs_req_cleanup(&close_req);
|
||||
|
||||
memset(&s1, 0, sizeof(s1));
|
||||
memset(&s2, 0, sizeof(s2));
|
||||
ASSERT(0 == stat("test_file", &s1));
|
||||
ASSERT(0 == stat("test_file2", &s2));
|
||||
ASSERT(s2.st_size == expected_size);
|
||||
@ -1265,7 +1268,7 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
|
||||
unlink("test_file");
|
||||
unlink("test_file2");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1313,7 +1316,7 @@ TEST_IMPL(fs_mkdtemp) {
|
||||
uv_fs_req_cleanup(&mkdtemp_req1);
|
||||
uv_fs_req_cleanup(&mkdtemp_req2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1346,6 +1349,8 @@ TEST_IMPL(fs_mkstemp) {
|
||||
/* Make sure that path is empty string */
|
||||
ASSERT_EQ(0, strlen(mkstemp_req3.path));
|
||||
|
||||
uv_fs_req_cleanup(&mkstemp_req3);
|
||||
|
||||
/* We can write to the opened file */
|
||||
iov = uv_buf_init(test_buf, sizeof(test_buf));
|
||||
r = uv_fs_write(NULL, &req, mkstemp_req1.result, &iov, 1, -1, NULL);
|
||||
@ -1379,7 +1384,7 @@ TEST_IMPL(fs_mkstemp) {
|
||||
uv_fs_req_cleanup(&mkstemp_req1);
|
||||
uv_fs_req_cleanup(&mkstemp_req2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1393,6 +1398,13 @@ TEST_IMPL(fs_fstat) {
|
||||
struct stat t;
|
||||
#endif
|
||||
|
||||
#if defined(__s390__) && defined(__QEMU__)
|
||||
/* qemu-user-s390x has this weird bug where statx() reports nanoseconds
|
||||
* but plain fstat() does not.
|
||||
*/
|
||||
RETURN_SKIP("Test does not currently work in QEMU");
|
||||
#endif
|
||||
|
||||
/* Setup. */
|
||||
unlink("test_file");
|
||||
|
||||
@ -1406,6 +1418,7 @@ TEST_IMPL(fs_fstat) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
#ifndef _WIN32
|
||||
memset(&t, 0, sizeof(t));
|
||||
ASSERT(0 == fstat(file, &t));
|
||||
ASSERT(0 == uv_fs_fstat(NULL, &req, file, NULL));
|
||||
ASSERT(req.result == 0);
|
||||
@ -1535,7 +1548,44 @@ TEST_IMPL(fs_fstat) {
|
||||
/* Cleanup. */
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(fs_fstat_stdio) {
|
||||
int fd;
|
||||
int res;
|
||||
uv_fs_t req;
|
||||
#ifdef _WIN32
|
||||
uv_stat_t* st;
|
||||
DWORD ft;
|
||||
#endif
|
||||
|
||||
for (fd = 0; fd <= 2; ++fd) {
|
||||
res = uv_fs_fstat(NULL, &req, fd, NULL);
|
||||
ASSERT(res == 0);
|
||||
ASSERT(req.result == 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
st = req.ptr;
|
||||
ft = uv_guess_handle(fd);
|
||||
switch (ft) {
|
||||
case UV_TTY:
|
||||
case UV_NAMED_PIPE:
|
||||
ASSERT(st->st_mode == (ft == UV_TTY ? S_IFCHR : S_IFIFO));
|
||||
ASSERT(st->st_nlink == 1);
|
||||
ASSERT(st->st_rdev == (ft == UV_TTY ? FILE_DEVICE_CONSOLE : FILE_DEVICE_NAMED_PIPE) << 16);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
uv_fs_req_cleanup(&req);
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1611,7 +1661,7 @@ TEST_IMPL(fs_access) {
|
||||
unlink("test_file");
|
||||
rmdir("test_dir");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1709,7 +1759,7 @@ TEST_IMPL(fs_chmod) {
|
||||
/* Cleanup. */
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1768,7 +1818,7 @@ TEST_IMPL(fs_unlink_readonly) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1826,7 +1876,7 @@ TEST_IMPL(fs_unlink_archive_readonly) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -1919,7 +1969,7 @@ TEST_IMPL(fs_chown) {
|
||||
unlink("test_file");
|
||||
unlink("test_file_link");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2005,28 +2055,61 @@ TEST_IMPL(fs_link) {
|
||||
unlink("test_file_link");
|
||||
unlink("test_file_link2");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(fs_readlink) {
|
||||
uv_fs_t req;
|
||||
/* Must return UV_ENOENT on an inexistent file */
|
||||
{
|
||||
uv_fs_t req;
|
||||
|
||||
loop = uv_default_loop();
|
||||
ASSERT(0 == uv_fs_readlink(loop, &req, "no_such_file", dummy_cb));
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
ASSERT(dummy_cb_count == 1);
|
||||
ASSERT_NULL(req.ptr);
|
||||
ASSERT(req.result == UV_ENOENT);
|
||||
uv_fs_req_cleanup(&req);
|
||||
loop = uv_default_loop();
|
||||
ASSERT(0 == uv_fs_readlink(loop, &req, "no_such_file", dummy_cb));
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
ASSERT(dummy_cb_count == 1);
|
||||
ASSERT_NULL(req.ptr);
|
||||
ASSERT(req.result == UV_ENOENT);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
ASSERT(UV_ENOENT == uv_fs_readlink(NULL, &req, "no_such_file", NULL));
|
||||
ASSERT_NULL(req.ptr);
|
||||
ASSERT(req.result == UV_ENOENT);
|
||||
uv_fs_req_cleanup(&req);
|
||||
ASSERT(UV_ENOENT == uv_fs_readlink(NULL, &req, "no_such_file", NULL));
|
||||
ASSERT_NULL(req.ptr);
|
||||
ASSERT(req.result == UV_ENOENT);
|
||||
uv_fs_req_cleanup(&req);
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
/* Must return UV_EINVAL on a non-symlink file */
|
||||
{
|
||||
int r;
|
||||
uv_fs_t req;
|
||||
uv_file file;
|
||||
|
||||
/* Setup */
|
||||
|
||||
/* Create a non-symlink file */
|
||||
r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
|
||||
S_IWUSR | S_IRUSR, NULL);
|
||||
ASSERT_GE(r, 0);
|
||||
ASSERT_GE(req.result, 0);
|
||||
file = req.result;
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
r = uv_fs_close(NULL, &req, file, NULL);
|
||||
ASSERT_EQ(r, 0);
|
||||
ASSERT_EQ(req.result, 0);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
/* Test */
|
||||
r = uv_fs_readlink(NULL, &req, "test_file", NULL);
|
||||
ASSERT_EQ(r, UV_EINVAL);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
/* Cleanup */
|
||||
unlink("test_file");
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2039,15 +2122,6 @@ TEST_IMPL(fs_realpath) {
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
ASSERT(dummy_cb_count == 1);
|
||||
ASSERT_NULL(req.ptr);
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
|
||||
*/
|
||||
if (req.result == UV_ENOSYS) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
RETURN_SKIP("realpath is not supported on Windows XP");
|
||||
}
|
||||
#endif
|
||||
ASSERT(req.result == UV_ENOENT);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
@ -2056,7 +2130,7 @@ TEST_IMPL(fs_realpath) {
|
||||
ASSERT(req.result == UV_ENOENT);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2158,15 +2232,6 @@ TEST_IMPL(fs_symlink) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
r = uv_fs_realpath(NULL, &req, "test_file_symlink_symlink", NULL);
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
|
||||
*/
|
||||
if (r == UV_ENOSYS) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
RETURN_SKIP("realpath is not supported on Windows XP");
|
||||
}
|
||||
#endif
|
||||
ASSERT(r == 0);
|
||||
#ifdef _WIN32
|
||||
ASSERT(stricmp(req.ptr, test_file_abs_buf) == 0);
|
||||
@ -2216,15 +2281,6 @@ TEST_IMPL(fs_symlink) {
|
||||
ASSERT(readlink_cb_count == 1);
|
||||
|
||||
r = uv_fs_realpath(loop, &req, "test_file", realpath_cb);
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
|
||||
*/
|
||||
if (r == UV_ENOSYS) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
RETURN_SKIP("realpath is not supported on Windows XP");
|
||||
}
|
||||
#endif
|
||||
ASSERT(r == 0);
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(realpath_cb_count == 1);
|
||||
@ -2242,7 +2298,7 @@ TEST_IMPL(fs_symlink) {
|
||||
unlink("test_file_symlink2");
|
||||
unlink("test_file_symlink2_symlink");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2325,15 +2381,6 @@ int test_symlink_dir_impl(int type) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
r = uv_fs_realpath(NULL, &req, "test_dir_symlink", NULL);
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
|
||||
*/
|
||||
if (r == UV_ENOSYS) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
RETURN_SKIP("realpath is not supported on Windows XP");
|
||||
}
|
||||
#endif
|
||||
ASSERT(r == 0);
|
||||
#ifdef _WIN32
|
||||
ASSERT(strlen(req.ptr) == test_dir_abs_size - 5);
|
||||
@ -2396,7 +2443,7 @@ int test_symlink_dir_impl(int type) {
|
||||
rmdir("test_dir");
|
||||
rmdir("test_dir_symlink");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2505,7 +2552,7 @@ TEST_IMPL(fs_non_symlink_reparse_point) {
|
||||
unlink("test_dir/test_file");
|
||||
rmdir("test_dir");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2525,7 +2572,7 @@ TEST_IMPL(fs_lstat_windows_store_apps) {
|
||||
len = sizeof(localappdata);
|
||||
r = uv_os_getenv("LOCALAPPDATA", localappdata, &len);
|
||||
if (r == UV_ENOENT) {
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return TEST_SKIP;
|
||||
}
|
||||
ASSERT_EQ(r, 0);
|
||||
@ -2536,11 +2583,11 @@ TEST_IMPL(fs_lstat_windows_store_apps) {
|
||||
ASSERT_GT(r, 0);
|
||||
if (uv_fs_opendir(loop, &req, windowsapps_path, NULL) != 0) {
|
||||
/* If we cannot read the directory, skip the test. */
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return TEST_SKIP;
|
||||
}
|
||||
if (uv_fs_scandir(loop, &req, windowsapps_path, 0, NULL) <= 0) {
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return TEST_SKIP;
|
||||
}
|
||||
while (uv_fs_scandir_next(&req, &dirent) != UV_EOF) {
|
||||
@ -2556,7 +2603,7 @@ TEST_IMPL(fs_lstat_windows_store_apps) {
|
||||
}
|
||||
ASSERT_EQ(uv_fs_lstat(loop, &stat_req, file_path, NULL), 0);
|
||||
}
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -2603,7 +2650,7 @@ TEST_IMPL(fs_utime) {
|
||||
/* Cleanup. */
|
||||
unlink(path);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2642,7 +2689,7 @@ TEST_IMPL(fs_utime_round) {
|
||||
check_utime(path, atime, mtime, /* test_lutime */ 0);
|
||||
unlink(path);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2673,7 +2720,7 @@ TEST_IMPL(fs_stat_root) {
|
||||
r = uv_fs_stat(NULL, &stat_req, "\\\\?\\C:\\", NULL);
|
||||
ASSERT(r == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -2736,7 +2783,7 @@ TEST_IMPL(fs_futime) {
|
||||
/* Cleanup. */
|
||||
unlink(path);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2755,8 +2802,8 @@ TEST_IMPL(fs_lutime) {
|
||||
loop = uv_default_loop();
|
||||
unlink(path);
|
||||
r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL);
|
||||
ASSERT(r >= 0);
|
||||
ASSERT(req.result >= 0);
|
||||
ASSERT_GE(r, 0);
|
||||
ASSERT_GE(req.result, 0);
|
||||
uv_fs_req_cleanup(&req);
|
||||
uv_fs_close(loop, &req, r, NULL);
|
||||
|
||||
@ -2772,8 +2819,8 @@ TEST_IMPL(fs_lutime) {
|
||||
"Symlink creation requires elevated console (with admin rights)");
|
||||
}
|
||||
#endif
|
||||
ASSERT(s == 0);
|
||||
ASSERT(req.result == 0);
|
||||
ASSERT_EQ(s, 0);
|
||||
ASSERT_EQ(req.result, 0);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
/* Test the synchronous version. */
|
||||
@ -2787,12 +2834,12 @@ TEST_IMPL(fs_lutime) {
|
||||
r = uv_fs_lutime(NULL, &req, symlink_path, atime, mtime, NULL);
|
||||
#if (defined(_AIX) && !defined(_AIX71)) || \
|
||||
defined(__MVS__)
|
||||
ASSERT(r == UV_ENOSYS);
|
||||
ASSERT_EQ(r, UV_ENOSYS);
|
||||
RETURN_SKIP("lutime is not implemented for z/OS and AIX versions below 7.1");
|
||||
#endif
|
||||
ASSERT(r == 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
lutime_cb(&req);
|
||||
ASSERT(lutime_cb_count == 1);
|
||||
ASSERT_EQ(lutime_cb_count, 1);
|
||||
|
||||
/* Test the asynchronous version. */
|
||||
atime = mtime = 1291404900; /* 2010-12-03 20:35:00 */
|
||||
@ -2802,15 +2849,15 @@ TEST_IMPL(fs_lutime) {
|
||||
checkme.path = symlink_path;
|
||||
|
||||
r = uv_fs_lutime(loop, &req, symlink_path, atime, mtime, lutime_cb);
|
||||
ASSERT(r == 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(lutime_cb_count == 2);
|
||||
ASSERT_EQ(lutime_cb_count, 2);
|
||||
|
||||
/* Cleanup. */
|
||||
unlink(path);
|
||||
unlink(symlink_path);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2826,7 +2873,7 @@ TEST_IMPL(fs_stat_missing_path) {
|
||||
ASSERT(req.result == UV_ENOENT);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2863,7 +2910,7 @@ TEST_IMPL(fs_scandir_empty_dir) {
|
||||
uv_fs_rmdir(NULL, &req, path, NULL);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2897,7 +2944,7 @@ TEST_IMPL(fs_scandir_non_existent_dir) {
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(scandir_cb_count == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2919,7 +2966,25 @@ TEST_IMPL(fs_scandir_file) {
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(scandir_cb_count == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Run in Valgrind. Should not leak when the iterator isn't exhausted. */
|
||||
TEST_IMPL(fs_scandir_early_exit) {
|
||||
uv_dirent_t d;
|
||||
uv_fs_t req;
|
||||
|
||||
ASSERT_LT(0, uv_fs_scandir(NULL, &req, "test/fixtures/one_file", 0, NULL));
|
||||
ASSERT_NE(UV_EOF, uv_fs_scandir_next(&req, &d));
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
ASSERT_LT(0, uv_fs_scandir(NULL, &req, "test/fixtures", 0, NULL));
|
||||
ASSERT_NE(UV_EOF, uv_fs_scandir_next(&req, &d));
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2949,7 +3014,7 @@ TEST_IMPL(fs_open_dir) {
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(open_cb_count == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3024,7 +3089,7 @@ TEST_IMPL(fs_file_open_append) {
|
||||
fs_file_open_append(0);
|
||||
fs_file_open_append(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3093,7 +3158,7 @@ TEST_IMPL(fs_rename_to_existing_file) {
|
||||
unlink("test_file");
|
||||
unlink("test_file2");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3151,7 +3216,7 @@ TEST_IMPL(fs_read_bufs) {
|
||||
fs_read_bufs(0);
|
||||
fs_read_bufs(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3217,7 +3282,7 @@ TEST_IMPL(fs_read_file_eof) {
|
||||
fs_read_file_eof(0);
|
||||
fs_read_file_eof(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3311,7 +3376,7 @@ TEST_IMPL(fs_write_multiple_bufs) {
|
||||
fs_write_multiple_bufs(0);
|
||||
fs_write_multiple_bufs(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3418,7 +3483,7 @@ TEST_IMPL(fs_write_alotof_bufs) {
|
||||
fs_write_alotof_bufs(0);
|
||||
fs_write_alotof_bufs(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3534,7 +3599,7 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) {
|
||||
fs_write_alotof_bufs_with_offset(0);
|
||||
fs_write_alotof_bufs_with_offset(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3589,7 +3654,7 @@ TEST_IMPL(fs_read_dir) {
|
||||
/* Cleanup */
|
||||
rmdir("test_dir");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3682,9 +3747,9 @@ static void test_fs_partial(int doread) {
|
||||
ctx.doread = doread;
|
||||
ctx.interval = 1000;
|
||||
ctx.size = sizeof(test_buf) * iovcount;
|
||||
ctx.data = malloc(ctx.size);
|
||||
ctx.data = calloc(ctx.size, 1);
|
||||
ASSERT_NOT_NULL(ctx.data);
|
||||
buffer = malloc(ctx.size);
|
||||
buffer = calloc(ctx.size, 1);
|
||||
ASSERT_NOT_NULL(buffer);
|
||||
|
||||
for (index = 0; index < iovcount; ++index)
|
||||
@ -3727,9 +3792,10 @@ static void test_fs_partial(int doread) {
|
||||
uv_fs_req_cleanup(&write_req);
|
||||
}
|
||||
|
||||
ASSERT(0 == memcmp(buffer, ctx.data, ctx.size));
|
||||
|
||||
ASSERT(0 == uv_thread_join(&thread));
|
||||
|
||||
ASSERT_MEM_EQ(buffer, ctx.data, ctx.size);
|
||||
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
|
||||
ASSERT(0 == close(pipe_fds[1]));
|
||||
@ -3747,7 +3813,7 @@ static void test_fs_partial(int doread) {
|
||||
free(buffer);
|
||||
free(ctx.data);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
}
|
||||
|
||||
TEST_IMPL(fs_partial_read) {
|
||||
@ -3820,6 +3886,7 @@ TEST_IMPL(fs_read_write_null_arguments) {
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
uv_fs_req_cleanup(&write_req);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3858,7 +3925,7 @@ TEST_IMPL(get_osfhandle_valid_handle) {
|
||||
/* Cleanup. */
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3904,7 +3971,7 @@ TEST_IMPL(open_osfhandle_valid_handle) {
|
||||
/* Cleanup. */
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3944,7 +4011,7 @@ TEST_IMPL(fs_file_pos_after_op_with_offset) {
|
||||
/* Cleanup */
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4043,7 +4110,7 @@ TEST_IMPL(fs_file_pos_write) {
|
||||
fs_file_pos_write(0);
|
||||
fs_file_pos_write(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4083,7 +4150,7 @@ TEST_IMPL(fs_file_pos_append) {
|
||||
fs_file_pos_append(0);
|
||||
fs_file_pos_append(UV_FS_O_FILEMAP);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -4243,7 +4310,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) {
|
||||
/* Cleanup */
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -4290,7 +4357,7 @@ TEST_IMPL(fs_file_flag_no_buffering) {
|
||||
/* Cleanup */
|
||||
unlink("test_file");
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -4376,7 +4443,7 @@ TEST_IMPL(fs_open_readonly_acl) {
|
||||
unlink("test_file_icacls");
|
||||
uv_os_free_passwd(&pwd);
|
||||
ASSERT(r == 0);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -4461,6 +4528,7 @@ TEST_IMPL(fs_statfs) {
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(statfs_cb_count == 2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4481,3 +4549,27 @@ TEST_IMPL(fs_get_system_error) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
TEST_IMPL(fs_stat_batch_multiple) {
|
||||
uv_fs_t req[300];
|
||||
int r;
|
||||
int i;
|
||||
|
||||
rmdir("test_dir");
|
||||
|
||||
r = uv_fs_mkdir(NULL, &mkdir_req, "test_dir", 0755, NULL);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
loop = uv_default_loop();
|
||||
|
||||
for (i = 0; i < (int) ARRAY_SIZE(req); ++i) {
|
||||
r = uv_fs_stat(loop, &req[i], "test_dir", stat_batch_cb);
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT_EQ(stat_cb_count, ARRAY_SIZE(req));
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
3
deps/libuv/test/test-get-currentexe.c
vendored
3
deps/libuv/test/test-get-currentexe.c
vendored
@ -35,6 +35,9 @@ TEST_IMPL(get_currentexe) {
|
||||
#if defined(__QEMU__)
|
||||
RETURN_SKIP("Test does not currently work in QEMU");
|
||||
#endif
|
||||
#if defined(__OpenBSD__)
|
||||
RETURN_SKIP("Test does not currently work in OpenBSD");
|
||||
#endif
|
||||
|
||||
char buffer[PATHMAX];
|
||||
char path[PATHMAX];
|
||||
|
13
deps/libuv/test/test-get-memory.c
vendored
13
deps/libuv/test/test-get-memory.c
vendored
@ -26,11 +26,14 @@ TEST_IMPL(get_memory) {
|
||||
uint64_t free_mem = uv_get_free_memory();
|
||||
uint64_t total_mem = uv_get_total_memory();
|
||||
uint64_t constrained_mem = uv_get_constrained_memory();
|
||||
uint64_t available_mem = uv_get_available_memory();
|
||||
|
||||
printf("free_mem=%llu, total_mem=%llu, constrained_mem=%llu\n",
|
||||
printf("free_mem=%llu, total_mem=%llu, constrained_mem=%llu, "
|
||||
"available_mem=%llu\n",
|
||||
(unsigned long long) free_mem,
|
||||
(unsigned long long) total_mem,
|
||||
(unsigned long long) constrained_mem);
|
||||
(unsigned long long) constrained_mem,
|
||||
(unsigned long long) available_mem);
|
||||
|
||||
ASSERT(free_mem > 0);
|
||||
ASSERT(total_mem > 0);
|
||||
@ -40,5 +43,11 @@ TEST_IMPL(get_memory) {
|
||||
#else
|
||||
ASSERT(total_mem > free_mem);
|
||||
#endif
|
||||
ASSERT_LE(available_mem, total_mem);
|
||||
/* we'd really want to test if available <= free, but that is fragile:
|
||||
* with no limit set, get_available calls and returns get_free; so if
|
||||
* any memory was freed between our calls to get_free and get_available
|
||||
* we would fail such a test test (as observed on CI).
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
121
deps/libuv/test/test-get-passwd.c
vendored
121
deps/libuv/test/test-get-passwd.c
vendored
@ -39,32 +39,32 @@ TEST_IMPL(get_passwd) {
|
||||
|
||||
/* Test the normal case */
|
||||
r = uv_os_get_passwd(&pwd);
|
||||
ASSERT(r == 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
len = strlen(pwd.username);
|
||||
ASSERT(len > 0);
|
||||
ASSERT_GT(len, 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
ASSERT_NULL(pwd.shell);
|
||||
#else
|
||||
len = strlen(pwd.shell);
|
||||
# ifndef __PASE__
|
||||
ASSERT(len > 0);
|
||||
ASSERT_GT(len, 0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
len = strlen(pwd.homedir);
|
||||
ASSERT(len > 0);
|
||||
ASSERT_GT(len, 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (len == 3 && pwd.homedir[1] == ':')
|
||||
ASSERT(pwd.homedir[2] == '\\');
|
||||
ASSERT_EQ(pwd.homedir[2], '\\');
|
||||
else
|
||||
ASSERT(pwd.homedir[len - 1] != '\\');
|
||||
ASSERT_NE(pwd.homedir[len - 1], '\\');
|
||||
#else
|
||||
if (len == 1)
|
||||
ASSERT(pwd.homedir[0] == '/');
|
||||
ASSERT_EQ(pwd.homedir[0], '/');
|
||||
else
|
||||
ASSERT(pwd.homedir[len - 1] != '/');
|
||||
ASSERT_NE(pwd.homedir[len - 1], '/');
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -95,7 +95,110 @@ TEST_IMPL(get_passwd) {
|
||||
|
||||
/* Test invalid input */
|
||||
r = uv_os_get_passwd(NULL);
|
||||
ASSERT(r == UV_EINVAL);
|
||||
ASSERT_EQ(r, UV_EINVAL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(get_passwd2) {
|
||||
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||
#if defined(__QEMU__)
|
||||
RETURN_SKIP("Test does not currently work in QEMU");
|
||||
#endif
|
||||
|
||||
uv_passwd_t pwd;
|
||||
uv_passwd_t pwd2;
|
||||
size_t len;
|
||||
int r;
|
||||
|
||||
/* Test the normal case */
|
||||
r = uv_os_get_passwd(&pwd);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
r = uv_os_get_passwd2(&pwd2, pwd.uid);
|
||||
|
||||
#ifdef _WIN32
|
||||
ASSERT_EQ(r, UV_ENOTSUP);
|
||||
|
||||
#else
|
||||
ASSERT_EQ(r, 0);
|
||||
ASSERT_EQ(pwd.uid, pwd2.uid);
|
||||
ASSERT_STR_EQ(pwd.username, pwd2.username);
|
||||
ASSERT_STR_EQ(pwd.shell, pwd2.shell);
|
||||
ASSERT_STR_EQ(pwd.homedir, pwd2.homedir);
|
||||
uv_os_free_passwd(&pwd2);
|
||||
|
||||
r = uv_os_get_passwd2(&pwd2, 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
len = strlen(pwd2.username);
|
||||
ASSERT_GT(len, 0);
|
||||
ASSERT_STR_EQ(pwd2.username, "root");
|
||||
|
||||
len = strlen(pwd2.homedir);
|
||||
ASSERT_GT(len, 0);
|
||||
|
||||
len = strlen(pwd2.shell);
|
||||
# ifndef __PASE__
|
||||
ASSERT_GT(len, 0);
|
||||
# endif
|
||||
|
||||
uv_os_free_passwd(&pwd2);
|
||||
#endif
|
||||
|
||||
uv_os_free_passwd(&pwd);
|
||||
|
||||
/* Test invalid input */
|
||||
r = uv_os_get_passwd2(NULL, pwd.uid);
|
||||
#ifdef _WIN32
|
||||
ASSERT_EQ(r, UV_ENOTSUP);
|
||||
#else
|
||||
ASSERT_EQ(r, UV_EINVAL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(get_group) {
|
||||
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||
#if defined(__QEMU__)
|
||||
RETURN_SKIP("Test does not currently work in QEMU");
|
||||
#endif
|
||||
|
||||
uv_passwd_t pwd;
|
||||
uv_group_t grp;
|
||||
size_t len;
|
||||
int r;
|
||||
|
||||
r = uv_os_get_passwd(&pwd);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
r = uv_os_get_group(&grp, pwd.gid);
|
||||
|
||||
#ifdef _WIN32
|
||||
ASSERT_EQ(r, UV_ENOTSUP);
|
||||
|
||||
#else
|
||||
ASSERT_EQ(r, 0);
|
||||
ASSERT_EQ(pwd.gid, grp.gid);
|
||||
|
||||
len = strlen(grp.groupname);
|
||||
ASSERT_GT(len, 0);
|
||||
|
||||
uv_os_free_group(&grp);
|
||||
#endif
|
||||
|
||||
uv_os_free_passwd(&pwd);
|
||||
|
||||
/* Test invalid input */
|
||||
r = uv_os_get_group(NULL, pwd.gid);
|
||||
#ifdef _WIN32
|
||||
ASSERT_EQ(r, UV_ENOTSUP);
|
||||
#else
|
||||
ASSERT_EQ(r, UV_EINVAL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
10
deps/libuv/test/test-getaddrinfo.c
vendored
10
deps/libuv/test/test-getaddrinfo.c
vendored
@ -106,7 +106,7 @@ TEST_IMPL(getaddrinfo_fail) {
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
ASSERT(fail_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ TEST_IMPL(getaddrinfo_fail_sync) {
|
||||
NULL));
|
||||
uv_freeaddrinfo(req.addrinfo);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ TEST_IMPL(getaddrinfo_basic) {
|
||||
|
||||
ASSERT(getaddrinfo_cbs == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ TEST_IMPL(getaddrinfo_basic_sync) {
|
||||
NULL));
|
||||
uv_freeaddrinfo(req.addrinfo);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -210,6 +210,6 @@ TEST_IMPL(getaddrinfo_concurrent) {
|
||||
ASSERT(callback_counts[i] == 1);
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-gethostname.c
vendored
2
deps/libuv/test/test-gethostname.c
vendored
@ -43,7 +43,7 @@ TEST_IMPL(gethostname) {
|
||||
enobufs_size = 1;
|
||||
buf[0] = '\0';
|
||||
r = uv_os_gethostname(buf, &enobufs_size);
|
||||
ASSERT(r == UV_ENOBUFS);
|
||||
ASSERT_EQ(r, UV_ENOBUFS);
|
||||
ASSERT(buf[0] == '\0');
|
||||
ASSERT(enobufs_size > 1);
|
||||
|
||||
|
6
deps/libuv/test/test-getnameinfo.c
vendored
6
deps/libuv/test/test-getnameinfo.c
vendored
@ -65,7 +65,7 @@ TEST_IMPL(getnameinfo_basic_ip4) {
|
||||
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ TEST_IMPL(getnameinfo_basic_ip4_sync) {
|
||||
ASSERT(req.host[0] != '\0');
|
||||
ASSERT(req.service[0] != '\0');
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -111,6 +111,6 @@ TEST_IMPL(getnameinfo_basic_ip6) {
|
||||
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-getsockname.c
vendored
4
deps/libuv/test/test-getsockname.c
vendored
@ -337,7 +337,7 @@ TEST_IMPL(getsockname_tcp) {
|
||||
ASSERT(getsocknamecount_tcp == 3);
|
||||
ASSERT(getpeernamecount == 3);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -357,6 +357,6 @@ TEST_IMPL(getsockname_udp) {
|
||||
ASSERT(udp.send_queue_size == 0);
|
||||
ASSERT(udpServer.send_queue_size == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
1
deps/libuv/test/test-getters-setters.c
vendored
1
deps/libuv/test/test-getters-setters.c
vendored
@ -68,6 +68,7 @@ TEST_IMPL(getters_setters) {
|
||||
|
||||
pipe = malloc(uv_handle_size(UV_NAMED_PIPE));
|
||||
r = uv_pipe_init(loop, pipe, 0);
|
||||
ASSERT(r == 0);
|
||||
ASSERT(uv_handle_get_type((uv_handle_t*)pipe) == UV_NAMED_PIPE);
|
||||
|
||||
ASSERT(uv_handle_get_loop((uv_handle_t*)pipe) == loop);
|
||||
|
2
deps/libuv/test/test-handle-fileno.c
vendored
2
deps/libuv/test/test-handle-fileno.c
vendored
@ -120,6 +120,6 @@ TEST_IMPL(handle_fileno) {
|
||||
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
13
deps/libuv/test/test-hrtime.c
vendored
13
deps/libuv/test/test-hrtime.c
vendored
@ -50,3 +50,16 @@ TEST_IMPL(hrtime) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(clock_gettime) {
|
||||
uv_timespec64_t t;
|
||||
|
||||
ASSERT_EQ(UV_EINVAL, uv_clock_gettime(1337, &t));
|
||||
ASSERT_EQ(UV_EFAULT, uv_clock_gettime(1337, NULL));
|
||||
ASSERT_EQ(0, uv_clock_gettime(UV_CLOCK_MONOTONIC, &t));
|
||||
ASSERT_EQ(0, uv_clock_gettime(UV_CLOCK_REALTIME, &t));
|
||||
ASSERT_GT(1682500000000ll, t.tv_sec); /* 2023-04-26T09:06:40.000Z */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-idle.c
vendored
4
deps/libuv/test/test-idle.c
vendored
@ -94,7 +94,7 @@ TEST_IMPL(idle_starvation) {
|
||||
ASSERT(timer_cb_called == 1);
|
||||
ASSERT(close_cb_called == 3);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -120,6 +120,6 @@ TEST_IMPL(idle_check) {
|
||||
ASSERT_EQ(0, uv_run(uv_default_loop(), UV_RUN_ONCE));
|
||||
ASSERT_EQ(2, close_cb_called);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-idna.c
vendored
4
deps/libuv/test/test-idna.c
vendored
@ -104,13 +104,13 @@ TEST_IMPL(utf8_decode1_overrun) {
|
||||
p = b;
|
||||
b[0] = 0x7F;
|
||||
ASSERT_EQ(0x7F, uv__utf8_decode1(&p, b + 1));
|
||||
ASSERT_EQ(p, b + 1);
|
||||
ASSERT_PTR_EQ(p, b + 1);
|
||||
|
||||
/* Multi-byte. */
|
||||
p = b;
|
||||
b[0] = 0xC0;
|
||||
ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1));
|
||||
ASSERT_EQ(p, b + 1);
|
||||
ASSERT_PTR_EQ(p, b + 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-ip-name.c
vendored
4
deps/libuv/test/test-ip-name.c
vendored
@ -51,7 +51,7 @@ TEST_IMPL(ip_name) {
|
||||
ASSERT_EQ(0, uv_ip6_addr("fe80::2acf:daff:fedd:342a", TEST_PORT, addr6));
|
||||
ASSERT_EQ(0, uv_ip6_name(addr6, dst, INET6_ADDRSTRLEN));
|
||||
ASSERT_EQ(0, strcmp("fe80::2acf:daff:fedd:342a", dst));
|
||||
|
||||
|
||||
ASSERT_EQ(0, uv_ip_name(addr, dst, INET6_ADDRSTRLEN));
|
||||
ASSERT_EQ(0, strcmp("fe80::2acf:daff:fedd:342a", dst));
|
||||
|
||||
@ -60,6 +60,6 @@ TEST_IMPL(ip_name) {
|
||||
/* size is not a concern here */
|
||||
ASSERT_EQ(UV_EAFNOSUPPORT, uv_ip_name(addr, dst, INET6_ADDRSTRLEN));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-ip4-addr.c
vendored
2
deps/libuv/test/test-ip4-addr.c
vendored
@ -50,6 +50,6 @@ TEST_IMPL(ip4_addr) {
|
||||
ASSERT(UV_EAFNOSUPPORT == uv_inet_pton(42, "127.0.0.1",
|
||||
&addr.sin_addr.s_addr));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
6
deps/libuv/test/test-ip6-addr.c
vendored
6
deps/libuv/test/test-ip6-addr.c
vendored
@ -103,7 +103,7 @@ TEST_IMPL(ip6_addr_link_local) {
|
||||
fflush(stderr);
|
||||
|
||||
ASSERT(0 == uv_ip6_addr(scoped_addr, TEST_PORT, &addr));
|
||||
fprintf(stderr, "Got scope_id 0x%02x\n", addr.sin6_scope_id);
|
||||
fprintf(stderr, "Got scope_id 0x%2x\n", (unsigned)addr.sin6_scope_id);
|
||||
fflush(stderr);
|
||||
ASSERT(iface_index == addr.sin6_scope_id);
|
||||
}
|
||||
@ -113,7 +113,7 @@ TEST_IMPL(ip6_addr_link_local) {
|
||||
scoped_addr_len = sizeof(scoped_addr);
|
||||
ASSERT(0 != uv_if_indextoname((unsigned int)-1, scoped_addr, &scoped_addr_len));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ TEST_IMPL(ip6_pton) {
|
||||
GOOD_ADDR_LIST(TEST_GOOD)
|
||||
BAD_ADDR_LIST(TEST_BAD)
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ TEST_IMPL(ipc_heavy_traffic_deadlock_bug) {
|
||||
spawn_helper(&pipe, &process, "ipc_helper_heavy_traffic_deadlock_bug");
|
||||
do_writes_and_reads((uv_stream_t*) &pipe);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(pipe.loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -154,6 +154,6 @@ int ipc_helper_heavy_traffic_deadlock_bug(void) {
|
||||
do_writes_and_reads((uv_stream_t*) &pipe);
|
||||
uv_sleep(100);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
20
deps/libuv/test/test-ipc-send-recv.c
vendored
20
deps/libuv/test/test-ipc-send-recv.c
vendored
@ -76,10 +76,12 @@ static int write2_cb_called;
|
||||
static void alloc_cb(uv_handle_t* handle,
|
||||
size_t suggested_size,
|
||||
uv_buf_t* buf) {
|
||||
/* we're not actually reading anything so a small buffer is okay */
|
||||
static char slab[8];
|
||||
buf->base = slab;
|
||||
buf->len = sizeof(slab);
|
||||
/* We're not actually reading anything so a small buffer is okay
|
||||
* but it needs to be heap-allocated to appease TSan.
|
||||
*/
|
||||
buf->len = 8;
|
||||
buf->base = malloc(buf->len);
|
||||
ASSERT_NOT_NULL(buf->base);
|
||||
}
|
||||
|
||||
|
||||
@ -91,6 +93,8 @@ static void recv_cb(uv_stream_t* handle,
|
||||
int r;
|
||||
union handles* recv;
|
||||
|
||||
free(buf->base);
|
||||
|
||||
pipe = (uv_pipe_t*) handle;
|
||||
ASSERT(pipe == &ctx.channel);
|
||||
|
||||
@ -219,7 +223,7 @@ static int run_ipc_send_recv_pipe(int inprocess) {
|
||||
r = run_test(inprocess);
|
||||
ASSERT(r == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -260,7 +264,7 @@ static int run_ipc_send_recv_tcp(int inprocess) {
|
||||
r = run_test(inprocess);
|
||||
ASSERT(r == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -304,6 +308,8 @@ static void read_cb(uv_stream_t* handle,
|
||||
union handles* recv;
|
||||
uv_write_t* write_req;
|
||||
|
||||
free(rdbuf->base);
|
||||
|
||||
if (nread == UV_EOF || nread == UV_ECONNABORTED) {
|
||||
return;
|
||||
}
|
||||
@ -410,7 +416,7 @@ int ipc_send_recv_helper(void) {
|
||||
r = run_ipc_send_recv_helper(uv_default_loop(), 0);
|
||||
ASSERT(r == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
14
deps/libuv/test/test-ipc.c
vendored
14
deps/libuv/test/test-ipc.c
vendored
@ -424,7 +424,7 @@ static int run_ipc_test(const char* helper, uv_read_cb read_cb) {
|
||||
r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ TEST_IMPL(listen_with_simultaneous_accepts) {
|
||||
ASSERT_EQ(r, 0);
|
||||
ASSERT_EQ(server.reqs_pending, 32);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -514,7 +514,7 @@ TEST_IMPL(listen_no_simultaneous_accepts) {
|
||||
ASSERT_EQ(r, 0);
|
||||
ASSERT_EQ(server.reqs_pending, 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -721,7 +721,7 @@ int ipc_helper(int listen_after_write) {
|
||||
ASSERT_EQ(connection_accepted, 1);
|
||||
ASSERT_EQ(close_cb_called, 3);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -774,7 +774,7 @@ int ipc_helper_tcp_connection(void) {
|
||||
ASSERT_EQ(tcp_conn_write_cb_called, 1);
|
||||
ASSERT_EQ(close_cb_called, 4);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -820,7 +820,7 @@ int ipc_helper_bind_twice(void) {
|
||||
r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -852,6 +852,6 @@ int ipc_helper_send_zero(void) {
|
||||
|
||||
ASSERT_EQ(send_zero_write, 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
29
deps/libuv/test/test-list.h
vendored
29
deps/libuv/test/test-list.h
vendored
@ -105,6 +105,7 @@ TEST_DECLARE (tcp_write_after_connect)
|
||||
TEST_DECLARE (tcp_writealot)
|
||||
TEST_DECLARE (tcp_write_fail)
|
||||
TEST_DECLARE (tcp_try_write)
|
||||
TEST_DECLARE (tcp_write_in_a_row)
|
||||
TEST_DECLARE (tcp_try_write_error)
|
||||
TEST_DECLARE (tcp_write_queue_order)
|
||||
TEST_DECLARE (tcp_open)
|
||||
@ -184,6 +185,7 @@ TEST_DECLARE (udp_open)
|
||||
TEST_DECLARE (udp_open_twice)
|
||||
TEST_DECLARE (udp_open_bound)
|
||||
TEST_DECLARE (udp_open_connect)
|
||||
TEST_DECLARE (udp_recv_in_a_row)
|
||||
#ifndef _WIN32
|
||||
TEST_DECLARE (udp_send_unix)
|
||||
#endif
|
||||
@ -192,6 +194,7 @@ TEST_DECLARE (udp_try_send)
|
||||
TEST_DECLARE (pipe_bind_error_addrinuse)
|
||||
TEST_DECLARE (pipe_bind_error_addrnotavail)
|
||||
TEST_DECLARE (pipe_bind_error_inval)
|
||||
TEST_DECLARE (pipe_connect_close_multiple)
|
||||
TEST_DECLARE (pipe_connect_multiple)
|
||||
TEST_DECLARE (pipe_listen_without_bind)
|
||||
TEST_DECLARE (pipe_bind_or_listen_error_after_close)
|
||||
@ -227,6 +230,8 @@ TEST_DECLARE (timer_from_check)
|
||||
TEST_DECLARE (timer_is_closing)
|
||||
TEST_DECLARE (timer_null_callback)
|
||||
TEST_DECLARE (timer_early_check)
|
||||
TEST_DECLARE (timer_no_double_call_once)
|
||||
TEST_DECLARE (timer_no_double_call_nowait)
|
||||
TEST_DECLARE (idle_starvation)
|
||||
TEST_DECLARE (idle_check)
|
||||
TEST_DECLARE (loop_handles)
|
||||
@ -275,10 +280,13 @@ TEST_DECLARE (process_title_threadsafe)
|
||||
TEST_DECLARE (cwd_and_chdir)
|
||||
TEST_DECLARE (get_memory)
|
||||
TEST_DECLARE (get_passwd)
|
||||
TEST_DECLARE (get_passwd2)
|
||||
TEST_DECLARE (get_group)
|
||||
TEST_DECLARE (handle_fileno)
|
||||
TEST_DECLARE (homedir)
|
||||
TEST_DECLARE (tmpdir)
|
||||
TEST_DECLARE (hrtime)
|
||||
TEST_DECLARE (clock_gettime)
|
||||
TEST_DECLARE (getaddrinfo_fail)
|
||||
TEST_DECLARE (getaddrinfo_fail_sync)
|
||||
TEST_DECLARE (getaddrinfo_basic)
|
||||
@ -344,6 +352,7 @@ TEST_DECLARE (fs_async_sendfile_nodata)
|
||||
TEST_DECLARE (fs_mkdtemp)
|
||||
TEST_DECLARE (fs_mkstemp)
|
||||
TEST_DECLARE (fs_fstat)
|
||||
TEST_DECLARE (fs_fstat_stdio)
|
||||
TEST_DECLARE (fs_access)
|
||||
TEST_DECLARE (fs_chmod)
|
||||
TEST_DECLARE (fs_copyfile)
|
||||
@ -372,6 +381,7 @@ TEST_DECLARE (fs_futime)
|
||||
TEST_DECLARE (fs_lutime)
|
||||
TEST_DECLARE (fs_file_open_append)
|
||||
TEST_DECLARE (fs_statfs)
|
||||
TEST_DECLARE (fs_stat_batch_multiple)
|
||||
TEST_DECLARE (fs_stat_missing_path)
|
||||
TEST_DECLARE (fs_read_bufs)
|
||||
TEST_DECLARE (fs_read_file_eof)
|
||||
@ -401,6 +411,7 @@ TEST_DECLARE (fs_event_stop_in_cb)
|
||||
TEST_DECLARE (fs_scandir_empty_dir)
|
||||
TEST_DECLARE (fs_scandir_non_existent_dir)
|
||||
TEST_DECLARE (fs_scandir_file)
|
||||
TEST_DECLARE (fs_scandir_early_exit)
|
||||
TEST_DECLARE (fs_open_dir)
|
||||
TEST_DECLARE (fs_readdir_empty_dir)
|
||||
TEST_DECLARE (fs_readdir_file)
|
||||
@ -448,6 +459,7 @@ TEST_DECLARE (thread_rwlock)
|
||||
TEST_DECLARE (thread_rwlock_trylock)
|
||||
TEST_DECLARE (thread_create)
|
||||
TEST_DECLARE (thread_equal)
|
||||
TEST_DECLARE (thread_affinity)
|
||||
TEST_DECLARE (dlerror)
|
||||
#if (defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))) && \
|
||||
!defined(__sun)
|
||||
@ -542,6 +554,8 @@ TEST_DECLARE (utf8_decode1)
|
||||
TEST_DECLARE (utf8_decode1_overrun)
|
||||
TEST_DECLARE (uname)
|
||||
|
||||
TEST_DECLARE (metrics_info_check)
|
||||
TEST_DECLARE (metrics_pool_events)
|
||||
TEST_DECLARE (metrics_idle_time)
|
||||
TEST_DECLARE (metrics_idle_time_thread)
|
||||
TEST_DECLARE (metrics_idle_time_zero)
|
||||
@ -669,6 +683,7 @@ TASK_LIST_START
|
||||
TEST_HELPER (tcp_write_fail, tcp4_echo_server)
|
||||
|
||||
TEST_ENTRY (tcp_try_write)
|
||||
TEST_ENTRY (tcp_write_in_a_row)
|
||||
TEST_ENTRY (tcp_try_write_error)
|
||||
|
||||
TEST_ENTRY (tcp_write_queue_order)
|
||||
@ -766,6 +781,7 @@ TASK_LIST_START
|
||||
TEST_ENTRY (udp_multicast_ttl)
|
||||
TEST_ENTRY (udp_sendmmsg_error)
|
||||
TEST_ENTRY (udp_try_send)
|
||||
TEST_ENTRY (udp_recv_in_a_row)
|
||||
|
||||
TEST_ENTRY (udp_open)
|
||||
TEST_ENTRY (udp_open_twice)
|
||||
@ -778,6 +794,7 @@ TASK_LIST_START
|
||||
TEST_ENTRY (pipe_bind_error_addrinuse)
|
||||
TEST_ENTRY (pipe_bind_error_addrnotavail)
|
||||
TEST_ENTRY (pipe_bind_error_inval)
|
||||
TEST_ENTRY (pipe_connect_close_multiple)
|
||||
TEST_ENTRY (pipe_connect_multiple)
|
||||
TEST_ENTRY (pipe_listen_without_bind)
|
||||
TEST_ENTRY (pipe_bind_or_listen_error_after_close)
|
||||
@ -824,6 +841,8 @@ TASK_LIST_START
|
||||
TEST_ENTRY (timer_is_closing)
|
||||
TEST_ENTRY (timer_null_callback)
|
||||
TEST_ENTRY (timer_early_check)
|
||||
TEST_ENTRY (timer_no_double_call_once)
|
||||
TEST_ENTRY (timer_no_double_call_nowait)
|
||||
|
||||
TEST_ENTRY (idle_starvation)
|
||||
TEST_ENTRY (idle_check)
|
||||
@ -883,6 +902,8 @@ TASK_LIST_START
|
||||
TEST_ENTRY (get_memory)
|
||||
|
||||
TEST_ENTRY (get_passwd)
|
||||
TEST_ENTRY (get_passwd2)
|
||||
TEST_ENTRY (get_group)
|
||||
|
||||
TEST_ENTRY (get_loadavg)
|
||||
|
||||
@ -894,6 +915,8 @@ TASK_LIST_START
|
||||
|
||||
TEST_ENTRY_CUSTOM (hrtime, 0, 0, 20000)
|
||||
|
||||
TEST_ENTRY (clock_gettime)
|
||||
|
||||
TEST_ENTRY_CUSTOM (getaddrinfo_fail, 0, 0, 10000)
|
||||
TEST_ENTRY_CUSTOM (getaddrinfo_fail_sync, 0, 0, 10000)
|
||||
|
||||
@ -1015,6 +1038,7 @@ TASK_LIST_START
|
||||
TEST_ENTRY (fs_mkdtemp)
|
||||
TEST_ENTRY (fs_mkstemp)
|
||||
TEST_ENTRY (fs_fstat)
|
||||
TEST_ENTRY (fs_fstat_stdio)
|
||||
TEST_ENTRY (fs_access)
|
||||
TEST_ENTRY (fs_chmod)
|
||||
TEST_ENTRY (fs_copyfile)
|
||||
@ -1041,6 +1065,7 @@ TASK_LIST_START
|
||||
TEST_ENTRY (fs_fd_hash)
|
||||
#endif
|
||||
TEST_ENTRY (fs_statfs)
|
||||
TEST_ENTRY (fs_stat_batch_multiple)
|
||||
TEST_ENTRY (fs_stat_missing_path)
|
||||
TEST_ENTRY (fs_read_bufs)
|
||||
TEST_ENTRY (fs_read_file_eof)
|
||||
@ -1071,6 +1096,7 @@ TASK_LIST_START
|
||||
TEST_ENTRY (fs_scandir_empty_dir)
|
||||
TEST_ENTRY (fs_scandir_non_existent_dir)
|
||||
TEST_ENTRY (fs_scandir_file)
|
||||
TEST_ENTRY (fs_scandir_early_exit)
|
||||
TEST_ENTRY (fs_open_dir)
|
||||
TEST_ENTRY (fs_readdir_empty_dir)
|
||||
TEST_ENTRY (fs_readdir_file)
|
||||
@ -1118,6 +1144,7 @@ TASK_LIST_START
|
||||
TEST_ENTRY (thread_rwlock_trylock)
|
||||
TEST_ENTRY (thread_create)
|
||||
TEST_ENTRY (thread_equal)
|
||||
TEST_ENTRY (thread_affinity)
|
||||
TEST_ENTRY (dlerror)
|
||||
TEST_ENTRY (ip4_addr)
|
||||
TEST_ENTRY (ip6_addr_link_local)
|
||||
@ -1164,6 +1191,8 @@ TASK_LIST_START
|
||||
TEST_ENTRY (readable_on_eof)
|
||||
TEST_HELPER (readable_on_eof, tcp4_echo_server)
|
||||
|
||||
TEST_ENTRY (metrics_info_check)
|
||||
TEST_ENTRY (metrics_pool_events)
|
||||
TEST_ENTRY (metrics_idle_time)
|
||||
TEST_ENTRY (metrics_idle_time_thread)
|
||||
TEST_ENTRY (metrics_idle_time_zero)
|
||||
|
1
deps/libuv/test/test-loop-alive.c
vendored
1
deps/libuv/test/test-loop-alive.c
vendored
@ -63,5 +63,6 @@ TEST_IMPL(loop_alive) {
|
||||
ASSERT(r == 0);
|
||||
ASSERT(!uv_loop_alive(uv_default_loop()));
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-loop-close.c
vendored
4
deps/libuv/test/test-loop-close.c
vendored
@ -62,6 +62,8 @@ static void loop_instant_close_work_cb(uv_work_t* req) {
|
||||
static void loop_instant_close_after_work_cb(uv_work_t* req, int status) {
|
||||
}
|
||||
|
||||
/* It's impossible to properly cleanup after this test because loop can't be
|
||||
* closed while work has been queued. */
|
||||
TEST_IMPL(loop_instant_close) {
|
||||
static uv_loop_t loop;
|
||||
static uv_work_t req;
|
||||
@ -70,6 +72,6 @@ TEST_IMPL(loop_instant_close) {
|
||||
&req,
|
||||
loop_instant_close_work_cb,
|
||||
loop_instant_close_after_work_cb));
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-loop-handles.c
vendored
2
deps/libuv/test/test-loop-handles.c
vendored
@ -332,6 +332,6 @@ TEST_IMPL(loop_handles) {
|
||||
ASSERT(idle_2_close_cb_called == idle_2_cb_started);
|
||||
ASSERT(idle_2_is_active == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
1
deps/libuv/test/test-loop-stop.c
vendored
1
deps/libuv/test/test-loop-stop.c
vendored
@ -67,5 +67,6 @@ TEST_IMPL(loop_stop) {
|
||||
ASSERT(timer_called == 10);
|
||||
ASSERT(prepare_called == 10);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-loop-time.c
vendored
4
deps/libuv/test/test-loop-time.c
vendored
@ -30,7 +30,7 @@ TEST_IMPL(loop_update_time) {
|
||||
while (uv_now(uv_default_loop()) - start < 1000)
|
||||
ASSERT_EQ(0, uv_run(uv_default_loop(), UV_RUN_NOWAIT));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -64,6 +64,6 @@ TEST_IMPL(loop_backend_timeout) {
|
||||
ASSERT_EQ(r, 0);
|
||||
ASSERT_EQ(uv_backend_timeout(loop), 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
265
deps/libuv/test/test-metrics.c
vendored
265
deps/libuv/test/test-metrics.c
vendored
@ -25,6 +25,17 @@
|
||||
|
||||
#define UV_NS_TO_MS 1000000
|
||||
|
||||
typedef struct {
|
||||
uv_fs_t open_req;
|
||||
uv_fs_t write_req;
|
||||
uv_fs_t close_req;
|
||||
} fs_reqs_t;
|
||||
|
||||
static uint64_t last_events_count;
|
||||
static char test_buf[] = "test-buffer\n";
|
||||
static fs_reqs_t fs_reqs;
|
||||
static int pool_events_counter;
|
||||
|
||||
|
||||
static void timer_spin_cb(uv_timer_t* handle) {
|
||||
uint64_t t;
|
||||
@ -37,6 +48,9 @@ static void timer_spin_cb(uv_timer_t* handle) {
|
||||
|
||||
|
||||
TEST_IMPL(metrics_idle_time) {
|
||||
#if defined(__OpenBSD__)
|
||||
RETURN_SKIP("Test does not currently work in OpenBSD");
|
||||
#endif
|
||||
const uint64_t timeout = 1000;
|
||||
uv_timer_t timer;
|
||||
uint64_t idle_time;
|
||||
@ -55,10 +69,10 @@ TEST_IMPL(metrics_idle_time) {
|
||||
idle_time = uv_metrics_idle_time(uv_default_loop());
|
||||
|
||||
/* Permissive check that the idle time matches within the timeout ±500 ms. */
|
||||
ASSERT((idle_time <= (timeout + 500) * UV_NS_TO_MS) &&
|
||||
(idle_time >= (timeout - 500) * UV_NS_TO_MS));
|
||||
ASSERT_LE(idle_time, (timeout + 500) * UV_NS_TO_MS);
|
||||
ASSERT_GE(idle_time, (timeout - 500) * UV_NS_TO_MS);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -116,6 +130,7 @@ static void timer_noop_cb(uv_timer_t* handle) {
|
||||
|
||||
|
||||
TEST_IMPL(metrics_idle_time_zero) {
|
||||
uv_metrics_t metrics;
|
||||
uv_timer_t timer;
|
||||
int cntr;
|
||||
|
||||
@ -130,6 +145,248 @@ TEST_IMPL(metrics_idle_time_zero) {
|
||||
ASSERT_GT(cntr, 0);
|
||||
ASSERT_EQ(0, uv_metrics_idle_time(uv_default_loop()));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
ASSERT_EQ(0, uv_metrics_info(uv_default_loop(), &metrics));
|
||||
ASSERT_UINT64_EQ(cntr, metrics.loop_count);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void close_cb(uv_fs_t* req) {
|
||||
uv_metrics_t metrics;
|
||||
|
||||
ASSERT_EQ(0, uv_metrics_info(uv_default_loop(), &metrics));
|
||||
ASSERT_UINT64_EQ(3, metrics.loop_count);
|
||||
ASSERT_UINT64_GT(metrics.events, last_events_count);
|
||||
|
||||
uv_fs_req_cleanup(req);
|
||||
last_events_count = metrics.events;
|
||||
}
|
||||
|
||||
|
||||
static void write_cb(uv_fs_t* req) {
|
||||
uv_metrics_t metrics;
|
||||
|
||||
ASSERT_EQ(0, uv_metrics_info(uv_default_loop(), &metrics));
|
||||
ASSERT_UINT64_EQ(2, metrics.loop_count);
|
||||
ASSERT_UINT64_GT(metrics.events, last_events_count);
|
||||
ASSERT_EQ(req->result, sizeof(test_buf));
|
||||
|
||||
uv_fs_req_cleanup(req);
|
||||
last_events_count = metrics.events;
|
||||
|
||||
ASSERT_EQ(0, uv_fs_close(uv_default_loop(),
|
||||
&fs_reqs.close_req,
|
||||
fs_reqs.open_req.result,
|
||||
close_cb));
|
||||
}
|
||||
|
||||
|
||||
static void create_cb(uv_fs_t* req) {
|
||||
uv_metrics_t metrics;
|
||||
|
||||
ASSERT_EQ(0, uv_metrics_info(uv_default_loop(), &metrics));
|
||||
/* Event count here is still 0 so not going to check. */
|
||||
ASSERT_UINT64_EQ(1, metrics.loop_count);
|
||||
ASSERT_GE(req->result, 0);
|
||||
|
||||
uv_fs_req_cleanup(req);
|
||||
last_events_count = metrics.events;
|
||||
|
||||
uv_buf_t iov = uv_buf_init(test_buf, sizeof(test_buf));
|
||||
ASSERT_EQ(0, uv_fs_write(uv_default_loop(),
|
||||
&fs_reqs.write_req,
|
||||
req->result,
|
||||
&iov,
|
||||
1,
|
||||
0,
|
||||
write_cb));
|
||||
}
|
||||
|
||||
|
||||
static void prepare_cb(uv_prepare_t* handle) {
|
||||
uv_metrics_t metrics;
|
||||
|
||||
uv_prepare_stop(handle);
|
||||
|
||||
ASSERT_EQ(0, uv_metrics_info(uv_default_loop(), &metrics));
|
||||
ASSERT_UINT64_EQ(0, metrics.loop_count);
|
||||
ASSERT_UINT64_EQ(0, metrics.events);
|
||||
|
||||
ASSERT_EQ(0, uv_fs_open(uv_default_loop(),
|
||||
&fs_reqs.open_req,
|
||||
"test_file",
|
||||
O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR,
|
||||
create_cb));
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(metrics_info_check) {
|
||||
uv_fs_t unlink_req;
|
||||
uv_prepare_t prepare;
|
||||
|
||||
uv_fs_unlink(NULL, &unlink_req, "test_file", NULL);
|
||||
uv_fs_req_cleanup(&unlink_req);
|
||||
|
||||
ASSERT_EQ(0, uv_prepare_init(uv_default_loop(), &prepare));
|
||||
ASSERT_EQ(0, uv_prepare_start(&prepare, prepare_cb));
|
||||
|
||||
ASSERT_EQ(0, uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
|
||||
uv_fs_unlink(NULL, &unlink_req, "test_file", NULL);
|
||||
uv_fs_req_cleanup(&unlink_req);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void fs_prepare_cb(uv_prepare_t* handle) {
|
||||
uv_metrics_t metrics;
|
||||
|
||||
ASSERT_OK(uv_metrics_info(uv_default_loop(), &metrics));
|
||||
|
||||
if (pool_events_counter == 1)
|
||||
ASSERT_EQ(metrics.events, metrics.events_waiting);
|
||||
|
||||
if (pool_events_counter < 7)
|
||||
return;
|
||||
|
||||
uv_prepare_stop(handle);
|
||||
pool_events_counter = -42;
|
||||
}
|
||||
|
||||
|
||||
static void fs_stat_cb(uv_fs_t* req) {
|
||||
uv_fs_req_cleanup(req);
|
||||
pool_events_counter++;
|
||||
}
|
||||
|
||||
|
||||
static void fs_work_cb(uv_work_t* req) {
|
||||
}
|
||||
|
||||
|
||||
static void fs_after_work_cb(uv_work_t* req, int status) {
|
||||
free(req);
|
||||
pool_events_counter++;
|
||||
}
|
||||
|
||||
|
||||
static void fs_write_cb(uv_fs_t* req) {
|
||||
uv_work_t* work1 = malloc(sizeof(*work1));
|
||||
uv_work_t* work2 = malloc(sizeof(*work2));
|
||||
pool_events_counter++;
|
||||
|
||||
uv_fs_req_cleanup(req);
|
||||
|
||||
ASSERT_OK(uv_queue_work(uv_default_loop(),
|
||||
work1,
|
||||
fs_work_cb,
|
||||
fs_after_work_cb));
|
||||
ASSERT_OK(uv_queue_work(uv_default_loop(),
|
||||
work2,
|
||||
fs_work_cb,
|
||||
fs_after_work_cb));
|
||||
}
|
||||
|
||||
|
||||
static void fs_random_cb(uv_random_t* req, int status, void* buf, size_t len) {
|
||||
pool_events_counter++;
|
||||
}
|
||||
|
||||
|
||||
static void fs_addrinfo_cb(uv_getaddrinfo_t* req,
|
||||
int status,
|
||||
struct addrinfo* res) {
|
||||
uv_freeaddrinfo(req->addrinfo);
|
||||
pool_events_counter++;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(metrics_pool_events) {
|
||||
uv_buf_t iov;
|
||||
uv_fs_t open_req;
|
||||
uv_fs_t stat1_req;
|
||||
uv_fs_t stat2_req;
|
||||
uv_fs_t unlink_req;
|
||||
uv_fs_t write_req;
|
||||
uv_getaddrinfo_t addrinfo_req;
|
||||
uv_metrics_t metrics;
|
||||
uv_prepare_t prepare;
|
||||
uv_random_t random_req;
|
||||
int fd;
|
||||
char rdata;
|
||||
|
||||
ASSERT_OK(uv_loop_configure(uv_default_loop(), UV_METRICS_IDLE_TIME));
|
||||
|
||||
uv_fs_unlink(NULL, &unlink_req, "test_file", NULL);
|
||||
uv_fs_req_cleanup(&unlink_req);
|
||||
|
||||
ASSERT_OK(uv_prepare_init(uv_default_loop(), &prepare));
|
||||
ASSERT_OK(uv_prepare_start(&prepare, fs_prepare_cb));
|
||||
|
||||
pool_events_counter = 0;
|
||||
fd = uv_fs_open(NULL,
|
||||
&open_req,
|
||||
"test_file",
|
||||
O_WRONLY | O_CREAT,
|
||||
S_IRUSR | S_IWUSR,
|
||||
NULL);
|
||||
ASSERT_GT(fd, 0);
|
||||
uv_fs_req_cleanup(&open_req);
|
||||
|
||||
iov = uv_buf_init(test_buf, sizeof(test_buf));
|
||||
ASSERT_OK(uv_fs_write(uv_default_loop(),
|
||||
&write_req,
|
||||
fd,
|
||||
&iov,
|
||||
1,
|
||||
0,
|
||||
fs_write_cb));
|
||||
ASSERT_OK(uv_fs_stat(uv_default_loop(),
|
||||
&stat1_req,
|
||||
"test_file",
|
||||
fs_stat_cb));
|
||||
ASSERT_OK(uv_fs_stat(uv_default_loop(),
|
||||
&stat2_req,
|
||||
"test_file",
|
||||
fs_stat_cb));
|
||||
ASSERT_OK(uv_random(uv_default_loop(),
|
||||
&random_req,
|
||||
&rdata,
|
||||
1,
|
||||
0,
|
||||
fs_random_cb));
|
||||
ASSERT_OK(uv_getaddrinfo(uv_default_loop(),
|
||||
&addrinfo_req,
|
||||
fs_addrinfo_cb,
|
||||
"example.invalid",
|
||||
NULL,
|
||||
NULL));
|
||||
|
||||
/* Sleep for a moment to hopefully force the events to complete before
|
||||
* entering the event loop. */
|
||||
uv_sleep(100);
|
||||
|
||||
ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
|
||||
ASSERT_OK(uv_metrics_info(uv_default_loop(), &metrics));
|
||||
/* It's possible for uv__work_done() to execute one extra time even though the
|
||||
* QUEUE has already been cleared out. This has to do with the way we use an
|
||||
* uv_async to tell the event loop thread to process the worker pool QUEUE. */
|
||||
ASSERT_GE(metrics.events, 7);
|
||||
/* It's possible one of the other events also got stuck in the event queue, so
|
||||
* check GE instead of EQ. Reason for 4 instead of 5 is because the call to
|
||||
* uv_getaddrinfo() is racey and slow. So can't guarantee that it'll always
|
||||
* execute before sleep completes. */
|
||||
ASSERT_GE(metrics.events_waiting, 4);
|
||||
ASSERT_EQ(pool_events_counter, -42);
|
||||
|
||||
uv_fs_unlink(NULL, &unlink_req, "test_file", NULL);
|
||||
uv_fs_req_cleanup(&unlink_req);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-multiple-listen.c
vendored
2
deps/libuv/test/test-multiple-listen.c
vendored
@ -104,6 +104,6 @@ TEST_IMPL(multiple_listen) {
|
||||
ASSERT(connect_cb_called == 1);
|
||||
ASSERT(close_cb_called == 2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
@ -99,6 +99,6 @@ TEST_IMPL(not_readable_nor_writable_on_read_error) {
|
||||
ASSERT(write_cb_called == 1);
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(&loop);
|
||||
return 0;
|
||||
}
|
||||
|
@ -61,9 +61,9 @@ TEST_IMPL(not_writable_after_shutdown) {
|
||||
connect_cb);
|
||||
ASSERT(r == 0);
|
||||
|
||||
r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
r = uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(r == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-osx-select.c
vendored
4
deps/libuv/test/test-osx-select.c
vendored
@ -79,7 +79,7 @@ TEST_IMPL(osx_select) {
|
||||
|
||||
ASSERT(read_count == 3);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ TEST_IMPL(osx_select_many_fds) {
|
||||
|
||||
ASSERT(read_count == 3);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
deps/libuv/test/test-ping-pong.c
vendored
2
deps/libuv/test/test-ping-pong.c
vendored
@ -378,7 +378,7 @@ static int run_ping_pong_test(void) {
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
ASSERT_EQ(completed_pingers, 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
10
deps/libuv/test/test-pipe-bind-error.c
vendored
10
deps/libuv/test/test-pipe-bind-error.c
vendored
@ -67,7 +67,7 @@ TEST_IMPL(pipe_bind_error_addrinuse) {
|
||||
|
||||
ASSERT(close_cb_called == 2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ TEST_IMPL(pipe_bind_error_addrnotavail) {
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ TEST_IMPL(pipe_bind_error_inval) {
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ TEST_IMPL(pipe_listen_without_bind) {
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -150,6 +150,6 @@ TEST_IMPL(pipe_bind_or_listen_error_after_close) {
|
||||
|
||||
ASSERT_EQ(uv_run(uv_default_loop(), UV_RUN_DEFAULT), 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ TEST_IMPL(pipe_close_stdout_read_stdin) {
|
||||
ASSERT(WIFEXITED(status) && WEXITSTATUS(status) == 0);
|
||||
}
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
26
deps/libuv/test/test-pipe-connect-error.c
vendored
26
deps/libuv/test/test-pipe-connect-error.c
vendored
@ -43,15 +43,17 @@ static void close_cb(uv_handle_t* handle) {
|
||||
|
||||
|
||||
static void connect_cb(uv_connect_t* connect_req, int status) {
|
||||
ASSERT(status == UV_ENOENT);
|
||||
uv_close((uv_handle_t*)connect_req->handle, close_cb);
|
||||
ASSERT_EQ(status, UV_ENOENT);
|
||||
uv_close((uv_handle_t*) connect_req->handle, close_cb);
|
||||
connect_cb_called++;
|
||||
}
|
||||
|
||||
|
||||
static void connect_cb_file(uv_connect_t* connect_req, int status) {
|
||||
ASSERT(status == UV_ENOTSOCK || status == UV_ECONNREFUSED);
|
||||
uv_close((uv_handle_t*)connect_req->handle, close_cb);
|
||||
if (status != UV_ENOTSOCK)
|
||||
if (status != UV_EACCES)
|
||||
ASSERT_EQ(status, UV_ECONNREFUSED);
|
||||
uv_close((uv_handle_t*) connect_req->handle, close_cb);
|
||||
connect_cb_called++;
|
||||
}
|
||||
|
||||
@ -62,15 +64,15 @@ TEST_IMPL(pipe_connect_bad_name) {
|
||||
int r;
|
||||
|
||||
r = uv_pipe_init(uv_default_loop(), &client, 0);
|
||||
ASSERT(r == 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
uv_pipe_connect(&req, &client, BAD_PIPENAME, connect_cb);
|
||||
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
ASSERT(connect_cb_called == 1);
|
||||
ASSERT_EQ(close_cb_called, 1);
|
||||
ASSERT_EQ(connect_cb_called, 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -82,14 +84,14 @@ TEST_IMPL(pipe_connect_to_file) {
|
||||
int r;
|
||||
|
||||
r = uv_pipe_init(uv_default_loop(), &client, 0);
|
||||
ASSERT(r == 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
uv_pipe_connect(&req, &client, path, connect_cb_file);
|
||||
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
ASSERT(connect_cb_called == 1);
|
||||
ASSERT_EQ(close_cb_called, 1);
|
||||
ASSERT_EQ(connect_cb_called, 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
75
deps/libuv/test/test-pipe-connect-multiple.c
vendored
75
deps/libuv/test/test-pipe-connect-multiple.c
vendored
@ -29,7 +29,7 @@
|
||||
static int connection_cb_called = 0;
|
||||
static int connect_cb_called = 0;
|
||||
|
||||
#define NUM_CLIENTS 4
|
||||
#define NUM_CLIENTS 10
|
||||
|
||||
typedef struct {
|
||||
uv_pipe_t pipe_handle;
|
||||
@ -102,6 +102,77 @@ TEST_IMPL(pipe_connect_multiple) {
|
||||
ASSERT(connection_cb_called == NUM_CLIENTS);
|
||||
ASSERT(connect_cb_called == NUM_CLIENTS);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void connection_cb2(uv_stream_t* server, int status) {
|
||||
int r;
|
||||
uv_pipe_t* conn;
|
||||
ASSERT_EQ(status, 0);
|
||||
|
||||
conn = &connections[connection_cb_called];
|
||||
r = uv_pipe_init(server->loop, conn, 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
r = uv_accept(server, (uv_stream_t*)conn);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
uv_close((uv_handle_t*)conn, NULL);
|
||||
if (++connection_cb_called == NUM_CLIENTS &&
|
||||
connect_cb_called == NUM_CLIENTS) {
|
||||
uv_close((uv_handle_t*)&server_handle, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void connect_cb2(uv_connect_t* connect_req, int status) {
|
||||
ASSERT_EQ(status, UV_ECANCELED);
|
||||
if (++connect_cb_called == NUM_CLIENTS &&
|
||||
connection_cb_called == NUM_CLIENTS) {
|
||||
uv_close((uv_handle_t*)&server_handle, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(pipe_connect_close_multiple) {
|
||||
#if defined(NO_SELF_CONNECT)
|
||||
RETURN_SKIP(NO_SELF_CONNECT);
|
||||
#endif
|
||||
int i;
|
||||
int r;
|
||||
uv_loop_t* loop;
|
||||
|
||||
loop = uv_default_loop();
|
||||
|
||||
r = uv_pipe_init(loop, &server_handle, 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
r = uv_pipe_bind(&server_handle, TEST_PIPENAME);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
r = uv_listen((uv_stream_t*)&server_handle, 128, connection_cb2);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
for (i = 0; i < NUM_CLIENTS; i++) {
|
||||
r = uv_pipe_init(loop, &clients[i].pipe_handle, 0);
|
||||
ASSERT_EQ(r, 0);
|
||||
uv_pipe_connect(&clients[i].conn_req,
|
||||
&clients[i].pipe_handle,
|
||||
TEST_PIPENAME,
|
||||
connect_cb2);
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_CLIENTS; i++) {
|
||||
uv_close((uv_handle_t*)&clients[i].pipe_handle, NULL);
|
||||
}
|
||||
|
||||
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
|
||||
ASSERT_EQ(connection_cb_called, NUM_CLIENTS);
|
||||
ASSERT_EQ(connect_cb_called, NUM_CLIENTS);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-pipe-connect-prepare.c
vendored
2
deps/libuv/test/test-pipe-connect-prepare.c
vendored
@ -78,6 +78,6 @@ TEST_IMPL(pipe_connect_on_prepare) {
|
||||
ASSERT(close_cb_called == 2);
|
||||
ASSERT(connect_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
8
deps/libuv/test/test-pipe-getsockname.c
vendored
8
deps/libuv/test/test-pipe-getsockname.c
vendored
@ -156,7 +156,7 @@ TEST_IMPL(pipe_getsockname) {
|
||||
ASSERT(pipe_client_connect_cb_called == 1);
|
||||
ASSERT(pipe_close_cb_called == 2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -200,10 +200,10 @@ TEST_IMPL(pipe_getsockname_abstract) {
|
||||
close(sock);
|
||||
|
||||
ASSERT(pipe_close_cb_called == 1);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
#else
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@ -265,6 +265,6 @@ TEST_IMPL(pipe_getsockname_blocking) {
|
||||
CloseHandle(writeh);
|
||||
#endif
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
@ -54,6 +54,6 @@ TEST_IMPL(pipe_pending_instances) {
|
||||
r = uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(r == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-pipe-sendmsg.c
vendored
4
deps/libuv/test/test-pipe-sendmsg.c
vendored
@ -158,14 +158,14 @@ TEST_IMPL(pipe_sendmsg) {
|
||||
ASSERT(ARRAY_SIZE(incoming) + 1 == close_called);
|
||||
close(fds[0]);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !_WIN32 */
|
||||
|
||||
TEST_IMPL(pipe_sendmsg) {
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
deps/libuv/test/test-pipe-server-close.c
vendored
2
deps/libuv/test/test-pipe-server-close.c
vendored
@ -89,6 +89,6 @@ TEST_IMPL(pipe_server_close) {
|
||||
ASSERT(pipe_client_connect_cb_called == 1);
|
||||
ASSERT(pipe_close_cb_called == 2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
8
deps/libuv/test/test-pipe-set-fchmod.c
vendored
8
deps/libuv/test/test-pipe-set-fchmod.c
vendored
@ -22,6 +22,7 @@
|
||||
|
||||
#include "uv.h"
|
||||
#include "task.h"
|
||||
#include <string.h>
|
||||
|
||||
TEST_IMPL(pipe_set_chmod) {
|
||||
uv_pipe_t pipe_handle;
|
||||
@ -43,12 +44,13 @@ TEST_IMPL(pipe_set_chmod) {
|
||||
* successful. */
|
||||
r = uv_pipe_chmod(&pipe_handle, UV_READABLE);
|
||||
if (r == UV_EPERM) {
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
RETURN_SKIP("Insufficient privileges to alter pipe fmode");
|
||||
}
|
||||
ASSERT(r == 0);
|
||||
#ifndef _WIN32
|
||||
stat(TEST_PIPENAME, &stat_buf);
|
||||
memset(&stat_buf, 0, sizeof(stat_buf));
|
||||
ASSERT_EQ(0, stat(TEST_PIPENAME, &stat_buf));
|
||||
ASSERT(stat_buf.st_mode & S_IRUSR);
|
||||
ASSERT(stat_buf.st_mode & S_IRGRP);
|
||||
ASSERT(stat_buf.st_mode & S_IROTH);
|
||||
@ -85,6 +87,6 @@ TEST_IMPL(pipe_set_chmod) {
|
||||
r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE | UV_READABLE);
|
||||
ASSERT(r == UV_EBADF);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-pipe-set-non-blocking.c
vendored
2
deps/libuv/test/test-pipe-set-non-blocking.c
vendored
@ -122,6 +122,6 @@ TEST_IMPL(pipe_set_non_blocking) {
|
||||
fd[0] = -1;
|
||||
uv_barrier_destroy(&ctx.barrier);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
36
deps/libuv/test/test-platform-output.c
vendored
36
deps/libuv/test/test-platform-output.c
vendored
@ -25,11 +25,6 @@
|
||||
|
||||
|
||||
TEST_IMPL(platform_output) {
|
||||
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||
#if defined(__QEMU__)
|
||||
RETURN_SKIP("Test does not currently work in QEMU");
|
||||
#endif
|
||||
|
||||
char buffer[512];
|
||||
size_t rss;
|
||||
size_t size;
|
||||
@ -40,8 +35,10 @@ TEST_IMPL(platform_output) {
|
||||
uv_cpu_info_t* cpus;
|
||||
uv_interface_address_t* interfaces;
|
||||
uv_passwd_t pwd;
|
||||
uv_group_t grp;
|
||||
uv_utsname_t uname;
|
||||
unsigned par;
|
||||
char* const* member;
|
||||
int count;
|
||||
int i;
|
||||
int err;
|
||||
@ -152,15 +149,38 @@ TEST_IMPL(platform_output) {
|
||||
uv_free_interface_addresses(interfaces, count);
|
||||
|
||||
err = uv_os_get_passwd(&pwd);
|
||||
ASSERT(err == 0);
|
||||
ASSERT_EQ(err, 0);
|
||||
|
||||
err = uv_os_get_group(&grp, pwd.gid);
|
||||
#if defined(_WIN32)
|
||||
ASSERT_EQ(err, UV_ENOTSUP);
|
||||
ASSERT_EQ(pwd.uid, (unsigned long) -1);
|
||||
ASSERT_EQ(pwd.gid, (unsigned long) -1);
|
||||
(void) member;
|
||||
grp.groupname = "ENOTSUP";
|
||||
#else
|
||||
ASSERT_EQ(err, 0);
|
||||
ASSERT_EQ(pwd.gid, grp.gid);
|
||||
#endif
|
||||
|
||||
printf("uv_os_get_passwd:\n");
|
||||
printf(" euid: %ld\n", pwd.uid);
|
||||
printf(" gid: %ld\n", pwd.gid);
|
||||
printf(" gid: %ld (%s)\n", pwd.gid, grp.groupname);
|
||||
#if !defined(_WIN32)
|
||||
printf(" members: [");
|
||||
for (member = grp.members; *member != NULL; member++) {
|
||||
printf(" %s", *member);
|
||||
}
|
||||
printf(" ]\n");
|
||||
#endif
|
||||
printf(" username: %s\n", pwd.username);
|
||||
printf(" shell: %s\n", pwd.shell);
|
||||
if (pwd.shell != NULL) /* Not set on Windows */
|
||||
printf(" shell: %s\n", pwd.shell);
|
||||
printf(" home directory: %s\n", pwd.homedir);
|
||||
uv_os_free_passwd(&pwd);
|
||||
#if !defined(_WIN32)
|
||||
uv_os_free_group(&grp);
|
||||
#endif
|
||||
|
||||
pid = uv_os_getpid();
|
||||
ASSERT(pid > 0);
|
||||
|
@ -108,7 +108,7 @@ TEST_IMPL(poll_close_doesnt_corrupt_stack) {
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
2
deps/libuv/test/test-poll-close.c
vendored
2
deps/libuv/test/test-poll-close.c
vendored
@ -68,6 +68,6 @@ TEST_IMPL(poll_close) {
|
||||
|
||||
ASSERT(close_cb_called == NUM_SOCKETS);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-poll-closesocket.c
vendored
2
deps/libuv/test/test-poll-closesocket.c
vendored
@ -86,7 +86,7 @@ TEST_IMPL(poll_closesocket) {
|
||||
|
||||
ASSERT(close_cb_called == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
2
deps/libuv/test/test-poll-multiple-handles.c
vendored
2
deps/libuv/test/test-poll-multiple-handles.c
vendored
@ -94,6 +94,6 @@ TEST_IMPL(poll_multiple_handles) {
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
ASSERT(close_cb_called == 2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-poll-oob.c
vendored
2
deps/libuv/test/test-poll-oob.c
vendored
@ -199,7 +199,7 @@ TEST_IMPL(poll_oob) {
|
||||
*/
|
||||
ASSERT(srv_rd_check == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
10
deps/libuv/test/test-poll.c
vendored
10
deps/libuv/test/test-poll.c
vendored
@ -589,7 +589,7 @@ static void start_poll_test(void) {
|
||||
#if !defined(__sun) && !defined(_AIX) && !defined(__MVS__)
|
||||
ASSERT(disconnects == NUM_CLIENTS * 2);
|
||||
#endif
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
}
|
||||
|
||||
|
||||
@ -631,7 +631,7 @@ TEST_IMPL(poll_unidirectional) {
|
||||
*/
|
||||
TEST_IMPL(poll_bad_fdtype) {
|
||||
#if !defined(__DragonFly__) && !defined(__FreeBSD__) && !defined(__sun) && \
|
||||
!defined(_AIX) && !defined(__MVS__) && !defined(__FreeBSD_kernel__) && \
|
||||
!defined(_AIX) && !defined(__MVS__) && \
|
||||
!defined(__OpenBSD__) && !defined(__CYGWIN__) && !defined(__MSYS__) && \
|
||||
!defined(__NetBSD__)
|
||||
uv_poll_t poll_handle;
|
||||
@ -647,7 +647,7 @@ TEST_IMPL(poll_bad_fdtype) {
|
||||
ASSERT(0 == close(fd));
|
||||
#endif
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -668,7 +668,7 @@ TEST_IMPL(poll_nested_epoll) {
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
ASSERT(0 == close(fd));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
@ -690,7 +690,7 @@ TEST_IMPL(poll_nested_kqueue) {
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
ASSERT(0 == close(fd));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
#endif /* UV_HAVE_KQUEUE */
|
||||
|
2
deps/libuv/test/test-process-title.c
vendored
2
deps/libuv/test/test-process-title.c
vendored
@ -120,7 +120,7 @@ TEST_IMPL(process_title_big_argv) {
|
||||
ASSERT(0 == uv_spawn(uv_default_loop(), &process, &options));
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
deps/libuv/test/test-queue-foreach-delete.c
vendored
2
deps/libuv/test/test-queue-foreach-delete.c
vendored
@ -198,7 +198,7 @@ TEST_IMPL(queue_foreach_delete) {
|
||||
ASSERT(helper_timer_cb_calls == 1);
|
||||
#endif
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
4
deps/libuv/test/test-random.c
vendored
4
deps/libuv/test/test-random.c
vendored
@ -70,7 +70,7 @@ TEST_IMPL(random_async) {
|
||||
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
|
||||
ASSERT(2 == random_cb_called);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -89,6 +89,6 @@ TEST_IMPL(random_sync) {
|
||||
memset(zero, 0, sizeof(zero));
|
||||
ASSERT(0 != memcmp(buf, zero, sizeof(zero)));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-readable-on-eof.c
vendored
2
deps/libuv/test/test-readable-on-eof.c
vendored
@ -106,6 +106,6 @@ TEST_IMPL(readable_on_eof) {
|
||||
ASSERT_EQ(write_cb_called, 1);
|
||||
ASSERT_EQ(close_cb_called, 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(&loop);
|
||||
return 0;
|
||||
}
|
||||
|
48
deps/libuv/test/test-ref.c
vendored
48
deps/libuv/test/test-ref.c
vendored
@ -101,7 +101,7 @@ static void connect_and_shutdown(uv_connect_t* req, int status) {
|
||||
|
||||
TEST_IMPL(ref) {
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ TEST_IMPL(idle_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ TEST_IMPL(async_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ TEST_IMPL(prepare_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ TEST_IMPL(check_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ TEST_IMPL(unref_in_prepare_cb) {
|
||||
uv_prepare_start(&h, prepare_cb);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ TEST_IMPL(timer_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ TEST_IMPL(timer_ref2) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ TEST_IMPL(fs_event_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ TEST_IMPL(fs_poll_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ TEST_IMPL(tcp_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ TEST_IMPL(tcp_ref2) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ TEST_IMPL(tcp_ref2b) {
|
||||
uv_close((uv_handle_t*)&h, close_cb);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
ASSERT(close_cb_called == 1);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ TEST_IMPL(tcp_ref3) {
|
||||
ASSERT(connect_cb_called == 1);
|
||||
ASSERT(shutdown_cb_called == 1);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ TEST_IMPL(tcp_ref4) {
|
||||
ASSERT(write_cb_called == 1);
|
||||
ASSERT(shutdown_cb_called == 1);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ TEST_IMPL(udp_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ TEST_IMPL(udp_ref2) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ TEST_IMPL(udp_ref3) {
|
||||
ASSERT(req_cb_called == 1);
|
||||
do_close(&h);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ TEST_IMPL(pipe_ref) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ TEST_IMPL(pipe_ref2) {
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -377,7 +377,7 @@ TEST_IMPL(pipe_ref3) {
|
||||
ASSERT(connect_cb_called == 1);
|
||||
ASSERT(shutdown_cb_called == 1);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -392,7 +392,7 @@ TEST_IMPL(pipe_ref4) {
|
||||
ASSERT(write_cb_called == 1);
|
||||
ASSERT(shutdown_cb_called == 1);
|
||||
do_close(&h);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ TEST_IMPL(process_ref) {
|
||||
|
||||
do_close(&h);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -440,6 +440,6 @@ TEST_IMPL(has_ref) {
|
||||
ASSERT(uv_has_ref((uv_handle_t*)&h) == 1);
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
ASSERT(uv_has_ref((uv_handle_t*)&h) == 0);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
1
deps/libuv/test/test-run-nowait.c
vendored
1
deps/libuv/test/test-run-nowait.c
vendored
@ -41,5 +41,6 @@ TEST_IMPL(run_nowait) {
|
||||
ASSERT(r != 0);
|
||||
ASSERT(timer_called == 0);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
2
deps/libuv/test/test-run-once.c
vendored
2
deps/libuv/test/test-run-once.c
vendored
@ -43,6 +43,6 @@ TEST_IMPL(run_once) {
|
||||
while (uv_run(uv_default_loop(), UV_RUN_ONCE));
|
||||
ASSERT(idle_counter == NUM_TICKS);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user