sanitycheck: support listing test cases
Parse all yaml file and create a list of declared testcases. This does
list the individual tests inside test projects, not only the projects
containing the tests, for example:
$ sanitycheck --list-tests -T tests/net/socket/
- net.socket.udp.send_recv_2_sock
- net.socket.udp.v4_sendto_recvfrom
- net.socket.udp.v6_sendto_recvfrom
- net.socket.udp.v4_bind_sendto
- net.socket.udp.v6_bind_sendto
- net.socket.getaddrinfo_ok
- net.socket.getaddrinfo_no_host
- net.socket.tcp.v4_send_recv
- net.socket.tcp.v6_send_recv
- net.socket.tcp.v4_sendto_recvfrom
- net.socket.tcp.v6_sendto_recvfrom
- net.socket.tcp.v4_sendto_recvfrom_null_dest
- net.socket.tcp.v6_sendto_recvfrom_null_dest
13 total.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/scripts/sanitycheck b/scripts/sanitycheck
index 79714fd..6f55c97 100755
--- a/scripts/sanitycheck
+++ b/scripts/sanitycheck
@@ -2213,6 +2213,9 @@
parser.add_argument("--list-tags", action="store_true",
help="list all tags in selected tests")
+ parser.add_argument("--list-tests", action="store_true",
+ help="list all tests.")
+
parser.add_argument(
"-r", "--release", action="store_true",
help="Update the benchmark database with the results of this test "
@@ -2512,6 +2515,16 @@
return
+ if options.list_tests:
+ cnt = 0
+ for n,tc in ts.testcases.items():
+ for c in tc.cases:
+ cnt = cnt + 1
+ print(" - {}".format(c))
+
+ print("{} total.".format(cnt))
+ return
+
discards = []
if options.load_tests:
ts.load_from_file(options.load_tests)