def test_complete_auto_tests(self): """ Test a regular autotest """ # call with channel/flash/no_gps and blinking leds extra = query_string('channel=22&flash=1&gps=') ret = self.server.put('/autotest/blink', extra_environ=extra) ret_dict = ret.json print >> sys.stderr, ret_dict self.assertEquals([], ret_dict['error']) self.assertIn('on_serial_echo', ret_dict['success']) self.assertTrue('GWT' in ret_dict['mac']) self.assertEquals(0, ret_dict['ret']) # test that ON still on if self.board_cfg.board_type == 'a8': # Don't know ip address, just check TTY self.assertTrue(os.path.exists(self.board_cfg.board_class.TTY)) else: self.g_m.open_node.serial_redirection.start() ret = OpenNodeConnection.send_one_command(['get_time']) self.g_m.open_node.serial_redirection.stop() self.assertIsNotNone(ret) not_tested = (set(self.g_m.open_node.AUTOTEST_AVAILABLE) - set(AutoTestManager.TESTED_FEATURES)) self.assertEquals(not_tested, set())
def test_complete_auto_tests(self): """ Test a regular autotest """ # call with channel/flash/no_gps and blinking leds extra = query_string('channel=22&flash=1&gps=') ret = self.server.put('/autotest/blink', extra_environ=extra) ret_dict = ret.json print >> sys.stderr, ret_dict self.assertEqual([], ret_dict['error']) self.assertIn('on_serial_echo', ret_dict['success']) self.assertTrue('GWT' in ret_dict['mac']) self.assertEqual(0, ret_dict['ret']) # test that ON still on if self.board_cfg.board_type == 'a8': # Don't know ip address, just check TTY self.assertTrue(os.path.exists(self.board_cfg.board_class.TTY)) else: self.g_m.open_node.serial_redirection.start() ret = OpenNodeConnection.send_one_command(['get_time']) self.g_m.open_node.serial_redirection.stop() self.assertIsNotNone(ret) if self.board_cfg.linux_on_class is not None: autotest = self.board_cfg.linux_on_class.AUTOTEST_AVAILABLE not_tested = (set(autotest) - set(AutoTestManager.TESTED_FEATURES)) else: not_tested = (set(self.g_m.open_node.AUTOTEST_AVAILABLE) - set(AutoTestManager.TESTED_FEATURES)) self.assertEqual(not_tested, set())
def send_n_cmds(command, num_times, step=0.5): """ Send a command multiple times and return array of answers """ answers = [] cmd = command.split() for _itr in range(0, num_times): # pylint:disable=unused-variable ans = OpenNodeConnection.send_one_command(cmd) ans = ' '.join(ans) if ans is not None else None answers.append(ans) time.sleep(step) return answers