MCPcopy Create free account
hub / github.com/KratosMultiphysics/Kratos / main

Function main

kratos/python_scripts/testing/run_cpp_tests.py:10–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8from KratosMultiphysics.testing import utilities as testing_utils
9
10def main():
11 # Define the command
12 cmd = testing_utils.GetPython3Command()
13
14 # List of application
15 applications = kratos_utils.GetListOfAvailableApplications()
16
17 # Parse command line options
18 parser = argparse.ArgumentParser()
19
20 parser.add_argument('-c', '--command', default=cmd, help="Use the provided command to launch test cases. If not provided, the default \'python\' executable is used")
21 parser.add_argument('-l', '--level', default='all', choices=['all', 'nightly', 'small', 'validation'], help="Minimum level of detail of the tests: \'all\'(Default) \'(nightly)\' \'(small)\'")
22 parser.add_argument('-v', '--verbosity', default=1, type=int, choices=[0, 1, 2], help="Verbosity level: 0, 1 (Default), 2")
23 parser.add_argument('-a', '--applications', default=applications, help="List of applications to run separated by \':\'. All compiled applications will be run by default")
24 parser.add_argument('-m', '--using-mpi', default=False, help="If running in MPI and executing the MPI-tests")
25 parser.add_argument('-t', '--timer', default=-1, help="Use the provided custom time limit for the execution. If not provided, the default values are used")
26
27 args = parser.parse_args()
28
29 # Set if mpi
30 if args.using_mpi:
31 level = "mpi_" + level
32
33 # Parser the applications
34 if isinstance(args.applications,str):
35 parsedApps = args.applications.split(':')
36 else:
37 parsedApps = args.applications
38 for a in parsedApps:
39 if a not in applications + ['KratosCore']:
40 print('Warning: Application {} does not exist'.format(a))
41 sys.exit()
42 applications = parsedApps
43 if 'KratosCore' in applications:
44 applications.remove('KratosCore')
45
46 # Set timeout of the different levels
47 signalTime = None
48 if int(args.timer) > 0:
49 signalTime = int(args.timer)
50 else:
51 if args.level == 'small':
52 signalTime = int(90)
53 elif args.level == 'nightly':
54 signalTime = int(900)
55
56 # Custom configuration
57 config = {
58 "KratosGeoMechanicsCoreTest" : {
59 "working_dir": pathlib.Path(kratos_utils.GetKratosMultiphysicsPath()).parents[0] # GeoMechanicsCore needs to be run from the KratosMultiphysics install directory, not the module directory
60 }
61 }
62
63 # Create the commands
64 commander = testing_utils.Commander()
65
66 # Run the tests
67 commander.RunCppTests(applications, signalTime, config)

Callers 1

run_cpp_tests.pyFile · 0.70

Calls 8

RunCppTestsMethod · 0.95
isinstanceFunction · 0.85
maxFunction · 0.85
exitMethod · 0.80
valuesMethod · 0.80
printFunction · 0.50
formatMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected