def buzz(self, sn): if self.passed: sounder.sound_and_confirm('%s has passed the test' % sn, sound_passed, repeat=True) else: sounder.sound_and_confirm('%s has failed the test' % sn, sound_failed, repeat=True)
def alt_buzz(self, sn): if self.passed: sounder.play(sound_passed_clap, repeat=False) sounder.sound_and_confirm('%s has passed the test' % sn, sound_passed, repeat=True) tp5_poly else: sounder.play(sound_failed_noo, repeat=Ftp5_polyalseself) sounder.sound_and_confirm('%s has failed the test' % sn, sound_failed, repeat=True)
def alt_buzz(self, sn): if not blmdebug: if self.passed: sounder.play(sound_passed_clap, repeat=False) sounder.sound_and_confirm('%s has passed the test' % sn, sound_passed, repeat=True) else: sounder.play(sound_failed_noo, repeat=False) sounder.sound_and_confirm('%s has failed the test' % sn, sound_failed, repeat=True)
def run(self): self.passed = True self.start_time = time() start_time_str = strftime('%Y%m%d_%H%M%S', localtime(self.start_time)) log_file_name = self.ethMAC + '_' + start_time_str + '.log' log_file_path = join(logdir, log_file_name) with open(log_file_path, 'wb') as outputstream: try: self.outputstream = outputstream self.log('testing: %s\n' % self.ethMAC) try: self.conditional_login() except: self.ex(linux_console_message, ex_timeout=300, ch_timeout=120) self.conditional_login() self.eth_mac_test() self.usb_test() self.rf_module_test() self.linux_reboot() self.ex('Hit any key to stop autoboot:', ex_timeout=15) self.write('\r') self.ex(uboot_prompt) ser_mgmt = SerMgmt(self.read_word, self.write_word) ser_mgmt.led_set(True, True) except: self.passed = False self.log(traceback.format_exc()) finally: try: close() except: pass self.end_time = time() self.elapsed = self.end_time - self.start_time self.log('elapsed: %.0f seconds' % self.elapsed) self.outcome = "PASSED" if self.passed else "FAILED" self.log('outcome: %s' % self.outcome) print_outcome(self.passed, sys.stderr) if self.passed: sound_and_confirm('%s has passed the test' % self.ethMAC, sound_passed, repeat=True) else: sound_and_confirm('%s has failed the test' % self.ethMAC, sound_failed, repeat=True)
def run_loop(): while True: sys.stderr.write( ''' ********************************************************* * Before connecting the E10 board, scan the MAC address * ********************************************************* ''') ethMAC = raw_input('MAC address:').upper() sys.stderr.write( ''' ************************************************************************ * Connect the Ethernet network cable to the RJ45 connector of the UUT, * * connect USB cable to the micro-USB of the UUT * * place the UUT on the fixture and close the fixture * ************************************************************************ * Finally, press Enter to continue * ************************************************************************ ''') wait_for_enter() ports = find_uut_ports() portslen = len(ports) if portslen == 1 or portslen == 2: e10 = E10_Tester(ports[portslen - 1], ethMAC, usb_test_enabled=usb_test_enabled, rf_module_test_enabled=rf_module_test_enabled) e10.run() if e10.passed: sound_and_confirm('%s has passed the test' % ethMAC, sound_passed, repeat=True) else: sound_and_confirm('%s has failed the test' % ethMAC, sound_failed, repeat=True) elif portslen == 0: sys.stderr.write('UUT is not found') else: sys.stderr.write( 'more than one FTDI chips are connected to the USB')
def buzz(self): import sounder sound_failed = 'gong.ogg' sound_passed = 'magic.ogg' if self.passed: sounder.sound_and_confirm('%s has passed the test' % self.sn, sound_passed, repeat=True) else: if self.failed_step: sounder.sound_and_confirm( '%s has failed the test at test step: %s' % (self.sn, self.failed_step), sound_failed, repeat=True) else: sounder.sound_and_confirm('%s has failed the test' % self.sn, sound_failed, repeat=True)
def run(self): # detect ports while self.detect() > 0: pass number_of_port_to_test = len(self.ports_to_test) if number_of_port_to_test > 0: self.log('ports_tested: %s' % str(self.ports_tested)) self.log('ports_to_test: %s' % str(self.ports_to_test)) for port, ethMAC in self.ports_to_test.iteritems(): self.log('testing %s on port: %s' % (ethMAC, port)) start_time = time() start_time_str = strftime('%Y%m%d_%H%M%S', localtime(start_time)) log_file_name = ethMAC + '_' + start_time_str + '.log' log_file_path = join(logdir, log_file_name) args = [self.e10tester, port, ethMAC, log_file_path] self.log(list2cmdline(args) + '\n') process = Popen(args) logfile = None while process.poll() is None: if logfile: ch = logfile.read() if ch: lines = ch.splitlines(True) for line in lines: if len(line) > 0: sys.stderr.write(ethMAC + ' ' + line) sys.stderr.flush() else: sleep(1) elif isfile(log_file_path): sleep(1) logfile = open(log_file_path, 'rb') self.log('opened log file: %s\n' % logfile.name) else: sleep(1) # after the process finished, # print the remaining of the log file if logfile: ch = logfile.read() if ch: lines = ch.splitlines(True) for line in lines: if len(line) > 0: sys.stderr.write(ethMAC + ' ' + line) sys.stderr.flush() self.ports_tested[port] = ethMAC if number_of_port_to_test > 1: self.log('%d out of %d tests have been completed' % (len(self.ports_tested), number_of_port_to_test)) else: if process.returncode == 0: sound_and_confirm('%s on port %s has passed the test' % (ethMAC, port), sound_passed, repeat=True) else: sound_and_confirm('%s on port %s has failed the test' % (ethMAC, port), sound_failed, repeat=True) if number_of_port_to_test > 1: sound_and_confirm('Finished all the %d tests' % number_of_port_to_test, sound_finished, repeat=True) self.ports_to_test = {}