mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
refactor(tests): remove copying files to output directory; tests accept path to expected instead
This commit is contained in:
parent
588488ce54
commit
1be75362d0
@ -35,18 +35,9 @@ function(regression_test testname)
|
||||
add_executable(${testname} ${source} test_renderer.c)
|
||||
endif()
|
||||
|
||||
add_test(${testname} ${testname})
|
||||
add_test(${testname} ${testname} ${CMAKE_CURRENT_SOURCE_DIR}/expected_output/${testname}.raw)
|
||||
target_link_libraries(${testname} ${HEADERLIB})
|
||||
|
||||
set (rawinput ${CMAKE_CURRENT_SOURCE_DIR}/expected_output/${testname}.raw)
|
||||
set (rawoutput ${CMAKE_CURRENT_BINARY_DIR}/expected_output/${testname}.raw)
|
||||
|
||||
add_custom_target(${testname}_rawcopy
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${rawinput} ${rawoutput}
|
||||
)
|
||||
|
||||
add_dependencies(${testname} ${testname}_rawcopy)
|
||||
|
||||
target_include_directories(${testname} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_compile_definitions(${testname} PUBLIC TEST_NAME="${testname}")
|
||||
|
||||
|
@ -28,6 +28,10 @@ int main(int argc, char* argv[]) {
|
||||
float max_diff;
|
||||
float diff;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "usage: [test] path/to/expected_wave.raw");
|
||||
}
|
||||
|
||||
#ifdef SU_LOAD_GMDLS
|
||||
su_load_gmdls();
|
||||
#endif
|
||||
@ -45,9 +49,7 @@ int main(int argc, char* argv[]) {
|
||||
fwrite((void*)buf, sizeof(SUsample), SU_BUFFER_LENGTH, f);
|
||||
fclose(f);
|
||||
|
||||
snprintf(filename, sizeof filename, "%s%s%s", expected_output_folder, test_name, ".raw");
|
||||
|
||||
f = fopen(filename, "rb");
|
||||
f = fopen(argv[1], "rb");
|
||||
|
||||
if (f == NULL) {
|
||||
printf("No expected waveform found!\n");
|
||||
|
Loading…
Reference in New Issue
Block a user