diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0caaf22..2592135 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -139,7 +139,9 @@ static void usageBuild(bool run) printf(" --lto Use link-time optimization. May increase compile times - Optional (default: not used)\n"); printf(" --debug-symbols Include debug symbols in release mode - Optional (default: not used)\n"); printf(" --linker=linker The linker to use. \"gold\" is the default linker when using gcc\n"); - if(!run) { + if(run) { + printf(" --args <args...> A list of arguments to run the program with\n"); + } else { printf(" --skip-compile Skip compilation. This can be used to generate a compile_commands.json file without compiling. Note that the compile_commands.json can miss files that are generated when this option is used\n"); } printf("Examples:\n"); @@ -182,6 +184,7 @@ static void usageTest() printf(" --all-files Test all files - Optional (default: not used), Only applicable for Zig\n"); printf(" --linker=linker The linker to use. \"gold\" is the default linker when using gcc\n"); printf(" --skip-compile Skip compilation. This can be used to generate a compile_commands.json file without compiling. Note that the compile_commands.json can miss files that are generated when this option is used. This option also skips running the tests\n"); + printf(" --args <args...> A list of arguments to run the program with\n"); printf("Examples:\n"); printf(" sibs test\n"); printf(" sibs test dirA/dirB\n"); @@ -683,6 +686,7 @@ static int testProject(int argc, const _tinydir_char_t **argv) bool buildOnly = false; bool skipCompile = false; std::string linker; + std::vector<FileString> run_args; for(int i = 0; i < argc; ++i) { @@ -768,6 +772,11 @@ static int testProject(int argc, const _tinydir_char_t **argv) usageTest(); } } + else if(_tinydir_strcmp(arg, TINYDIR_STRING("--args")) == 0) + { + run_args.insert(run_args.end(), argv + i + 1, argv + argc); + break; + } else if(_tinydir_strncmp(arg, TINYDIR_STRING("--"), 2) == 0) { ferr << "Error: Invalid argument " << arg << endl; @@ -861,6 +870,7 @@ static int testProject(int argc, const _tinydir_char_t **argv) sibsConfig.zigTestAllFiles = testAllFiles; sibsConfig.testsBuildOnly = buildOnly; sibsConfig.skipCompile = skipCompile; + sibsConfig.testRunArgs = std::move(run_args); return buildProject(projectPath, projectConfFilePath, sibsConfig, false, {}); } |