def test_process_find(self): self.assertIsNotNone(find_executable('ls')) self.assertIsNotNone(find_executable('ellesse', ['elaisse', 'ls'])) os.environ['ELLESSE'] = '/usr/bin/elesse' try: self.assertEqual(find_executable('ellesse'), '/usr/bin/elesse') self.assertIsNone( find_executable('elaisse', ['elesse'], required=False)) finally: os.environ.pop('ELLESSE')
def executable(self): """Get absolute path to iperf executable """ return find_executable(self.attributes['executable'])
def executable(self): """get absolute path to mdtest utility """ return find_executable(self.attributes['executable'])
def test_process_not_found(self): self.assertIsNone(find_executable('ellesse', required=False)) with self.assertRaises(NameError): find_executable('ellesse') find_executable('ellesse', ['elaisse'])
import subprocess import tempfile from cached_property import cached_property import six import yaml from hpcbench.campaign import from_file as campaign_from_file from hpcbench.driver import write_yaml_report from hpcbench.report import ENV from hpcbench.toolbox.contextlib_ext import mkdtemp, pushd from hpcbench.toolbox.process import find_executable LOGGER = logging.getLogger('benet') SSH = find_executable('ssh') SCP = find_executable('scp') RE_TYPE = type(re.compile('hello')) class CampaignHolder(object): """Abstract class to ease usage of ``campaign`` configuration """ def __init__(self, campaign): self.campaign = campaign def ssh(self, *args): """Build a SSH command :param args: arguments given to the command :return: command line :rtype: list of string