Skip to content

btas/unit/run takes ages to fail if it cannot find data files #184

@mbanck

Description

@mbanck

So, first off, I am a bit confused how the Github workflows run fine. I have to add this patch:

--- ./unittest/CMakeLists.txt.orig	2025-03-30 12:33:41.972327217 +0200
+++ ./unittest/CMakeLists.txt	2025-03-30 12:33:49.624399389 +0200
@@ -29,5 +29,5 @@
 set_tests_properties(btas/unit/run
         PROPERTIES
         FIXTURES_REQUIRED BTAS_UNIT_TESTS_EXEC
-        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/unittest"
+        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
         )

Otherwise, those opens in unittest/tensor_cp_test.cc , e.g.

const std::string __dirname = dirname(strdup(__FILE__));
[...]
  std::ifstream in3(__dirname + "/mat3D.txt");
  CHECK(in3.is_open());

fail like:

2: ./unittest/tensor_cp_test.cc:32: FAILED:
2:   CHECK( in3.is_open() )
2: with expansion:
2:   false

Is the test running during Github Worflows not using the CMakeLists.txt from above and/or overriding WORKING_DIRECTORY? Cause it seems both WORKING_DIRECTORY and __dirname have unittest as directory in them.

What's worse, while a successful run takes less than a second, if the testing binary cannot find the datafiles, it takes comparably ages:

test cases:   22 |   20 passed |   2 failed
assertions: 1274 | 1136 passed | 138 failed



50% tests passed, 1 tests failed out of 2

Total Test time (real) = 300.65 sec

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions