xref: /f-stack/dpdk/app/test/autotest.py (revision 2d9fd380)
1#!/usr/bin/env python3
2# SPDX-License-Identifier: BSD-3-Clause
3# Copyright(c) 2010-2014 Intel Corporation
4
5# Script that uses either test app or qemu controlled by python-pexpect
6import autotest_data
7import autotest_runner
8import sys
9
10
11def usage():
12    print("Usage: autotest.py [test app|test iso image] ",
13          "[target] [allow|-block]")
14
15if len(sys.argv) < 3:
16    usage()
17    sys.exit(1)
18
19target = sys.argv[2]
20
21test_allowlist = None
22test_blocklist = None
23
24# get blocklist/allowlist
25if len(sys.argv) > 3:
26    testlist = sys.argv[3].split(',')
27    testlist = [test.lower() for test in testlist]
28    if testlist[0].startswith('-'):
29        testlist[0] = testlist[0].lstrip('-')
30        test_blocklist = testlist
31    else:
32        test_allowlist = testlist
33
34cmdline = "%s -c f" % (sys.argv[1])
35
36print(cmdline)
37
38# how many workers to run tests with. FreeBSD doesn't support multiple primary
39# processes, so make it 1, otherwise make it 4. ignored for non-parallel tests
40n_processes = 1 if "bsd" in target else 4
41
42runner = autotest_runner.AutotestRunner(cmdline, target, test_blocklist,
43                                        test_allowlist, n_processes)
44
45runner.parallel_tests = autotest_data.parallel_test_list[:]
46runner.non_parallel_tests = autotest_data.non_parallel_test_list[:]
47
48num_fails = runner.run_all_tests()
49
50sys.exit(num_fails)
51