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:
2023-04-26 15:25:05 +02:00
parent 58d486fb82
commit e040e087a2

View File

@@ -54,29 +54,37 @@ set(TABLES_TO_COMPARE
) )
function(test_standard standard base_config resource_dir output_filename) 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 # Test to create database
add_test( add_test(
NAME Regression${standard}.CreateDatabase NAME Regression${standard}.CreateDatabase
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${standard}
COMMAND $<TARGET_FILE:DRAMSys> ${base_config} ${resource_dir} COMMAND $<TARGET_FILE:DRAMSys> ${base_config} ${resource_dir}
) )
set_tests_properties(Regression${standard}.CreateDatabase PROPERTIES FIXTURES_SETUP Regression${standard}.CreateDatabase) 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( add_test(
NAME Regression${standard}.SqlDiff 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) set_tests_properties(Regression${standard}.SqlDiff PROPERTIES FIXTURES_REQUIRED Regression${standard}.CreateDatabase)
# Tests to diff individual tables # Tests to diff individual tables
foreach(table IN LISTS TABLES_TO_COMPARE) 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( add_test(
NAME Regression${standard}.SqlDiff.${table} 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) set_tests_properties(Regression${standard}.SqlDiff.${table} PROPERTIES FIXTURES_REQUIRED Regression${standard}.CreateDatabase)
endforeach() endforeach()