Move all raw audio files related to tests into subfolders, to have slightly more clean folder structure and to avoid mixing source files and data files.

This commit is contained in:
Veikko Sariola
2020-04-18 19:47:16 +03:00
parent 886ee85a09
commit 41222b09a7
34 changed files with 23 additions and 4 deletions

View File

@ -9,8 +9,8 @@ function(regression_test testname)
add_test(${testname} ${testname})
target_compile_definitions(${testname} PUBLIC TEST_NAME="${testname}")
set (rawinput ${CMAKE_CURRENT_SOURCE_DIR}/${testname}_expected.raw)
set (rawoutput ${CMAKE_CURRENT_BINARY_DIR}/${testname}_expected.raw)
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}

View File

@ -1,5 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined (_WIN32)
#include <windows.h>
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif
extern void __stdcall _4klang_render();
extern int test_max_samples;
@ -10,6 +21,8 @@ int main(int argc, char* argv[]) {
int n;
int retval;
char test_name[] = TEST_NAME;
char expected_output_folder[] = "expected_output/";
char actual_output_folder[] = "actual_output/";
long fsize;
long bufsize;
#ifndef GO4K_USE_16BIT_OUTPUT
@ -33,7 +46,7 @@ int main(int argc, char* argv[]) {
_4klang_render(buf);
snprintf(filename, sizeof filename, "%s%s", test_name, "_expected.raw");
snprintf(filename, sizeof filename, "%s%s%s", expected_output_folder, test_name, ".raw");
f = fopen(filename, "rb");
@ -88,7 +101,13 @@ end:
f = 0;
}
snprintf(filename, sizeof filename, "%s%s", test_name, "_got.raw");
#if defined (_WIN32)
CreateDirectory(actual_output_folder, NULL);
#else
mkdir(actual_output_folder, 0777);
#endif
snprintf(filename, sizeof filename, "%s%s%s", actual_output_folder, test_name, ".raw");
f = fopen(filename, "wb");
fwrite((void*)buf, sizeof(*buf), 2 * test_max_samples, f);
fclose(f);