Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skipping memspace_numa tests #134

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

ldorau
Copy link
Contributor

@ldorau ldorau commented Jan 12, 2024

Fix skipping memspace_numa tests.
GTEST_SKIP() called in numa_nodes_test does not skip numa_memspace_test and numa_memspace_provider_test tests.

It fixes the following test failure:

[----------] 1 test from numa_memspace_test
[ RUN      ] numa_memspace_test.provider_from_numa_memspace
/home/ldorau/work/unified-memory-framework/test/memspace_numa.cpp:21: Skipped
Failed to initialize libnuma
/home/ldorau/work/unified-memory-framework/test/memspace_numa.cpp:43: Failure
Expected equality of these values:
  ret
    Which is: 3
  UMF_RESULT_SUCCESS
    Which is: 0
umf_test-memspace_numa: /home/ldorau/work/unified-memory-framework/src/memspace.c:101: umfMemspaceDestroy: Assertion `memspace' failed.


90% tests passed, 1 tests failed out of 10

Label Time Summary:
umf    =   2.71 sec*proc (10 tests)

Total Test time (real) =   2.72 sec

The following tests FAILED:
         10 - umf-memspace_numa (Subprocess aborted)
Errors while running CTest

@ldorau ldorau requested a review from a team as a code owner January 12, 2024 09:47
@ldorau
Copy link
Contributor Author

ldorau commented Jan 12, 2024

@igchor please review - maybe you know a better way to fix this issue than that?

@ldorau ldorau requested a review from igchor January 12, 2024 09:48
};

struct numa_memspace_test : ::numa_nodes_test {
void SetUp() override {
::numa_nodes_test::SetUp();

if (skip_this_test) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we just create a helper function that checks condition from SetUp() and call it here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other modified test classes call ::numa_nodes_test::SetUp() anyway, so there should be only one check in ::numa_nodes_test::SetUp(). All skuip_this_test flags can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PatKamin ok originally we called GTEST_SKIP() only in SetUp() and this didn't work - see the description of the PR

test/memspace_numa.cpp Outdated Show resolved Hide resolved
};

struct numa_memspace_test : ::numa_nodes_test {
void SetUp() override {
::numa_nodes_test::SetUp();

if (skip_this_test) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other modified test classes call ::numa_nodes_test::SetUp() anyway, so there should be only one check in ::numa_nodes_test::SetUp(). All skuip_this_test flags can be removed.

@igchor
Copy link
Member

igchor commented Jan 12, 2024

@igchor please review - maybe you know a better way to fix this issue than that?

I think the problem is this: GTEST_SKIP() only skips tests, but it does not affect any code that is in the SetUp() function. So, even if GTEST_SKIP() is called in the numa_nodes_test::SetUp(), umfMemspaceCreateFromNumaArray will still be called and fail.

To fix this, you can just put memspace/provider creation under an if:

struct numa_memspace_test : ::numa_nodes_test {
    void SetUp() override {
        ::numa_nodes_test::SetUp();

        if (nodeIds.size()) {
            enum umf_result_t ret = umfMemspaceCreateFromNumaArray(
                nodeIds.data(), nodeIds.size(), &memspace);
            ASSERT_EQ(ret, UMF_RESULT_SUCCESS);
            ASSERT_NE(memspace, nullptr);
        }
    }
    ...

and you might also need to modify TearDown():

    void TearDown() override {
        ::numa_nodes_test::TearDown();
        if (memspace)
            umfMemspaceDestroy(memspace);
    }

Fix skipping memspace_numa tests.
GTEST_SKIP() called in numa_nodes_test does not skip
numa_memspace_test and numa_memspace_provider_test tests.

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau force-pushed the Fix_skipping_memspace_numa_tests branch from 6fe7145 to 79e68e9 Compare January 15, 2024 07:52
@ldorau
Copy link
Contributor Author

ldorau commented Jan 15, 2024

@igchor please review - maybe you know a better way to fix this issue than that?

I think the problem is this: GTEST_SKIP() only skips tests, but it does not affect any code that is in the SetUp() function. So, even if GTEST_SKIP() is called in the numa_nodes_test::SetUp(), umfMemspaceCreateFromNumaArray will still be called and fail.

Thanks! This is a lot simpler :-)
Done.

@ldorau ldorau requested review from bratpiorka and PatKamin January 15, 2024 07:55
@ldorau ldorau merged commit 6503c1c into oneapi-src:main Jan 16, 2024
32 checks passed
@ldorau ldorau deleted the Fix_skipping_memspace_numa_tests branch January 16, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants