mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-05 03:06:38 +00:00
Update libuv
This commit is contained in:
+29
-73
@@ -28,31 +28,6 @@
|
||||
|
||||
char executable_path[sizeof(executable_path)];
|
||||
|
||||
int tap_output = 0;
|
||||
|
||||
|
||||
static void log_progress(int total,
|
||||
int passed,
|
||||
int failed,
|
||||
int todos,
|
||||
int skipped,
|
||||
const char* name) {
|
||||
int progress;
|
||||
|
||||
if (total == 0)
|
||||
total = 1;
|
||||
|
||||
progress = 100 * (passed + failed + skipped + todos) / total;
|
||||
fprintf(stderr, "[%% %3d|+ %3d|- %3d|T %3d|S %3d]: %s",
|
||||
progress,
|
||||
passed,
|
||||
failed,
|
||||
todos,
|
||||
skipped,
|
||||
name);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
const char* fmt(double d) {
|
||||
static char buf[1024];
|
||||
@@ -95,7 +70,6 @@ int run_tests(int benchmark_output) {
|
||||
int total;
|
||||
int passed;
|
||||
int failed;
|
||||
int todos;
|
||||
int skipped;
|
||||
int current;
|
||||
int test_result;
|
||||
@@ -109,15 +83,12 @@ int run_tests(int benchmark_output) {
|
||||
}
|
||||
}
|
||||
|
||||
if (tap_output) {
|
||||
fprintf(stderr, "1..%d\n", total);
|
||||
fflush(stderr);
|
||||
}
|
||||
fprintf(stderr, "1..%d\n", total);
|
||||
fflush(stderr);
|
||||
|
||||
/* Run all tests. */
|
||||
passed = 0;
|
||||
failed = 0;
|
||||
todos = 0;
|
||||
skipped = 0;
|
||||
current = 1;
|
||||
for (task = TASKS; task->main; task++) {
|
||||
@@ -125,30 +96,15 @@ int run_tests(int benchmark_output) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!tap_output)
|
||||
rewind_cursor();
|
||||
|
||||
if (!benchmark_output && !tap_output) {
|
||||
log_progress(total, passed, failed, todos, skipped, task->task_name);
|
||||
}
|
||||
|
||||
test_result = run_test(task->task_name, benchmark_output, current);
|
||||
switch (test_result) {
|
||||
case TEST_OK: passed++; break;
|
||||
case TEST_TODO: todos++; break;
|
||||
case TEST_SKIP: skipped++; break;
|
||||
default: failed++;
|
||||
}
|
||||
current++;
|
||||
}
|
||||
|
||||
if (!tap_output)
|
||||
rewind_cursor();
|
||||
|
||||
if (!benchmark_output && !tap_output) {
|
||||
log_progress(total, passed, failed, todos, skipped, "Done.\n");
|
||||
}
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
@@ -166,10 +122,6 @@ void log_tap_result(int test_count,
|
||||
result = "ok";
|
||||
directive = "";
|
||||
break;
|
||||
case TEST_TODO:
|
||||
result = "not ok";
|
||||
directive = " # TODO ";
|
||||
break;
|
||||
case TEST_SKIP:
|
||||
result = "ok";
|
||||
directive = " # SKIP ";
|
||||
@@ -179,8 +131,7 @@ void log_tap_result(int test_count,
|
||||
directive = "";
|
||||
}
|
||||
|
||||
if ((status == TEST_SKIP || status == TEST_TODO) &&
|
||||
process_output_size(process) > 0) {
|
||||
if (status == TEST_SKIP && process_output_size(process) > 0) {
|
||||
process_read_last_line(process, reason, sizeof reason);
|
||||
} else {
|
||||
reason[0] = '\0';
|
||||
@@ -194,7 +145,7 @@ void log_tap_result(int test_count,
|
||||
int run_test(const char* test,
|
||||
int benchmark_output,
|
||||
int test_count) {
|
||||
char errmsg[1024] = "no error";
|
||||
char errmsg[1024] = "";
|
||||
process_info_t processes[1024];
|
||||
process_info_t *main_proc;
|
||||
task_entry_t* task;
|
||||
@@ -319,22 +270,13 @@ out:
|
||||
FATAL("process_wait failed");
|
||||
}
|
||||
|
||||
if (tap_output)
|
||||
log_tap_result(test_count, test, status, &processes[i]);
|
||||
log_tap_result(test_count, test, status, &processes[i]);
|
||||
|
||||
/* Show error and output from processes if the test failed. */
|
||||
if (status != 0 || task->show_output) {
|
||||
if (tap_output) {
|
||||
fprintf(stderr, "#");
|
||||
} else if (status == TEST_TODO) {
|
||||
fprintf(stderr, "\n`%s` todo\n", test);
|
||||
} else if (status == TEST_SKIP) {
|
||||
fprintf(stderr, "\n`%s` skipped\n", test);
|
||||
} else if (status != 0) {
|
||||
fprintf(stderr, "\n`%s` failed: %s\n", test, errmsg);
|
||||
} else {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if ((status != TEST_OK && status != TEST_SKIP) || task->show_output) {
|
||||
if (strlen(errmsg) > 0)
|
||||
fprintf(stderr, "# %s\n", errmsg);
|
||||
fprintf(stderr, "# ");
|
||||
fflush(stderr);
|
||||
|
||||
for (i = 0; i < process_count; i++) {
|
||||
@@ -354,15 +296,11 @@ out:
|
||||
default:
|
||||
fprintf(stderr, "Output from process `%s`:\n", process_get_name(&processes[i]));
|
||||
fflush(stderr);
|
||||
process_copy_output(&processes[i], fileno(stderr));
|
||||
process_copy_output(&processes[i], stderr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tap_output) {
|
||||
fprintf(stderr, "=============================================================\n");
|
||||
}
|
||||
|
||||
/* In benchmark mode show concise output from the main process. */
|
||||
} else if (benchmark_output) {
|
||||
switch (process_output_size(main_proc)) {
|
||||
@@ -378,7 +316,7 @@ out:
|
||||
|
||||
default:
|
||||
for (i = 0; i < process_count; i++) {
|
||||
process_copy_output(&processes[i], fileno(stderr));
|
||||
process_copy_output(&processes[i], stderr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -464,3 +402,21 @@ void print_tests(FILE* stream) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void print_lines(const char* buffer, size_t size, FILE* stream) {
|
||||
const char* start;
|
||||
const char* end;
|
||||
|
||||
start = buffer;
|
||||
while ((end = memchr(start, '\n', &buffer[size] - start))) {
|
||||
fprintf(stream, "# %.*s\n", (int) (end - start), start);
|
||||
fflush(stream);
|
||||
start = end + 1;
|
||||
}
|
||||
|
||||
if (start < &buffer[size]) {
|
||||
fprintf(stream, "# %s\n", start);
|
||||
fflush(stream);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user