From 7a01b52f167f3ad762c86551edb5e2245b9db06b Mon Sep 17 00:00:00 2001 From: Evgeny Karpov Date: Mon, 20 Nov 2023 15:30:42 +0100 Subject: [PATCH] * refactor PR based on reviews --- tests/.gitignore | 1 + tests/BUILD.txt | 4 +- tests/CMakeLists.txt | 52 +++++++++++-------- tests/{bigdata_test.cpp => bigdata-test.cpp} | 0 tests/{dll_test.c => dll-test.c} | 0 tests/{dll_test.cpp => dll-test.cpp} | 0 .../{iostream_test.cpp => iostream-test.cpp} | 0 tests/{math_test.c => math-test.c} | 0 tests/{math_test.cpp => math-test.cpp} | 0 tests/{omp_test.c => omp-test.c} | 0 tests/{omp_test.cpp => omp-test.cpp} | 0 tests/{openblas_test.c => openblas-test.c} | 0 .../{openblas_test.cpp => openblas-test.cpp} | 0 tests/{pdata_test.c => pdata-test.c} | 2 +- tests/{pdata_test.cpp => pdata-test.cpp} | 0 tests/{sjlj_test.c => sjlj-test.c} | 0 tests/{sjlj_test.cpp => sjlj-test.cpp} | 0 tests/{struct_test.c => struct-test.c} | 0 tests/{struct_test.cpp => struct-test.cpp} | 0 tests/{throw_test.cpp => throw-test.cpp} | 0 tests/{varargs_test.c => varargs-test.c} | 0 tests/{varargs_test.cpp => varargs-test.cpp} | 0 22 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 tests/.gitignore rename tests/{bigdata_test.cpp => bigdata-test.cpp} (100%) rename tests/{dll_test.c => dll-test.c} (100%) rename tests/{dll_test.cpp => dll-test.cpp} (100%) rename tests/{iostream_test.cpp => iostream-test.cpp} (100%) rename tests/{math_test.c => math-test.c} (100%) rename tests/{math_test.cpp => math-test.cpp} (100%) rename tests/{omp_test.c => omp-test.c} (100%) rename tests/{omp_test.cpp => omp-test.cpp} (100%) rename tests/{openblas_test.c => openblas-test.c} (100%) rename tests/{openblas_test.cpp => openblas-test.cpp} (100%) rename tests/{pdata_test.c => pdata-test.c} (99%) rename tests/{pdata_test.cpp => pdata-test.cpp} (100%) rename tests/{sjlj_test.c => sjlj-test.c} (100%) rename tests/{sjlj_test.cpp => sjlj-test.cpp} (100%) rename tests/{struct_test.c => struct-test.c} (100%) rename tests/{struct_test.cpp => struct-test.cpp} (100%) rename tests/{throw_test.cpp => throw-test.cpp} (100%) rename tests/{varargs_test.c => varargs-test.c} (100%) rename tests/{varargs_test.cpp => varargs-test.cpp} (100%) diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 000000000..c795b054e --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +build \ No newline at end of file diff --git a/tests/BUILD.txt b/tests/BUILD.txt index c6b6e6faa..633a1de60 100644 --- a/tests/BUILD.txt +++ b/tests/BUILD.txt @@ -3,5 +3,5 @@ Building aarch64-w64-mingw32 tests on Linux or WSL cmake -S . -B build cmake --build build -it generates Arm64 Windows executable -build/aarch64_mingw_tests \ No newline at end of file +It generates Arm64 Windows executable. +build/bin/aarch64_mingw_tests.exe \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b744cc2d4..cdb045591 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,10 +1,18 @@ set(CMAKE_VERBOSE_MAKEFILE ON) -set(CMAKE_C_COMPILER "$ENV{HOME}/cross/bin/aarch64-w64-mingw32-gcc") + +if (NOT DEFINED ENV{TARGET}) + set(ENV{TARGET} "aarch64-w64-mingw32") +endif() +if (NOT DEFINED ENV{INSTALL_PATH}) + set(ENV{INSTALL_PATH} "$ENV{HOME}/cross") +endif() + +set(CMAKE_C_COMPILER "$ENV{INSTALL_PATH}/bin/$ENV{TARGET}-gcc") set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_COMPILER "$ENV{HOME}/cross/bin/aarch64-w64-mingw32-c++") -set(CMAKE_RANLIB "$ENV{HOME}/cross/bin/aarch64-w64-mingw32-ranlib") +set(CMAKE_CXX_COMPILER "$ENV{INSTALL_PATH}/bin/$ENV{TARGET}-c++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fopenmp") +set(CMAKE_RANLIB "$ENV{INSTALL_PATH}/bin/$ENV{TARGET}-ranlib") include(FetchContent) FetchContent_Declare( @@ -20,28 +28,28 @@ project(aarch64_mingw_tests) enable_testing() add_executable( - aarch64_mingw_tests - bigdata_test.cpp - iostream_test.cpp - math_test.c - math_test.cpp - omp_test.c - omp_test.cpp - pdata_test.c - pdata_test.cpp - sjlj_test.c - sjlj_test.cpp - struct_test.c - struct_test.cpp - throw_test.cpp - varargs_test.c - varargs_test.cpp + aarch64-mingw-tests.exe + bigdata-test.cpp + iostream-test.cpp + math-test.c + math-test.cpp + omp-test.c + omp-test.cpp + pdata-test.c + pdata-test.cpp + sjlj-test.c + sjlj-test.cpp + struct-test.c + struct-test.cpp + throw-test.cpp + varargs-test.c + varargs-test.cpp ) -set_source_files_properties(test-dll.c PROPERTIES COMPILE_FLAGS "-DIMPORT_API=") - target_link_libraries( - aarch64_mingw_tests + aarch64-mingw-tests.exe GTest::gtest_main dbghelp ) + +set_target_properties(aarch64-mingw-tests.exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") \ No newline at end of file diff --git a/tests/bigdata_test.cpp b/tests/bigdata-test.cpp similarity index 100% rename from tests/bigdata_test.cpp rename to tests/bigdata-test.cpp diff --git a/tests/dll_test.c b/tests/dll-test.c similarity index 100% rename from tests/dll_test.c rename to tests/dll-test.c diff --git a/tests/dll_test.cpp b/tests/dll-test.cpp similarity index 100% rename from tests/dll_test.cpp rename to tests/dll-test.cpp diff --git a/tests/iostream_test.cpp b/tests/iostream-test.cpp similarity index 100% rename from tests/iostream_test.cpp rename to tests/iostream-test.cpp diff --git a/tests/math_test.c b/tests/math-test.c similarity index 100% rename from tests/math_test.c rename to tests/math-test.c diff --git a/tests/math_test.cpp b/tests/math-test.cpp similarity index 100% rename from tests/math_test.cpp rename to tests/math-test.cpp diff --git a/tests/omp_test.c b/tests/omp-test.c similarity index 100% rename from tests/omp_test.c rename to tests/omp-test.c diff --git a/tests/omp_test.cpp b/tests/omp-test.cpp similarity index 100% rename from tests/omp_test.cpp rename to tests/omp-test.cpp diff --git a/tests/openblas_test.c b/tests/openblas-test.c similarity index 100% rename from tests/openblas_test.c rename to tests/openblas-test.c diff --git a/tests/openblas_test.cpp b/tests/openblas-test.cpp similarity index 100% rename from tests/openblas_test.cpp rename to tests/openblas-test.cpp diff --git a/tests/pdata_test.c b/tests/pdata-test.c similarity index 99% rename from tests/pdata_test.c rename to tests/pdata-test.c index 525fa7b08..1b23be9fb 100644 --- a/tests/pdata_test.c +++ b/tests/pdata-test.c @@ -40,7 +40,7 @@ static void print_symbol(HANDLE hp, DWORD64 offset) if (SymGetSymFromAddr64(hp, offset, &dwDisplacement, p)) { - printf(" %s+0x%.04llX", p->Name, dwDisplacement); + // printf(" %s+0x%.04llX", p->Name, dwDisplacement); } else { diff --git a/tests/pdata_test.cpp b/tests/pdata-test.cpp similarity index 100% rename from tests/pdata_test.cpp rename to tests/pdata-test.cpp diff --git a/tests/sjlj_test.c b/tests/sjlj-test.c similarity index 100% rename from tests/sjlj_test.c rename to tests/sjlj-test.c diff --git a/tests/sjlj_test.cpp b/tests/sjlj-test.cpp similarity index 100% rename from tests/sjlj_test.cpp rename to tests/sjlj-test.cpp diff --git a/tests/struct_test.c b/tests/struct-test.c similarity index 100% rename from tests/struct_test.c rename to tests/struct-test.c diff --git a/tests/struct_test.cpp b/tests/struct-test.cpp similarity index 100% rename from tests/struct_test.cpp rename to tests/struct-test.cpp diff --git a/tests/throw_test.cpp b/tests/throw-test.cpp similarity index 100% rename from tests/throw_test.cpp rename to tests/throw-test.cpp diff --git a/tests/varargs_test.c b/tests/varargs-test.c similarity index 100% rename from tests/varargs_test.c rename to tests/varargs-test.c diff --git a/tests/varargs_test.cpp b/tests/varargs-test.cpp similarity index 100% rename from tests/varargs_test.cpp rename to tests/varargs-test.cpp