def __init__(self): TestRunner.__init__(self) self._testCaseDir = self._evbTesterHome + '/cases/' if not os.path.isdir(self._testCaseDir): print("Cannot find test case directory "+self._testCaseDir) sys.exit(2) sys.path.append(self._testCaseDir)
def addOptions(self,parser): TestRunner.addOptions(self,parser) parser.add_argument("-a","--all",action='store_true',help="run all test cases in "+self._testCaseDir) parser.add_argument("tests",nargs='*',help="name of the test cases to run") try: symbolMapfile = self._testCaseDir + os.environ["EVB_SYMBOL_MAP"] parser.add_argument("-m","--symbolMap",default=symbolMapfile,help="symbolMap file to use, [default: %(default)s]") except KeyError: parser.add_argument("-m","--symbolMap",required=True,help="symbolMap file to use")
def test(): from TestRunner import TestRunner stages = ["LEG", "DP"] metrics = ["HPWL", "TNS", "WNS"] experiment = BaseExperiment("HippocrateDP experiment", "HippocrateDP.cfg", "IWLS_GP_Hippocrate.list", metrics, stages) testRunner = TestRunner() testRunner.Append(experiment) testRunner.Run()
def addOptions(self,parser): TestRunner.addOptions(self,parser) TestRunner.addScanOptions(self,parser) parser.add_argument("configs",nargs='+',help="path to the config(s) to run") parser.add_argument("-m","--symbolMap",help="symbolMap file to use. This assumes that the launchers have been started.") parser.add_argument("--fixPorts",action='store_true',help="fix the port numbers on FEROLs and RUs") parser.add_argument("--generateAtRU",action='store_true',help="ignore the FEROLs and generate data at the RU") parser.add_argument("--dropAtRU",action='store_true',help="drop data at the RU") parser.add_argument("--dropAtSocket",action='store_true',help="drop data at pt::blit socket callback") parser.add_argument("--ferolMode",action='store_true',help="generate data on FEROL instead of FRL") parser.add_argument("--scaleFedSizesFromFile",help="scale the FED fragment sizes relative to the sizes in the given file") parser.add_argument("--calculateFedSizesFromFile",help="calculate the FED fragment sizes using the parameters in the given file")
def addOptions(self,parser): TestRunner.addOptions(self,parser) TestRunner.addScanOptions(self,parser) parser.add_argument("--foldedEVM",action='store_true',help="run a BU on the EVM node [default: %(default)s]") parser.add_argument("--canonicalEVM",action='store_true',help="emulate 7 additional FEDs on EVM [default: %(default)s]") parser.add_argument("--nRUs",default=1,type=int,help="number of RUs, excl. EVM [default: %(default)s]") parser.add_argument("--nBUs",default=1,type=int,help="number of BUs [default: %(default)s]") parser.add_argument("--nRUBUs",default=0,type=int,help="number of RUBUs, excl. EVM [default: %(default)s]") parser.add_argument("--outputDisk",help="full path to output directory. If not specified, the data is dropped on the BU") try: symbolMapfile = self._evbTesterHome + '/cases/' + os.environ["EVB_SYMBOL_MAP"] parser.add_argument("-m","--symbolMap",default=symbolMapfile,help="symbolMap file to use, [default: %(default)s]") except KeyError: parser.add_argument("-m","--symbolMap",required=True,help="symbolMap file to use")
def Append(self, newExperiment): expName = newExperiment.name if expName in self.checkersParameters: newExperiment.SetBenchmarksList(self.checkersParameters[expName]) return TestRunner.Append(self, newExperiment) return 1
def testmain(info=None, start=1, testMode=None): """ main for test runner """ daemon = None test_list = [] # load test list if len(sys.argv) <= start: testFile = info.get_config('test_list', '', "scripts/test_list.yml") print("no test files given, using %s" % testFile) with open(testFile, 'r') as fd: test_load = load(fd, Loader=Loader) test_list = test_load['test_list'] else: for k in range(start, len(sys.argv)): test_list.append(sys.argv[k]) print("Test list: " + str(test_list)) # add the multi instance module name to the Maloo test set name if len(test_list) > 1: info.set_config('setDirectiveFromConfig', 'addTestSetName', "yes") # load and start daemon if required use_daemon = info.get_config("use_daemon", "") if use_daemon: daemon = import_daemon(use_daemon, info) rc = daemon.launch_process() if rc: return rc # load test object and start the testing if testMode == "littleChief": tester = MultiRunner(info, test_list) else: tester = TestRunner(info, test_list) rc = tester.run_testcases() if daemon: daemon.stop_process() if rc == 0: print("All tests passed\n") else: print("This run had test failures\n") return rc
def runtest(config: Config, workdir: Path, results_dir: Path): print(f"========== Grading {workdir.name}") (workdir / config["output_dir"]).mkdir(exist_ok=True, parents=True) secret_files = [] with (results_dir / f"{workdir.name}.txt").open("w", encoding="utf-8") as logfile: if "build" in config: logfile.write(utils.box_text("Build Step") + "\n") # copy files from project root to build location if "required_files" in config["build"]: for file in config["build"]["required_files"]: (workdir / file["dest"]).mkdir(exist_ok=True, parents=True) try: copy( Path(".config") / file["file"], Path(workdir / file["dest"]) ) except FileNotFoundError as ex: raise click.FileError(ex.filename, "are you sure it exists?") if file.get("secret"): secret_files.append(Path(workdir / file["dest"] / file["file"])) if "commands" in config["build"]: for command in config["build"]["commands"]: br = TestResult(test_type="build", cmd=command) command = shlex.split(command) br.retval, br.stdout, br.stderr = utils.run_command( command, cwd=workdir ) logfile.write(br.log(config["output"]["build"])) # loop through and run all tests test_runner = TestRunner(logfile, workdir, config) test_runner.run_all() test_runner.log() for file in secret_files: file.unlink()
def __init__(self): TestRunner.__init__(self) # callback passed to TestCase to be called when startup is complete # and the number of measurements is zero self.afterStartupCallback = None
def __init__(self): TestRunner.__init__(self) self._symbolMap = None
from Algorithms import AlgorithmType from TestRunner import TestRunner from Utils import File dir_path = File.get_current_dir() # Get current dir File.change_dir( dir_path) # Change the working directory so we can read the file ncolors, colours = File.read_file( 'colours.txt') # Total number of colours and list of colours tr = TestRunner(colours) # Requirement 1 tr.add_run_configuration(AlgorithmType.GREEDY_CONSTRUCTIVE, 100, 30) tr.add_run_configuration(AlgorithmType.GREEDY_CONSTRUCTIVE, 500, 30) # Requirement 2 tr.add_run_configuration(AlgorithmType.HILL_CLIMBING, 100, 30) tr.add_run_configuration(AlgorithmType.HILL_CLIMBING, 500, 30) # Requirement 3 # # - 30 starts # # - Compute mean, median, STD tr.add_run_configuration(AlgorithmType.MULTI_START_HC, 100, 30) tr.add_run_configuration(AlgorithmType.MULTI_START_HC, 500, 30) # # # Requirement 4 # # - 30 starts # # - Compute mean, median, STD # IMPORTANT: Time required for DELTA SORT: ~16 minutes. #
#Client from TestRunner import TestRunner if __name__ == '__main__': testRunner = TestRunner() testRunner.runAll()
def __init__(self, chkParams): self.checkersParameters = chkParams TestRunner.__init__(self)
def get(self): testRunner = TestRunner(self.directory) self.write(testRunner.run())
from sys import argv from TestRunner import TestRunner """ Please implement TestRunner class (check requirements in TestRunner.py). It should get module name as input and execute all methods from this module that name starts from 'test_' Please use TestClass from test_class.py as an example of this test class. So for this test class execution should look like this: /Users/avolkov/work/virtual_env_37/bin/python3.7 run.py suites.test_class.TestClass pass: 2 |error: 1 |fail: 1 |skipped: 1 Process finished with exit code 0 """ if __name__ == '__main__': file_name = argv[0] tr = TestRunner(file_name) tr.process_tests() print(tr.get_result())
import os from TestRunner import TestRunner import unittest class MyTestCase(unittest.TestCase): def test_A(self): """A simple test that should PASS.""" self.assertTrue(True) def test_B(self): """A simple test FAILURE.""" self.assertFalse(True) @staticmethod def test_C(): """A simple ERROR raising test.""" assert 1 + 'a' == 32 if __name__ == '__main__': test_suite = unittest.TestLoader().loadTestsFromTestCase(MyTestCase) fp = os.path.join(os.path.dirname(__file__), "test.html") runner = TestRunner(stream=fp, title="My test report sample", description="This is a sample test case.") runner.run(test_suite)
from TestRunner import TestRunner from scipy.optimize import minimize import numpy as np test_runner = TestRunner() test_runner.optimise(maxiter=2000) test_runner.draw_plot()
testing.add_argument("--test", choices=TestRunner.tests, nargs='+', help="Transport layer to be tested") testing.add_argument("--skip-execution", action='store_true', help="parse and plot existing data") testing.add_argument("--calculate-mean", action='store_true', help="find all previous results and calculate mean values") testing.add_argument("--test-id", help="store this test id with results for later reference") tools = parser.add_argument_group('tools', '') tools.add_argument("--build-all", action='store_true', help ="build all images") tools.add_argument("--build", choices=TestRunner.images, nargs='+', help="delete an existing image and build a new one") tools.add_argument("--clean", action='store_true', help ="stop and remove all containers") tools.add_argument("--qtcreator", help="Run QT Creator in the specified image") if not os.path.isdir("comm"): print("Run this script from the project root directory, e.g.: ./python/run.py") elif len(sys.argv) == 1: parser.print_help() else: args = parser.parse_args() runner = TestRunner() if args.build: for image in reversed(args.build): runner.remove_containers(image) subprocess.call("./scripts/remove_image.sh {}".format(image), shell = True) for image in args.build: subprocess.call("./scripts/build_image.sh {}".format(image), shell = True) elif args.build_all: for name in reversed(runner.images): runner.remove_containers(name) subprocess.call("./scripts/remove_image.sh {}".format(name), shell = True) for name in runner.images: subprocess.call("./scripts/build_image.sh {}".format(name), shell = True) elif args.qtcreator: subprocess.call("./scripts/qtcreator.sh {} {}".format(args.qtcreator, os.getcwd()), shell = True) elif args.clean: