diff --git a/releasenotes.md b/releasenotes.md index 1fc7497b6..835c3e409 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -80,6 +80,7 @@ - Compiler segfault when getting a nonexistant member from an unnamed struct #2533. - Correctly mention aliased type when method is not implemented #2534. - Regression: Not printing backtrace when tests fail for MacOS #2536. +- Name property would be used even under `c3c test` #2587. ### Stdlib changes - Sorting functions correctly took slices by value, but also other types by value. Now, only slices are accepted by value, other containers are always by ref. diff --git a/src/build/build.h b/src/build/build.h index 35c79f873..44d923217 100644 --- a/src/build/build.h +++ b/src/build/build.h @@ -514,6 +514,7 @@ typedef struct BuildOptions_ const char **feature_names; const char **removed_feature_names; const char *output_name; + const char *runner_output_name; const char *project_name; const char *target_select; const char *path; @@ -673,6 +674,7 @@ typedef struct Library **library_list; LibraryTarget **ccompiling_libraries; const char *name; + const char *runner_output_name; const char *output_name; const char *extension; const char *version; diff --git a/src/build/build_options.c b/src/build/build_options.c index d77b2ac87..c938bea2e 100644 --- a/src/build/build_options.c +++ b/src/build/build_options.c @@ -599,7 +599,7 @@ static void parse_option(BuildOptions *options) if (match_shortopt("o")) { if (at_end()) error_exit("error: -o needs a name."); - options->output_name = next_arg(); + options->runner_output_name = options->output_name = next_arg(); return; } break; diff --git a/src/build/builder.c b/src/build/builder.c index 05ba15925..0107dcc97 100644 --- a/src/build/builder.c +++ b/src/build/builder.c @@ -644,6 +644,7 @@ void init_default_build_target(BuildTarget *target, BuildOptions *options) target->source_dirs = NULL; target->name = options->output_name; target->output_name = options->output_name; + target->runner_output_name = options->runner_output_name; update_build_target_from_options(target, options); } diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c index 3393664b0..335d40f03 100644 --- a/src/compiler/compiler.c +++ b/src/compiler/compiler.c @@ -565,10 +565,12 @@ void compiler_compile(void) { case TARGET_TYPE_BENCHMARK: compiler.build.name = "benchmarkrun"; + compiler.build.output_name = compiler.build.runner_output_name ? compiler.build.runner_output_name : compiler.build.name; output_exe = exe_name(); break; case TARGET_TYPE_TEST: compiler.build.name = "testrun"; + compiler.build.output_name = compiler.build.runner_output_name ? compiler.build.runner_output_name : compiler.build.name; output_exe = exe_name(); break; case TARGET_TYPE_EXECUTABLE: