def run_mdtest(self, manager, processes): """Run the Mdtest command. Args: manager (str): mpi job manager command processes (int): number of host processes """ env = self.mdtest_cmd.get_default_env(str(manager), self.tmp, get_log_file(self.client_log)) manager.setup_command(env, self.hostfile_clients, processes) try: manager.run() except CommandFailure as error: self.log.error("Mdtest Failed: %s", str(error)) self.fail("Test was expected to pass but it failed.\n")
def run_ior(self, manager, processes, intercept=None): """Run the IOR command. Args: manager (str): mpi job manager command processes (int): number of host processes intercept (str): path to interception library. """ env = self.ior_cmd.get_default_env(str(manager), self.tmp, get_log_file(self.client_log)) if intercept: env["LD_PRELOAD"] = intercept manager.setup_command(env, self.hostfile_clients, processes) try: out = manager.run() return out except CommandFailure as error: self.log.error("IOR Failed: %s", str(error)) self.fail("Test was expected to pass but it failed.\n")
def run_subtest(self): """Run daos_test with a subtest argument.""" subtest = self.params.get("daos_test", '/run/daos_tests/Tests/*') num_clients = self.params.get("num_clients", '/run/daos_tests/num_clients/*') num_replicas = self.params.get("num_replicas", '/run/daos_tests/num_replicas/*') args = self.params.get("args", '/run/daos_tests/Tests/*', "") cmd = "{} {} -n {} -x D_LOG_FILE={} {} -s {} -{} {}".format( self.orterun, self.client_mca, num_clients, get_log_file(self.client_log), self.daos_test, num_replicas, subtest, args) env = {} env['CMOCKA_XML_FILE'] = "%g_results.xml" env['CMOCKA_MESSAGE_OUTPUT'] = "xml" load_mpi("openmpi") try: process.run(cmd, env=env) except process.CmdError as result: if result.result.exit_status is not 0: # fake a JUnit failure output with open(self.subtest_name + "_results.xml", "w") as results_xml: results_xml.write('''<?xml version="1.0" encoding="UTF-8"?> <testsuite name="{0}" errors="1" failures="0" skipped="0" tests="1" time="0.0"> <testcase name="ALL" time="0.0" > <error message="Test failed to start up"/> <system-out> <![CDATA[{1}]]> </system-out> <system-err> <![CDATA[{2}]]> </system-err> </testcase> </testsuite>'''.format(self.subtest_name, result.result.stdout, result.result.stderr)) self.fail("{0} failed with return code={1}.\n" .format(cmd, result.result.exit_status))
def _start_dfuse(self): """Create a DfuseCommand object to start dfuse.""" # Get Dfuse params self.dfuse = Dfuse(self.hostlist_clients, self.tmp, log_file=get_log_file(self.client_log), dfuse_env=True) self.dfuse.get_params(self) # update dfuse params self.dfuse.set_dfuse_params(self.pool) self.dfuse.set_dfuse_cont_param(self._create_cont()) try: # start dfuse self.dfuse.run() except CommandFailure as error: self.log.error("Dfuse command %s failed on hosts %s", str(self.dfuse), str(NodeSet(self.dfuse.hosts)), exc_info=error) self.fail("Unable to launch Dfuse.\n")
def start_dfuse(self): """Create a DfuseCommand object to start dfuse.""" # Get Dfuse params self.dfuse = Dfuse(self.hostlist_clients, self.tmp, log_file=get_log_file(self.client_log), dfuse_env=True) self.dfuse.get_params(self) # update dfuse params self.dfuse.set_dfuse_params(self.pool) self.dfuse.set_dfuse_cont_param(self.container) try: # start dfuse self.dfuse.run() except CommandFailure as error: self.log.error("Dfuse command %s failed on hosts %s", str(self.dfuse), str(NodeSet.fromlist(self.dfuse.hosts)), exc_info=error) self.fail("Test was expected to pass but it failed.\n")
def run_multiple_ior(self, hostfile, num_clients, results, job_num, intercept=None): #pylint: disable=too-many-arguments """Run the IOR command. Args: manager (str): mpi job manager command processes (int): number of host processes intercept (str): path to interception library. """ self.lock.acquire(True) tsize = self.ior_cmd.transfer_size.value testfile = os.path.join(self.dfuse.mount_dir.value, "testfile{}{}".format(tsize, job_num)) if intercept: testfile += "intercept" self.ior_cmd.test_file.update(testfile) manager = self.get_job_manager_command() procs = (self.processes // len(self.hostlist_clients)) * num_clients env = self.ior_cmd.get_default_env(str(manager), self.tmp, get_log_file(self.client_log)) if intercept: env["LD_PRELOAD"] = intercept manager.setup_command(env, hostfile, procs) self.lock.release() try: out = manager.run() self.lock.acquire(True) results[job_num] = IorCommand.get_ior_metrics(out) self.lock.release() except CommandFailure as error: self.log.error("IOR Failed: %s", str(error)) self.fail("Test was expected to pass but it failed.\n")