[PATCH libdrm 2/3] amdgpu: A new option to choose which device to run most tests
Alex Xie
AlexBin.Xie at amd.com
Thu Jan 19 22:53:10 UTC 2017
This can be used to test multiple GPUs
Signed-off-by: Alex Xie <AlexBin.Xie at amd.com>
---
tests/amdgpu/amdgpu_test.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
index e42ef9d..2437db4 100644
--- a/tests/amdgpu/amdgpu_test.c
+++ b/tests/amdgpu/amdgpu_test.c
@@ -108,12 +108,14 @@ static void display_test_suites(void)
/** Help string for command line parameters */
-static const char usage[] = "Usage: %s [-hl] [<-s <suite id>> [-t <test id>]]\n"
- "where:\n"
- " l - Display all suites and their tests\n"
- " h - Display this help\n";
+static const char usage[] =
+ "Usage: %s [-hl] [<-s <suite id>> [-t <test id>]] [-d <device_id>]\n"
+ "where:\n"
+ " l - Display all suites and their tests\n"
+ " d - Choose which device to run tests\n"
+ " h - Display this help\n";
/** Specified options strings for getopt */
-static const char options[] = "hls:t:";
+static const char options[] = "hls:t:d:";
/* Open AMD devices.
* Return the number of AMD device openned.
@@ -238,6 +240,7 @@ int main(int argc, char **argv)
int i = 0;
int suite_id = -1; /* By default run everything */
int test_id = -1; /* By default run all tests in the suite */
+ int device_id = 0; /* By default run most tests on device 0 */
CU_pSuite pSuite = NULL;
CU_pTest pTest = NULL;
@@ -266,6 +269,9 @@ int main(int argc, char **argv)
case 't':
test_id = atoi(optarg);
break;
+ case 'd':
+ device_id = atoi(optarg);
+ break;
case '?':
case 'h':
fprintf(stderr, usage, argv[0]);
@@ -283,6 +289,15 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ if (device_id) {
+ /* Most tests run on device 0.
+ * Swap the chosen device to device 0.
+ */
+ i = drm_amdgpu[0];
+ drm_amdgpu[0] = drm_amdgpu[device_id];
+ drm_amdgpu[device_id] = i;
+ }
+
amdgpu_print_devices();
/* Initialize test suites to run */
--
2.7.4
More information about the amd-gfx
mailing list