aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-05 16:53:29 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-02-05 16:53:29 -0500
commit704cd977bdcdfa8cff4e70aaad93857d9b622fc7 (patch)
tree028ddaa40366b2a3b487751926f8d8d81cde88c4 /src/main.cpp
parent84323504acc2c872a55d0b59ff2c54b60b809405 (diff)
downloadzig-704cd977bdcdfa8cff4e70aaad93857d9b622fc7.tar.gz
zig-704cd977bdcdfa8cff4e70aaad93857d9b622fc7.zip
ability to run tests in evented I/O mode
This adds `--test-evented-io` as a CLI parameter. see #3117
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 991b46b320..78bdbe1541 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -135,6 +135,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
" --test-name-prefix [text] add prefix to all tests\n"
" --test-cmd [arg] specify test execution command one arg at a time\n"
" --test-cmd-bin appends test binary path to test cmd args\n"
+ " --test-evented-io runs the test in evented I/O mode\n"
, arg0);
return return_code;
}
@@ -428,6 +429,7 @@ int main(int argc, char **argv) {
ZigList<CFile *> c_source_files = {0};
const char *test_filter = nullptr;
const char *test_name_prefix = nullptr;
+ bool test_evented_io = false;
size_t ver_major = 0;
size_t ver_minor = 0;
size_t ver_patch = 0;
@@ -709,6 +711,8 @@ int main(int argc, char **argv) {
cur_pkg = cur_pkg->parent;
} else if (strcmp(arg, "-ffunction-sections") == 0) {
function_sections = true;
+ } else if (strcmp(arg, "--test-evented-io") == 0) {
+ test_evented_io = true;
} else if (i + 1 >= argc) {
fprintf(stderr, "Expected another argument after %s\n", arg);
return print_error_usage(arg0);
@@ -1059,6 +1063,7 @@ int main(int argc, char **argv) {
g->want_stack_check = want_stack_check;
g->want_sanitize_c = want_sanitize_c;
g->want_single_threaded = want_single_threaded;
+ g->test_is_evented = test_evented_io;
Buf *builtin_source = codegen_generate_builtin_source(g);
if (fwrite(buf_ptr(builtin_source), 1, buf_len(builtin_source), stdout) != buf_len(builtin_source)) {
fprintf(stderr, "unable to write to stdout: %s\n", strerror(ferror(stdout)));
@@ -1232,6 +1237,7 @@ int main(int argc, char **argv) {
if (test_filter) {
codegen_set_test_filter(g, buf_create_from_str(test_filter));
}
+ g->test_is_evented = test_evented_io;
if (test_name_prefix) {
codegen_set_test_name_prefix(g, buf_create_from_str(test_name_prefix));