Skip to content

Conversation

SchaichAlonso
Copy link
Contributor

Generate cmake targets that invoke testdata_tom to apply the test schema. Use cmake here in order to be able to invoke the binary independend of debug suffices or binary paths. A Generator expression could also have emitted $<TARGET_FILE:testdata_tom> in oder to determine the filename of the emitted binaries, however, file(GENERATE OUTPUT) does not support target dependend generator expression, while file(CONFIGURE) and configure_file do not support generator expressions at all.

Rather then generating additional test cases for the testdata_tom binary and adding them to a ctest testsuite in a fixture where the migration is a FIXTURE_SETUP to the other tests to ensure it gets executed prior to the other unit tests, generate a CTestCustom.cmake script, which, unlike the content in CMakeLists.txt, gets executed at test-time, so a variation of the environment variables is detected.

Add a new environment variable named DB_AUTOMIGRATE to enable schema migration prior to the test suite invokation. CTestCustom.cmake is way less capable to process cmake options then CMakeLists.txt, due to CMP0012 causing "ON" to be interpreted as false until cmake-4.0 which removes legacy support for CMP0012.

Therefore, keep the ctest definition simple for the time being

Fixes #67 .

Generate cmake targets that invoke `testdata_tom` to apply the test schema.
Use cmake here in order to be able to invoke the binary independend of
debug suffices or binary paths. A Generator expression could also have emitted
$<TARGET_FILE:testdata_tom> in oder to determine the filename of the emitted
binaries, however, `file(GENERATE OUTPUT)` does not support target dependend
generator expression.

Rather then generating additional test cases for the `testdata_tom` binary
and adding them to a ctest testsuite in a fixture where the migration is a
FIXTURE_SETUP to the other tests to ensure it gets executed prior to the
other unit tests, generate a CTestCustom.cmake script which, unlike the
content in CMakeLists.txt, gets executed at test-time, so a variation of
the environment variables is detected.

Add a new environment variable named `DB_AUTOMIGRATE` to enable schema
migration prior to the test suite invokation. CTestCustom.cmake is way less
capable to process cmake options then CMakeLists.txt, due to CMP0012 causing
"ON" to be interpreted as false until cmake-4.0 which removes legacy support
for CMP0012.

Therefore, keep the ctest definition simple for the time being

Fixes silverqx#67 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant