def __init__(self, options, _class=None, **kwargs): super(_class, self).__init__(options, QEMUMachineX64Operations(self), **kwargs) # 60 seconds per core def get_boot_timeout(self): return self.get_ncores() * 60 # 120 seconds per core def get_test_timeout(self): return self.get_ncores() * 120 MachineFactory.addMachine('qemu%d' % n, TmpMachine, ncores=n, bootarch='x86_64', _class=TmpMachine) class QEMUMachineARMv7Uniproc(ARMMachineBase): '''Uniprocessor ARMv7 QEMU''' name = 'qemu_armv7' imagename = "armv7_a15ve_1_image" def __init__(self, options, **kwargs): super(QEMUMachineARMv7Uniproc, self).__init__(options, QEMUMAchineARMv7UniprocOperations(self), **kwargs) self._set_kernel_image()
def parse_args(): p = optparse.OptionParser( usage='Usage: %prog [options] SOURCEDIR RESULTDIR', description='Barrelfish regression/benchmark harness') g = optparse.OptionGroup(p, 'Basic options') g.add_option('-b', '--build', action='append', dest='buildspecs', metavar='BUILD', help='build types to perform [default: test]') g.add_option('-B', '--buildbase', dest='buildbase', metavar='DIR', help='places builds under DIR [default: SOURCEDIR/builds]') g.add_option('-e', '--existingbuild', dest='existingbuild', metavar='DIR', help='existing build directory (may not be used with -b)') g.add_option('-m', '--machine', action='append', dest='machinespecs', metavar='MACHINE', help='victim machines to use') g.add_option('-t', '--test', action='append', dest='testspecs', metavar='TEST', help='tests/benchmarks to run') g.add_option('-c', '--comment', dest='comment', help='comment to store with all collected data') g.add_option('-x', '--xml', dest='xml', action='store_true', default=False, help='output summary of tests in Junit XML format') p.add_option_group(g) g = optparse.OptionGroup(p, 'Debugging options') g.add_option('-L', '--listall', action='store_true', dest='listall', help='list available builds, machines and tests') debug.addopts(g, 'debuglevel') g.add_option('-k', '--keepgoing', action='store_true', dest='keepgoing', help='attempt to continue on errors') p.add_option_group(g) p.set_defaults(debuglevel=debug.NORMAL) options, args = p.parse_args() debug.current_level = options.debuglevel if options.listall: list_all() sys.exit(0) if len(args) != 2: p.error('source and results directories must be specified') options.sourcedir, options.resultsdir = args # determine default buildbase if needed if options.buildbase is None: options.buildbase = os.path.join(options.sourcedir, 'builds') # check validity of source and results dirs if not os.path.isdir(os.path.join(options.sourcedir, 'hake')): p.error('invalid source directory %s' % options.sourcedir) if not (os.path.isdir(options.resultsdir) and os.access(options.resultsdir, os.W_OK)): p.error('invalid results directory %s' % options.resultsdir) if options.xml and not have_junit_xml: p.error('--xml requires junit-xml.\n' 'Please install junit-xml through pip or easy_install') # resolve and instantiate all builds def _lookup(spec, classes, nameFn=lambda c: c.name.lower()): spec = spec.lower() return [c for c in classes if fnmatch.fnmatch(nameFn(c), spec)] if options.existingbuild: if options.buildspecs: p.error('existing build directory cannot be used together' ' with build types (-b)') options.builds = [builds.existingbuild(options, options.existingbuild)] options.buildbase = options.existingbuild else: options.builds = [] if not options.buildspecs: options.buildspecs = ['test'] for spec in options.buildspecs: matches = _lookup(spec, builds.all_builds) if matches == []: p.error('no builds match "%s" (try -L for a list)' % spec) options.builds.extend( [b for b in matches if b not in options.builds]) options.builds = [b(options) for b in options.builds] # resolve and instantiate all machines if options.machinespecs is None: p.error('no machines specified') options.machines = [] for spec in options.machinespecs: matches = _lookup(spec, MachineFactory.machineFactories, nameFn=lambda fac: fac.lower()) if matches == []: p.error('no machines match "%s" (try -L for a list)' % spec) options.machines.extend( [m for m in matches if m not in options.machines]) options.machines = [ MachineFactory.createMachineByName(m, options) for m in options.machines ] # resolve and instantiate all tests if options.testspecs: options.tests = [] for spec in options.testspecs: matches = _lookup(spec, tests.all_tests) if matches == []: p.error('no tests match "%s" (try -L for a list)' % spec) options.tests.extend( [t for t in matches if t not in options.tests]) else: p.error('no tests specified (try -t memtest if unsure)') options.tests = [t(options) for t in options.tests] debug.verbose('Host: ' + gethostname()) debug.verbose('Builds: ' + ', '.join([b.name for b in options.builds])) debug.verbose('Machines: ' + ', '.join([m.getName() for m in options.machines])) debug.verbose('Tests: ' + ', '.join([t.name for t in options.tests])) return options
# def get_ncores(self): # return 1 # def _get_cmdline(self): # script_path = os.path.join(self.options.sourcedir, 'tools/arm_gem5', 'gem5script.py') # return (['gem5.fast', script_path, '--kernel=%s'%self.kernel_img, '--n=%s'%self.get_ncores()] # + GEM5_CACHES_ENABLE) class Gem5MachineARMSingleCore(Gem5MachineARM): name = 'armv7_gem5' def __init__(self, options, **kwargs): super(Gem5MachineARMSingleCore, self).__init__(options, Gem5MachineARMSingleCoreOperations(self), **kwargs) class Gem5MachineARMSingleCoreOperations(Gem5MachineARMOperations): def _get_cmdline(self): self.get_free_port() script_path = \ os.path.join(self._machine.options.sourcedir, 'tools/arm_gem5', 'boot_gem5.sh') return ([script_path, 'VExpress_EMM', self._machine.kernel_img, GEM5_PATH, str(self.telnet_port)]) MachineFactory.addMachine(Gem5MachineARMSingleCore.name, Gem5MachineARMSingleCore, bootarch="armv7", platform="a15ve")
def __rackboot(self, args): debug.checkcmd([RACKBOOT] + args + [self._machine.get_machine_name()]) def setup(self): if self._machine.get_bootarch() == "armv8": self.__rackboot(["-b", "-H", "-n"]) else: self.__rackboot(["-b", "-n"]) def __rackpower(self, arg): try: debug.checkcmd([RACKPOWER, arg, self._machine.get_machine_name()]) except subprocess.CalledProcessError: debug.warning("rackpower %s %s failed" % (arg, self._machine.get_machine_name())) def reboot(self): self.__rackpower('-r') def shutdown(self): self.__rackpower('-d') for n in sorted(ETHMachine._machines.keys()): class TmpMachine(ETHMachine): name = n MachineFactory.addMachine(n, TmpMachine, **ETHMachine._machines[n])
class FVPMachineARMv7NCoresOperations(FVPMachineBaseOperations): def _get_cmdline(self): self.get_free_port() return [os.path.join(FVP_PATH, "FVP_VE_Cortex-A9x" + str(self._machine.get_ncores())), # Don't try to pop an LCD window up "-C", "motherboard.vis.disable_visualisation=1", # Don't start a telnet xterm "-C", "motherboard.terminal_0.start_telnet=0", "-C", "motherboard.terminal_0.start_port=%d" % self.telnet_port, self._machine.kernel_img] # Single core machine MachineFactory.addMachine("armv7_fvp", FVPMachineARMv7NCores, bootarch="armv7", platform="a9ve") # Quad-core machine MachineFactory.addMachine('armv7_fvp_4', FVPMachineARMv7NCores, bootarch="armv7", platform="a9ve", ncores=4) class FVPMachineEFI(FVPMachineBase): imagename = "armv8_efi" def __init__(self, options, simulator=None, **kwargs): super(FVPMachineEFI, self).__init__(options, FVPMachineEFIOperations(self), **kwargs) assert(simulator)
failed = False while retries > 0: try: debug.checkcmd([RACKPOWER, arg, self.get_machine_name()]) except subprocess.CalledProcessError: debug.warning("rackpower %s %s failed" % (arg, self.get_machine_name())) failed = True if retries > 0: debug.verbose("retrying...") retries -= 1 if not failed: break def reboot(self): self.__rackpower('-r') def shutdown(self): self.__rackpower('-d') def get_output(self): return self.console_out for n in sorted(UWMachine._uw_machines.keys()): class TmpMachine(UWMachine): name = n MachineFactory.addMachine(n, TmpMachine, **UWMachine._uw_machines[n])
# for Pandaboards we cannot do console -i <machine> so we grab full -i # output and find relevant line here proc = subprocess.Popen(["console", "-i"], stdout=subprocess.PIPE) output = proc.communicate()[0] assert(proc.returncode == 0) output = map(str.strip, output.split("\n")) return filter(lambda l: l.startswith(self._machine.get_machine_name()), output)[0] def __rackpower(self, arg): try: debug.checkcmd([RACKPOWER, arg, self._machine.get_machine_name()]) except subprocess.CalledProcessError: debug.warning("rackpower %s %s failed" % (arg, self._machine.get_machine_name())) def reboot(self): self.__usbboot() def shutdown(self): self.__rackpower('-d') for pb in ETHRackPandaboardMachine._machines: class TmpMachine(ETHRackPandaboardMachine): name = pb MachineFactory.addMachine(pb, TmpMachine, **ETHRackPandaboardMachine._machines[pb]) MachineFactory.addMachine("panda_local", PandaboardMachine, bootarch='armv7', platform='omap44xx', ncores=2)
super(_class, self).__init__(options, QEMUMachineX64Operations(self), **kwargs) # 60 seconds per core def get_boot_timeout(self): return self.get_ncores() * 60 # 120 seconds per core def get_test_timeout(self): return self.get_ncores() * 240 for n in [1, 2, 4]: MachineFactory.addMachine('qemu_x86_64_c%d' % n, TmpMachine, ncores=n, bootarch='x86_64', _class=TmpMachine) class QEMUMachineARMv7(ARMMachineBase): '''ARMv7 QEMU''' name = 'qemu_armv7' imagename = "armv7_a15ve_4_image" def __init__(self, options, **kwargs): super(QEMUMachineARMv7, self).__init__(options, QEMUMAchineARMv7Operations(self), **kwargs) self._set_kernel_image()
def __rackboot(self, args): debug.checkcmd([RACKBOOT] + args + [self.get_machine_name()]) def setup(self): self.__rackboot(["-b", "-n"]) def __rackpower(self, arg): try: debug.checkcmd([RACKPOWER, arg, self.get_machine_name()]) except subprocess.CalledProcessError: debug.warning("rackpower %s %s failed" % (arg, self.get_machine_name())) def reboot(self): self.__rackpower('-r') def shutdown(self): self.__rackpower('-d') def get_output(self): return self.console_out for n in sorted(MSRCMachine._msrc_machines.keys()): class TmpMachine(MSRCMachine): name = n MachineFactory.addMachine(n, TmpMachine)
self.__chmod_ar(self.target_name) def __usbboot(self): debug.checkcmd([ BFBOOT, "--bf", self.target_name, "--board", self.__get_colibri_num()]) def __rackpower(self, arg): try: debug.checkcmd([RACKPOWER, arg, self._machine.get_machine_name()]) except subprocess.CalledProcessError: debug.warning("rackpower %s %s failed" % (arg, self._machine.get_machine_name())) def reboot(self): self.__usbboot() def shutdown(self): self.__rackpower('-d') for pb in ETHRackColibriMachine._machines: class TmpMachine(ETHRackColibriMachine): name = pb MachineFactory.addMachine(pb, TmpMachine, **ETHRackColibriMachine._machines[pb]) MachineFactory.addMachine("colibri_local", ColibriLocalMachine, bootarch='armv8', platform='imx8x', ncores=4)