Ejemplo n.º 1
0
     _set_attr(attrs, 'serial')
     continue
 
 if opt in ('-u', '--usb'):
     _set_attr(attrs, 'usb')
     continue
 
 if opt in ('-q', '--quiet'):
     quiet_mode = True
     continue
 
 if opt in ('-v', '--version'):
     print 'Mediator hw_test version %s\nCopyright (c) 2009 by Cisco Systems, Inc.' % (hwtest_version())
     return 1
 
 hw_info = HardwareInfo()
 if arg:
     arg = arg.strip()
 if opt in ('-A', '--assembly'):
     if arg:
         try:
             hw_info.set_assembly(arg)
             return 1
         except:
             print 'Error writing Assembly ID.'
     return -1
 
 if opt in ('-M', '--manufacturing'):
     if arg:
         try:
             hw_info.set_serialno(arg)
Ejemplo n.º 2
0
    def __init__(self, burnin, enable_eth_tests, enable_modem_test=0, **kw):
        self._burnin = burnin
        self._preflight_done = 0

        # DO NOT CHANGE THE ORDER OF THESE THREE ITEMS!  Thank you!
        self._config = TestConfig(burnin, '/etc/hw_test.conf')
        self._hw_info = HardwareInfo()
        self._logger = TestLogger(burnin, self._hw_info.serialno())

        self._bootlog_tester = None
        self._car_tester = None
        self._dallas_tester = None
        self._eth_tester = None
        self._i2c_tester = None
        self._mem_tester = None
        self._stressmemtester = None
        self._modem_tester = None
        self._serial_tester = None
        self._usb_tester = None
        self._enabled_tests = 0

        model = self._hw_info.model()
        if kw.get('bootlog', True):
            self._bootlog_tester = BootlogTester(self._config, self._hw_info,
                                                 self._logger)
            self._enabled_tests += 1
        if kw.get('ram', True):
            self._mem_tester = MemoryTester(self._config, self._hw_info,
                                            self._logger)
            self._enabled_tests += 1
        # do not perform stress test unless called for explicitly.
        if kw.get('ramstress', False):
            self._stressmemtester = MemoryTester(self._config, self._hw_info,
                                                 self._logger, True)
            self._enabled_tests += 1
        if enable_eth_tests and kw.get('ethernet', True):
            self._eth_tester = NetworkTester(self._config, self._hw_info,
                                             self._logger)
            self._enabled_tests += 1
        if not model in ('TSWS', 'PC', 'Unknown', ''):
            self._avr_copro = avr()
            if kw.get('serial', True):
                self._serial_tester = SerialTester(self._config, self._hw_info,
                                                   self._logger)
                self._enabled_tests += 1
        if model in ('1200', '2400', '1500', '2500'):
            if kw.get('relayscounters', True):
                self._car_tester = CountersAndRelaysTester(
                    self._config, self._hw_info, self._logger, self._avr_copro)
                self._enabled_tests += 1
            if kw.get('dallas', True):
                self._dallas_tester = DallasTester(self._config, self._hw_info,
                                                   self._logger,
                                                   self._avr_copro)
                self._enabled_tests += 1
        if model in ('1500', '2500') and kw.get('i2c', True):
            self._i2c_tester = I2CTester(self._config, self._hw_info,
                                         self._logger)
            self._enabled_tests += 1
        if self._hw_info.model() in ('2400', '2500') and kw.get('usb', True):
            self._usb_tester = USBTester(self._config, self._hw_info,
                                         self._logger)
            self._enabled_tests += 1
        return