Right now, the repository is bundled with a generate_test_runner.rb file in the auto directory. It's what allows us to automatically generate test suite runners for test files, and it works well out of the box. The meson build file even exposes this as a generator:
# Create a generator that can be used by consumers of our build system to generate
# test runners.
gen_test_runner = generator(
find_program('auto/generate_test_runner.rb'),
output: '@BASENAME@_Runner.c',
arguments: ['@INPUT@', '@OUTPUT@']
)
While this is great for simple uses, there are two problems for more "advanced" (if you can call them that) use cases:
generate_test_runner.rb has a lot of great options, like changing the setUp/tearDown names, etc. The generator doesn't expose a way to use these options
- The output is fixed to have the
_Runner.c ending. Honestly this isn't a big deal, since this name really should be just an implementation detail as part of the build system.
I don't see a clean way to just get args from the parent build file, but I also don't think it's necessary; advanced users will have to know how to invoke this program anyway. Instead, I'd like to expose the runner as an executable; something like
gen_test_runner_exe = find_program('auto/generate_test_runner.rb')
# Create a generator that can be used by consumers of our build system to generate
# test runners.
gen_test_runner = generator(
gen_test_runner_exe,
output: '@BASENAME@_Runner.c',
arguments: ['@INPUT@', '@OUTPUT@']
)
This still allows simple use cases to use the generator directly, while also allowing advanced use cases to invoke the ruby script directly.
I'd love to submit a PR that does this if you all think this is acceptable.
Right now, the repository is bundled with a
generate_test_runner.rbfile in theautodirectory. It's what allows us to automatically generate test suite runners for test files, and it works well out of the box. The meson build file even exposes this as agenerator:While this is great for simple uses, there are two problems for more "advanced" (if you can call them that) use cases:
generate_test_runner.rbhas a lot of great options, like changing thesetUp/tearDownnames, etc. The generator doesn't expose a way to use these options_Runner.cending. Honestly this isn't a big deal, since this name really should be just an implementation detail as part of the build system.I don't see a clean way to just get args from the parent build file, but I also don't think it's necessary; advanced users will have to know how to invoke this program anyway. Instead, I'd like to expose the runner as an executable; something like
This still allows simple use cases to use the generator directly, while also allowing advanced use cases to invoke the ruby script directly.
I'd love to submit a PR that does this if you all think this is acceptable.