MCPcopy Create free account
hub / github.com/ElementsProject/elements / main

Function main

test/bitcoin_functional/functional/test_runner.py:219–328  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

217]
218
219def main():
220 # Parse arguments and pass through unrecognised args
221 parser = argparse.ArgumentParser(add_help=False,
222 usage='%(prog)s [test_runner.py options] [script options] [scripts]',
223 description=__doc__,
224 epilog='''
225 Help text and arguments for individual test script:''',
226 formatter_class=argparse.RawTextHelpFormatter)
227 parser.add_argument('--combinedlogslen', '-c', type=int, default=0, metavar='n', help='On failure, print a log (of length n lines) to the console, combined from the test framework and all test nodes.')
228 parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')
229 parser.add_argument('--ci', action='store_true', help='Run checks and code that are usually only enabled in a continuous integration environment')
230 parser.add_argument('--exclude', '-x', help='specify a comma-separated-list of scripts to exclude.')
231 parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
232 parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
233 parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
234 parser.add_argument('--keepcache', '-k', action='store_true', help='the default behavior is to flush the cache directory on startup. --keepcache retains the cache from the previous testrun.')
235 parser.add_argument('--quiet', '-q', action='store_true', help='only print dots, results summary and failure logs')
236 parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs")
237 parser.add_argument('--failfast', action='store_true', help='stop execution after the first test failure')
238 args, unknown_args = parser.parse_known_args()
239
240 # args to be passed on always start with two dashes; tests are the remaining unknown args
241 tests = [arg for arg in unknown_args if arg[:2] != "--"]
242 passon_args = [arg for arg in unknown_args if arg[:2] == "--"]
243
244 # Read config generated by configure.
245 config = configparser.ConfigParser()
246 # ELEMENTS:
247 configfile = os.path.abspath(os.path.dirname(__file__)) + "/../../config.ini"
248 config.read_file(open(configfile, encoding="utf8"))
249
250 passon_args.append("--configfile=%s" % configfile)
251
252 # Set up logging
253 logging_level = logging.INFO if args.quiet else logging.DEBUG
254 logging.basicConfig(format='%(message)s', level=logging_level)
255
256 # Create base test directory
257 tmpdir = "%s/test_runner_₿_🏃_%s" % (args.tmpdirprefix, datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
258
259 os.makedirs(tmpdir)
260
261 logging.debug("Temporary test directory at %s" % tmpdir)
262
263 enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
264
265 if not enable_bitcoind:
266 print("No functional tests to run.")
267 print("Rerun ./configure with --with-daemon and then make")
268 sys.exit(0)
269
270 # Build list of tests
271 test_list = []
272 if tests:
273 # Individual tests have been specified. Run specified tests that exist
274 # in the ALL_SCRIPTS list. Accept the name with or without .py extension.
275 tests = [test + ".py" if ".py" not in test else test for test in tests]
276 for test in tests:

Callers 1

test_runner.pyFile · 0.70

Calls 7

nowMethod · 0.80
formatMethod · 0.80
check_script_listFunction · 0.70
check_script_prefixesFunction · 0.70
run_testsFunction · 0.70
removeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected