From 84d2b2638c1b8987cac90eaf5093985513e9c722 Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Thu, 14 Sep 2023 17:26:56 +0200 Subject: [PATCH] Run CTest with `-j2`. This should manifest in spurious failure if filenames are reused. --- .github/workflows/ci.yml | 12 ++++++------ tests/unit/test_all_types.cpp | 4 ++-- tests/unit/tests_high_five.hpp | 19 ++++++++++++++----- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de0810d06..4586c12ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE # Job testing several versions of hdf5 @@ -118,7 +118,7 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE - name: Examples @@ -156,7 +156,7 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE - name: Examples working-directory: ${{github.workspace}}/build/src/examples @@ -199,7 +199,7 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE - name: Examples working-directory: ${{github.workspace}}/build/src/examples @@ -295,7 +295,7 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE - name: Examples working-directory: ${{github.workspace}}/build/src/examples @@ -348,4 +348,4 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build shell: bash -l {0} - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE diff --git a/tests/unit/test_all_types.cpp b/tests/unit/test_all_types.cpp index d7da89542..1f3aef224 100644 --- a/tests/unit/test_all_types.cpp +++ b/tests/unit/test_all_types.cpp @@ -22,7 +22,7 @@ using namespace HighFive; TEMPLATE_TEST_CASE("Scalar in DataSet", "[Types]", bool, std::string) { - const std::string FILE_NAME("rw_dataset" + typeNameHelper() + ".h5"); + const std::string FILE_NAME("rw_dataset_" + typeNameHelper() + ".h5"); const std::string DATASET_NAME("dset"); TestType t1{}; @@ -52,7 +52,7 @@ TEMPLATE_TEST_CASE("Scalar in DataSet", "[Types]", bool, std::string) { } TEMPLATE_PRODUCT_TEST_CASE("Scalar in std::vector", "[Types]", std::vector, (bool, std::string)) { - const std::string FILE_NAME("rw_dataset" + typeNameHelper() + ".h5"); + const std::string FILE_NAME("rw_dataset_" + typeNameHelper() + ".h5"); const std::string DATASET_NAME("dset"); TestType t1(5); diff --git a/tests/unit/tests_high_five.hpp b/tests/unit/tests_high_five.hpp index 2d23c0879..0ebd58c44 100644 --- a/tests/unit/tests_high_five.hpp +++ b/tests/unit/tests_high_five.hpp @@ -12,6 +12,9 @@ #include #include #include +#include +#include +#include // We don't need windows specific functionality. However, to better detect defects caused by macros, // we include this header. @@ -162,16 +165,22 @@ struct ContentGenerate { template inline std::string typeNameHelper() { std::string name = typeid(T).name(); -#if defined(WIN32) - // Replace illegal windows file path characters std::replace(std::begin(name), std::end(name), ' ', '_'); std::replace(std::begin(name), std::end(name), '<', '_'); std::replace(std::begin(name), std::end(name), '>', '_'); std::replace(std::begin(name), std::end(name), ':', '_'); -#endif - return name; + + if (name.size() > 64) { + std::stringstream hash; + hash << std::hex << std::hash{}(name); + + return hash.str(); + } else { + return name; + } } + template inline HighFive::DataSet readWriteDataset(const DataT& ndvec, DataT& result, @@ -193,4 +202,4 @@ inline HighFive::DataSet readWriteDataset(const DataT& ndvec, dataset.read(result); return dataset; -} \ No newline at end of file +}