Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vsock/test: Introduce option to select tests

Allow for selecting specific test IDs to be executed.

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
Link: https://patch.msgid.link/20241219-test-vsock-leaks-v4-2-a416e554d9d7@rbox.co
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Michal Luczaj and committed by
Jakub Kicinski
ef8bd18f f3af3ba1

+40 -2
+27 -2
tools/testing/vsock/util.c
··· 486 486 exit(EXIT_FAILURE); 487 487 } 488 488 489 - void skip_test(struct test_case *test_cases, size_t test_cases_len, 490 - const char *test_id_str) 489 + static unsigned long parse_test_id(const char *test_id_str, size_t test_cases_len) 491 490 { 492 491 unsigned long test_id; 493 492 char *endptr = NULL; ··· 504 505 exit(EXIT_FAILURE); 505 506 } 506 507 508 + return test_id; 509 + } 510 + 511 + void skip_test(struct test_case *test_cases, size_t test_cases_len, 512 + const char *test_id_str) 513 + { 514 + unsigned long test_id = parse_test_id(test_id_str, test_cases_len); 507 515 test_cases[test_id].skip = true; 516 + } 517 + 518 + void pick_test(struct test_case *test_cases, size_t test_cases_len, 519 + const char *test_id_str) 520 + { 521 + static bool skip_all = true; 522 + unsigned long test_id; 523 + 524 + if (skip_all) { 525 + unsigned long i; 526 + 527 + for (i = 0; i < test_cases_len; ++i) 528 + test_cases[i].skip = true; 529 + 530 + skip_all = false; 531 + } 532 + 533 + test_id = parse_test_id(test_id_str, test_cases_len); 534 + test_cases[test_id].skip = false; 508 535 } 509 536 510 537 unsigned long hash_djb2(const void *data, size_t len)
+2
tools/testing/vsock/util.h
··· 62 62 void list_tests(const struct test_case *test_cases); 63 63 void skip_test(struct test_case *test_cases, size_t test_cases_len, 64 64 const char *test_id_str); 65 + void pick_test(struct test_case *test_cases, size_t test_cases_len, 66 + const char *test_id_str); 65 67 unsigned long hash_djb2(const void *data, size_t len); 66 68 size_t iovec_bytes(const struct iovec *iov, size_t iovnum); 67 69 unsigned long iovec_hash_djb2(const struct iovec *iov, size_t iovnum);
+11
tools/testing/vsock/vsock_test.c
··· 1645 1645 .val = 's', 1646 1646 }, 1647 1647 { 1648 + .name = "pick", 1649 + .has_arg = required_argument, 1650 + .val = 't', 1651 + }, 1652 + { 1648 1653 .name = "help", 1649 1654 .has_arg = no_argument, 1650 1655 .val = '?', ··· 1686 1681 " --peer-cid <cid> CID of the other side\n" 1687 1682 " --peer-port <port> AF_VSOCK port used for the test [default: %d]\n" 1688 1683 " --list List of tests that will be executed\n" 1684 + " --pick <test_id> Test ID to execute selectively;\n" 1685 + " use multiple --pick options to select more tests\n" 1689 1686 " --skip <test_id> Test ID to skip;\n" 1690 1687 " use multiple --skip options to skip more tests\n", 1691 1688 DEFAULT_PEER_PORT ··· 1742 1735 break; 1743 1736 case 's': 1744 1737 skip_test(test_cases, ARRAY_SIZE(test_cases) - 1, 1738 + optarg); 1739 + break; 1740 + case 't': 1741 + pick_test(test_cases, ARRAY_SIZE(test_cases) - 1, 1745 1742 optarg); 1746 1743 break; 1747 1744 case '?':