diff --git a/docs/MesonGeneratorRunner.md b/docs/MesonGeneratorRunner.md index 3b81e378..31e804f2 100644 --- a/docs/MesonGeneratorRunner.md +++ b/docs/MesonGeneratorRunner.md @@ -15,4 +15,22 @@ Once you have the generator you need to pass it the absolute path of your test f test_runner = meson.source_root() / 'test/test_example.c' -You can then include `test_runner` as a normal dependency to your builds. Meson will create the test runner in a private directory for each build target. It's only meant to be used as part of the build, so if you need to refer to the runner after the build, you won't be able to use the generator. \ No newline at end of file +You can then include `test_runner` as a normal dependency to your builds. Meson will create the test runner in a private directory for each build target. It's only meant to be used as part of the build, so if you need to refer to the runner after the build, you won't be able to use the generator. + +For cases where the generator's fixed output name is not suitable, the runner program is also available directly: + + runner_program = unity_proj.get_variable('gen_test_runner_exe') + +You can use it in a `custom_target()` to control the output name and pass any supported runner option: + + test_runner = custom_target( + 'test_example_runner', + input: 'test/test_example.c', + output: 'test_example_runner.c', + command: [ + runner_program, + '--use_param_tests=1', + '@INPUT@', + '@OUTPUT@', + ], + ) diff --git a/docs/UnityChangeLog.md b/docs/UnityChangeLog.md index 6e73e27c..7e03d128 100644 --- a/docs/UnityChangeLog.md +++ b/docs/UnityChangeLog.md @@ -15,6 +15,10 @@ Prior to 2008, the project was an internal project and not released to the publi ### Unity 2.7.2 +New Features: + + - Meson subprojects can access the test runner generator program directly for custom targets (#835). @Firat17aze + Significant Bugfixes: - Default `UNITY_INCLUDE_EXEC_TIME` macros compile as ISO C99, are statement-safe, and accept `-Wsign-conversion` (#838) diff --git a/meson.build b/meson.build index ddfc563b..9d1182a1 100644 --- a/meson.build +++ b/meson.build @@ -81,8 +81,9 @@ endif # Create a generator that can be used by consumers of our build system to generate # test runners. +gen_test_runner_exe = find_program('auto/generate_test_runner.rb') gen_test_runner = generator( - find_program('auto/generate_test_runner.rb'), + gen_test_runner_exe, output: '@BASENAME@_Runner.c', arguments: ['@EXTRA_ARGS@', '@INPUT@', '@OUTPUT@'] )