Skip to content

Commit

Permalink
Add exclude support for hwtest_p tests
Browse files Browse the repository at this point in the history
Signed-off-by: Kamil Kopryk <[email protected]>
  • Loading branch information
KamilKoprykIntel authored and Compute-Runtime-Automation committed Apr 20, 2022
1 parent 8f38f4e commit e4437fc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -31,29 +31,30 @@ struct WriteBufferRectHw
}
};

typedef WriteBufferRectHw AUBWriteBufferRect;
static const size_t width = 10;
using AUBWriteBufferRect = WriteBufferRectHw;

HWTEST_P(AUBWriteBufferRect, Given3dWhenWritingBufferThenExpectationsAreMet) {

MockContext context(this->pClDevice);
const size_t width = 10;
size_t rowPitch = width;
size_t slicePitch = rowPitch * rowPitch;

size_t bufferSizeBuff = rowPitch * rowPitch * rowPitch;
size_t bufferSize = alignUp(bufferSizeBuff, 4096);

size_t zHostOffs;
size_t zBuffOffs;
std::tie(zBuffOffs, zHostOffs) = GetParam();
auto [zBuffOffs, zHostOffs] = GetParam();

ASSERT_LT(zBuffOffs, width);
ASSERT_LT(zHostOffs, width);

uint8_t *srcMemory = (uint8_t *)::alignedMalloc(bufferSize, 4096);
uint8_t *destMemory = (uint8_t *)::alignedMalloc(bufferSize, 4096);
auto srcMemory = static_cast<uint8_t *>(::alignedMalloc(bufferSize, 4096));
auto destMemory = static_cast<uint8_t *>(::alignedMalloc(bufferSize, 4096));

for (unsigned int i = 0; i < bufferSize; i++)
srcMemory[i] = i;
for (unsigned int i = 0; i < bufferSize; i++) {
auto oneBytePattern = static_cast<uint8_t>(i & 0xff);
srcMemory[i] = oneBytePattern;
}

memset(destMemory, 0x00, bufferSize);

Expand Down Expand Up @@ -91,26 +92,24 @@ HWTEST_P(AUBWriteBufferRect, Given3dWhenWritingBufferThenExpectationsAreMet) {

EXPECT_EQ(CL_SUCCESS, retVal);

char *ptr = new char[slicePitch];
memset(ptr, 0, slicePitch);
std::vector<uint8_t> ptr(slicePitch, 0);
for (unsigned int i = 0; i < rowPitch; i++) {
//one slice will be copied from src. all others should be zeros
// one slice will be copied from src. all others should be zeros
if (i == zBuffOffs) {
AUBCommandStreamFixture::expectMemory<FamilyType>(pDestMemory + slicePitch * i, srcMemory + slicePitch * zHostOffs, slicePitch);
} else {
AUBCommandStreamFixture::expectMemory<FamilyType>(pDestMemory + slicePitch * i, ptr, slicePitch);
AUBCommandStreamFixture::expectMemory<FamilyType>(pDestMemory + slicePitch * i, ptr.data(), slicePitch);
}
}
delete[] ptr;

::alignedFree(srcMemory);
::alignedFree(destMemory);
}
INSTANTIATE_TEST_CASE_P(AUBWriteBufferRect_simple,
AUBWriteBufferRect,
::testing::Combine(
::testing::Values(0, 1, 2, 3, 4),
::testing::Values(0, 1, 2, 3, 4)));
::testing::Values(0u, 1u, 2u, 3u, 4u),
::testing::Values(0u, 1u, 2u, 3u, 4u)));

struct AUBWriteBufferRectUnaligned
: public CommandEnqueueAUBFixture,
Expand Down
15 changes: 14 additions & 1 deletion shared/test/common/test_macros/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,20 @@ extern GFXCORE_FAMILY renderCoreFamily;
void testBodyHw(); \
\
void TestBody() override { \
FAMILY_SELECTOR(::renderCoreFamily, testBodyHw) \
if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \
FAMILY_SELECTOR(::renderCoreFamily, testBodyHw) \
} \
} \
void SetUp() override { \
if (IS_TEST_EXCLUDED(test_suite_name, test_name)) { \
GTEST_SKIP(); \
} \
test_suite_name::SetUp(); \
} \
void TearDown() override { \
if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \
test_suite_name::TearDown(); \
} \
} \
\
private: \
Expand Down

0 comments on commit e4437fc

Please sign in to comment.