diff options
author | Alex Xie | 2017-01-24 16:29:52 -0600 |
---|---|---|
committer | Alex Deucher | 2017-01-27 10:56:23 -0600 |
commit | 8a89d5f620967a9086495d15825415ac27bf061a (patch) | |
tree | c006e4f687083cad7f91bef0918d915151b95863 | |
parent | 12dd7a2e9cfa20a3022cfe091e824b09c0bfb9d1 (diff) | |
download | external-libdrm-8a89d5f620967a9086495d15825415ac27bf061a.tar.gz external-libdrm-8a89d5f620967a9086495d15825415ac27bf061a.tar.xz external-libdrm-8a89d5f620967a9086495d15825415ac27bf061a.zip |
amdgpu: A new option to run tests on render node
Tested:
1. As root, tests passed on primary.
2. As root, tests passed on render node.
BO export/import test was skipped
3. As non-privileged user, tests failed on primary as expected.
4. As non-privileged user, tests passed on render node.
BO export/import test was skipped
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | tests/amdgpu/amdgpu_test.c | 13 | ||||
-rw-r--r-- | tests/amdgpu/amdgpu_test.h | 3 | ||||
-rw-r--r-- | tests/amdgpu/bo_tests.c | 5 |
3 files changed, 18 insertions, 3 deletions
diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c index c01ee543..3fd6820a 100644 --- a/tests/amdgpu/amdgpu_test.c +++ b/tests/amdgpu/amdgpu_test.c | |||
@@ -56,6 +56,9 @@ | |||
56 | */ | 56 | */ |
57 | int drm_amdgpu[MAX_CARDS_SUPPORTED]; | 57 | int drm_amdgpu[MAX_CARDS_SUPPORTED]; |
58 | 58 | ||
59 | /** Open render node to test */ | ||
60 | int open_render_node = 0; /* By default run most tests on primary node */ | ||
61 | |||
59 | /** The table of all known test suites to run */ | 62 | /** The table of all known test suites to run */ |
60 | static CU_SuiteInfo suites[] = { | 63 | static CU_SuiteInfo suites[] = { |
61 | { | 64 | { |
@@ -109,16 +112,17 @@ static void display_test_suites(void) | |||
109 | 112 | ||
110 | /** Help string for command line parameters */ | 113 | /** Help string for command line parameters */ |
111 | static const char usage[] = | 114 | static const char usage[] = |
112 | "Usage: %s [-hlp] [<-s <suite id>> [-t <test id>]] " | 115 | "Usage: %s [-hlpr] [<-s <suite id>> [-t <test id>]] " |
113 | "[-b <pci_bus_id> [-d <pci_device_id>]]\n" | 116 | "[-b <pci_bus_id> [-d <pci_device_id>]]\n" |
114 | "where:\n" | 117 | "where:\n" |
115 | " l - Display all suites and their tests\n" | 118 | " l - Display all suites and their tests\n" |
119 | " r - Run the tests on render node\n" | ||
116 | " b - Specify device's PCI bus id to run tests\n" | 120 | " b - Specify device's PCI bus id to run tests\n" |
117 | " d - Specify device's PCI device id to run tests (optional)\n" | 121 | " d - Specify device's PCI device id to run tests (optional)\n" |
118 | " p - Display information of AMDGPU devices in system\n" | 122 | " p - Display information of AMDGPU devices in system\n" |
119 | " h - Display this help\n"; | 123 | " h - Display this help\n"; |
120 | /** Specified options strings for getopt */ | 124 | /** Specified options strings for getopt */ |
121 | static const char options[] = "hlps:t:b:d:"; | 125 | static const char options[] = "hlrps:t:b:d:"; |
122 | 126 | ||
123 | /* Open AMD devices. | 127 | /* Open AMD devices. |
124 | * Return the number of AMD device openned. | 128 | * Return the number of AMD device openned. |
@@ -326,6 +330,9 @@ int main(int argc, char **argv) | |||
326 | case 'p': | 330 | case 'p': |
327 | display_devices = 1; | 331 | display_devices = 1; |
328 | break; | 332 | break; |
333 | case 'r': | ||
334 | open_render_node = 1; | ||
335 | break; | ||
329 | case '?': | 336 | case '?': |
330 | case 'h': | 337 | case 'h': |
331 | fprintf(stderr, usage, argv[0]); | 338 | fprintf(stderr, usage, argv[0]); |
@@ -336,7 +343,7 @@ int main(int argc, char **argv) | |||
336 | } | 343 | } |
337 | } | 344 | } |
338 | 345 | ||
339 | if (amdgpu_open_devices(0) <= 0) { | 346 | if (amdgpu_open_devices(open_render_node) <= 0) { |
340 | perror("Cannot open AMDGPU device"); | 347 | perror("Cannot open AMDGPU device"); |
341 | exit(EXIT_FAILURE); | 348 | exit(EXIT_FAILURE); |
342 | } | 349 | } |
diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h index fca92ad0..e30e2312 100644 --- a/tests/amdgpu/amdgpu_test.h +++ b/tests/amdgpu/amdgpu_test.h | |||
@@ -35,6 +35,9 @@ | |||
35 | /* Forward reference for array to keep "drm" handles */ | 35 | /* Forward reference for array to keep "drm" handles */ |
36 | extern int drm_amdgpu[MAX_CARDS_SUPPORTED]; | 36 | extern int drm_amdgpu[MAX_CARDS_SUPPORTED]; |
37 | 37 | ||
38 | /* Global variables */ | ||
39 | extern int open_render_node; | ||
40 | |||
38 | /************************* Basic test suite ********************************/ | 41 | /************************* Basic test suite ********************************/ |
39 | 42 | ||
40 | /* | 43 | /* |
diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c index 25df7671..74b5e77b 100644 --- a/tests/amdgpu/bo_tests.c +++ b/tests/amdgpu/bo_tests.c | |||
@@ -152,6 +152,11 @@ static void amdgpu_bo_export_import_do_type(enum amdgpu_bo_handle_type type) | |||
152 | 152 | ||
153 | static void amdgpu_bo_export_import(void) | 153 | static void amdgpu_bo_export_import(void) |
154 | { | 154 | { |
155 | if (open_render_node) { | ||
156 | printf("(DRM render node is used. Skip export/Import test) "); | ||
157 | return; | ||
158 | } | ||
159 | |||
155 | amdgpu_bo_export_import_do_type(amdgpu_bo_handle_type_gem_flink_name); | 160 | amdgpu_bo_export_import_do_type(amdgpu_bo_handle_type_gem_flink_name); |
156 | amdgpu_bo_export_import_do_type(amdgpu_bo_handle_type_dma_buf_fd); | 161 | amdgpu_bo_export_import_do_type(amdgpu_bo_handle_type_dma_buf_fd); |
157 | } | 162 | } |