tests/amdgpu: Proper format for "-l"

Proper format for command line option "-l",
listing the supported and unsupported tests:

1) Add an aligned column header.

2) Align all fields into columns.

3) Fixed length fields, come before the last
column, which is a variable length field.

4) Variable length field, which is the name of the
test, goes in the last column.

5) If a suite is disabled, do not iterate over its
tests, as they'd naturally be all disabled.

Now the output looks like this:
$sudo ./amdgpu_test -l
 What: ID:   Status: Name
Suite:  1:  ENABLED: Basic Tests
 Test:  1:  ENABLED: Query Info Test
 Test:  2:  ENABLED: Userptr Test
 Test:  3: DISABLED: bo eviction Test
 Test:  4:  ENABLED: Command submission Test (GFX)
 Test:  5:  ENABLED: Command submission Test (Compute)
 Test:  6:  ENABLED: Command submission Test (Multi-Fence)
 Test:  7:  ENABLED: Command submission Test (SDMA)
 Test:  8:  ENABLED: SW semaphore Test
 Test:  9: DISABLED: Sync dependency Test
 Test: 10: DISABLED: Dispatch Test (Compute)
 Test: 11: DISABLED: Dispatch Test (GFX)
 Test: 12: DISABLED: Draw Test
 Test: 13: DISABLED: GPU reset Test
Suite:  2:  ENABLED: BO Tests
 Test:  1:  ENABLED: Export/Import
 Test:  2: DISABLED: Metadata
 Test:  3:  ENABLED: CPU map/unmap
 Test:  4:  ENABLED: Memory alloc Test
 Test:  5:  ENABLED: Memory fail alloc Test
 Test:  6:  ENABLED: Find bo by CPU mapping
Suite:  3: DISABLED: CS Tests
Suite:  4: DISABLED: VCE Tests
Suite:  5:  ENABLED: VCN Tests
 Test:  1:  ENABLED: VCN DEC create
 Test:  2:  ENABLED: VCN DEC decode
 Test:  3:  ENABLED: VCN DEC destroy
 Test:  4:  ENABLED: VCN ENC create
 Test:  5:  ENABLED: VCN ENC decode
 Test:  6:  ENABLED: VCN ENC destroy
Suite:  6: DISABLED: UVD ENC Tests
Suite:  7: DISABLED: Deadlock Tests
Suite:  8:  ENABLED: VM Tests
 Test:  1:  ENABLED: resere vmid test
 Test:  2:  ENABLED: unaligned map
 Test:  3:  ENABLED: vm mapping test
Suite:  9: DISABLED: RAS Tests
Suite: 10:  ENABLED: SYNCOBJ TIMELINE Tests
 Test:  1:  ENABLED: syncobj timeline test
$_

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
main
Luben Tuikov 2019-12-17 17:03:41 -05:00 committed by Marek Olšák
parent 680542ce08
commit 7fdebb02ff
1 changed files with 14 additions and 16 deletions

View File

@ -202,44 +202,42 @@ static void display_test_suites(void)
CU_pSuite pSuite = NULL;
CU_pTest pTest = NULL;
printf("Suites\n");
printf("%5s: %2s: %8s: %s\n", "What", "ID", "Status", "Name");
for (iSuite = 0; suites[iSuite].pName != NULL; iSuite++) {
pSuite = CU_get_suite_by_index((unsigned int) iSuite + 1,
CU_get_registry());
CU_get_registry());
if (!pSuite) {
fprintf(stderr, "Invalid suite id : %d\n", iSuite + 1);
continue;
}
printf("Suite id = %d: Name '%s status: %s'\n",
iSuite + 1, suites[iSuite].pName,
pSuite->fActive ? "ENABLED" : "DISABLED");
printf("Suite: %2d: %8s: %s\n",
iSuite + 1,
pSuite->fActive ? "ENABLED" : "DISABLED",
suites[iSuite].pName);
if (!pSuite->fActive)
continue;
for (iTest = 0; suites[iSuite].pTests[iTest].pName != NULL;
iTest++) {
iTest++) {
pTest = CU_get_test_by_index((unsigned int) iTest + 1,
pSuite);
pSuite);
if (!pTest) {
fprintf(stderr, "Invalid test id : %d\n", iTest + 1);
continue;
}
printf("Test id %d: Name: '%s status: %s'\n", iTest + 1,
suites[iSuite].pTests[iTest].pName,
pSuite->fActive && pTest->fActive ?
"ENABLED" : "DISABLED");
printf(" Test: %2d: %8s: %s\n",
iTest + 1,
pSuite->fActive && pTest->fActive ? "ENABLED" : "DISABLED",
suites[iSuite].pTests[iTest].pName);
}
}
}
/** Help string for command line parameters */
static const char usage[] =
"Usage: %s [-hlpr] [<-s <suite id>> [-t <test id>] [-f]] "