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>
This commit is contained in:
Anas Nashif 2018-04-14 23:12:58 -05:00 committed by Anas Nashif
commit c0149cc01d

View file

@ -2213,6 +2213,9 @@ def parse_arguments():
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 @@ def main():
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)