@@ -417,6 +417,10 @@ static void amdgpu_disable_suits()
*/
if (amdgpu_set_test_active(DEADLOCK_TESTS_STR, "compute ring block test", CU_FALSE))
fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
+
+ /* This test triggers OOM killer terminating the tester itself */
+ if (amdgpu_set_test_active(BO_TESTS_STR, "Memory fail alloc Test", CU_FALSE))
+ fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
}
/* The main() function for setting up and running the tests.
@@ -47,6 +47,7 @@ static void amdgpu_bo_export_import(void);
static void amdgpu_bo_metadata(void);
static void amdgpu_bo_map_unmap(void);
static void amdgpu_memory_alloc(void);
+static void amdgpu_memory_fail_alloc(void);
CU_TestInfo bo_tests[] = {
{ "Export/Import", amdgpu_bo_export_import },
@@ -55,6 +56,7 @@ CU_TestInfo bo_tests[] = {
#endif
{ "CPU map/unmap", amdgpu_bo_map_unmap },
{ "Memory alloc Test", amdgpu_memory_alloc },
+ { "Memory fail alloc Test", amdgpu_memory_fail_alloc },
CU_TEST_INFO_NULL,
};
@@ -244,3 +246,21 @@ static void amdgpu_memory_alloc(void)
r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
CU_ASSERT_EQUAL(r, 0);
}
+
+static void amdgpu_memory_fail_alloc(void)
+{
+ amdgpu_bo_handle bo;
+ amdgpu_va_handle va_handle;
+ uint64_t bo_mc;
+ int r;
+
+ /* Test impossible mem allocation, 1TB */
+ bo = gpu_mem_alloc(device_handle, 0xE8D4A51000, 4096,
+ AMDGPU_GEM_DOMAIN_VRAM,
+ AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
+ &bo_mc, &va_handle);
+
+ r = gpu_mem_free(bo, va_handle, bo_mc, 0xE8D4A51000);
+ CU_ASSERT_EQUAL(r, 0);
+}
+
Allocates 1 TB of memory. Test is disabled by default since it's triggers OOM killer. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> --- tests/amdgpu/amdgpu_test.c | 4 ++++ tests/amdgpu/bo_tests.c | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+)