SWDEV-277697 - Adding Infra and dependent libs: Catch2 and json parser, for new HIP Testing framework
Change-Id: Iedfa041ec9acc13eeb631ff67e1677e2fe29463d
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# Common Tests - Test independent of all platforms
|
||||
set(TEST_SRC
|
||||
memcpy.cc
|
||||
)
|
||||
|
||||
# Create shared lib of all tests
|
||||
add_library(memory SHARED EXCLUDE_FROM_ALL ${TEST_SRC})
|
||||
|
||||
# Add dependency on build_tests to build it on this custom target
|
||||
add_dependencies(build_stress_test memory)
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
TEST_CASE("hipMalloc", "DifferentSizes") {
|
||||
int* d_a = nullptr;
|
||||
SECTION("Size 10") {
|
||||
auto res = hipMalloc(&d_a, sizeof(10));
|
||||
REQUIRE(res == hipSuccess);
|
||||
hipFree(d_a);
|
||||
d_a = nullptr;
|
||||
}
|
||||
SECTION("Size 100") {
|
||||
auto res = hipMalloc(&d_a, sizeof(100));
|
||||
REQUIRE(res == hipSuccess);
|
||||
hipFree(d_a);
|
||||
d_a = nullptr;
|
||||
}
|
||||
SECTION("Size 1000") {
|
||||
auto res = hipMalloc(&d_a, sizeof(1000));
|
||||
REQUIRE(res == hipSuccess);
|
||||
hipFree(d_a);
|
||||
d_a = nullptr;
|
||||
}
|
||||
SECTION("Size 10000") {
|
||||
auto res = hipMalloc(&d_a, sizeof(10000));
|
||||
REQUIRE(res == hipSuccess);
|
||||
hipFree(d_a);
|
||||
d_a = nullptr;
|
||||
}
|
||||
SECTION("Size MAX") {
|
||||
auto res = hipMalloc(&d_a, ~(size_t)0);
|
||||
REQUIRE(res == hipErrorOutOfMemory);
|
||||
d_a = nullptr;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user