Fix sporadic CI/CD failures due to race condition
When running tests in parallel, there was a case where two tests accessed the same generated resource. This is resolved by moving all regression tests into their own subdirectory.
This commit is contained in:
@@ -54,29 +54,37 @@ set(TABLES_TO_COMPARE
|
||||
)
|
||||
|
||||
function(test_standard standard base_config resource_dir output_filename)
|
||||
configure_file(compare.sh compare-${standard}.sh)
|
||||
# Put all the generated files into a subdirectory
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${standard})
|
||||
|
||||
configure_file(compare.sh ${standard}/compare.sh)
|
||||
|
||||
# Test to create database
|
||||
add_test(
|
||||
NAME Regression${standard}.CreateDatabase
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${standard}
|
||||
COMMAND $<TARGET_FILE:DRAMSys> ${base_config} ${resource_dir}
|
||||
)
|
||||
set_tests_properties(Regression${standard}.CreateDatabase PROPERTIES FIXTURES_SETUP Regression${standard}.CreateDatabase)
|
||||
|
||||
# Test to diff the whole database
|
||||
# Test to diff the whole database. This test should not fail.
|
||||
# The purpose of this test is solely to output the differences of the two databases
|
||||
# so that they can be inspected easily.
|
||||
add_test(
|
||||
NAME Regression${standard}.SqlDiff
|
||||
COMMAND compare-${standard}.sh
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${standard}
|
||||
COMMAND compare.sh
|
||||
)
|
||||
set_tests_properties(Regression${standard}.SqlDiff PROPERTIES FIXTURES_REQUIRED Regression${standard}.CreateDatabase)
|
||||
|
||||
# Tests to diff individual tables
|
||||
foreach(table IN LISTS TABLES_TO_COMPARE)
|
||||
configure_file(compare_table.sh compare_table-${table}-${standard}.sh)
|
||||
configure_file(compare_table.sh ${standard}/compare_table-${table}.sh)
|
||||
|
||||
add_test(
|
||||
NAME Regression${standard}.SqlDiff.${table}
|
||||
COMMAND compare_table-${table}-${standard}.sh
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${standard}
|
||||
COMMAND compare_table-${table}.sh
|
||||
)
|
||||
set_tests_properties(Regression${standard}.SqlDiff.${table} PROPERTIES FIXTURES_REQUIRED Regression${standard}.CreateDatabase)
|
||||
endforeach()
|
||||
|
||||
Reference in New Issue
Block a user