From 301b4b64d0baac1f32b8757ffe67fbee38bb8a2a Mon Sep 17 00:00:00 2001 From: Le Ma Date: Mon, 4 Mar 2019 18:27:48 +0800 Subject: [PATCH] tests/amdgpu: create Active function for basic test suite Acked-by: Huang Rui Acked-by: Leo Liu Signed-off-by: Le Ma Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher --- tests/amdgpu/amdgpu_test.c | 2 +- tests/amdgpu/amdgpu_test.h | 5 +++++ tests/amdgpu/basic_tests.c | 13 +++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c index 47e16762..140c8e2f 100644 --- a/tests/amdgpu/amdgpu_test.c +++ b/tests/amdgpu/amdgpu_test.c @@ -149,7 +149,7 @@ static CU_BOOL always_active() static Suites_Active_Status suites_active_stat[] = { { .pName = BASIC_TESTS_STR, - .pActive = always_active, + .pActive = suite_basic_tests_enable, }, { .pName = BO_TESTS_STR, diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h index f5492258..cc996dc3 100644 --- a/tests/amdgpu/amdgpu_test.h +++ b/tests/amdgpu/amdgpu_test.h @@ -54,6 +54,11 @@ int suite_basic_tests_init(); */ int suite_basic_tests_clean(); +/** + * Decide if the suite is enabled by default or not. + */ +CU_BOOL suite_basic_tests_enable(void); + /** * Tests in basic test suite */ diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c index 5c5b8af5..a1b0323a 100644 --- a/tests/amdgpu/basic_tests.c +++ b/tests/amdgpu/basic_tests.c @@ -39,6 +39,7 @@ #include "amdgpu_test.h" #include "amdgpu_drm.h" +#include "amdgpu_internal.h" #include "util_math.h" static amdgpu_device_handle device_handle; @@ -599,6 +600,18 @@ static bool asic_is_arcturus(uint32_t asic_id) } } +CU_BOOL suite_basic_tests_enable(void) +{ + if (amdgpu_device_initialize(drm_amdgpu[0], &major_version, + &minor_version, &device_handle)) + return CU_FALSE; + + if (amdgpu_device_deinitialize(device_handle)) + return CU_FALSE; + + return CU_TRUE; +} + int suite_basic_tests_init(void) { struct amdgpu_gpu_info gpu_info = {0};