def __init__(self, config, target, paths): super(Q7Worker, self).__init__() logging.info('Running %s on %s (Q7)', config['FirmwareQ7'], target['AioNodeQ7'], extra=config) # Program Q7-side test application. application = os.path.join(paths['q7_bin'], config['FirmwareQ7']) aio_node = aio.aio_node_helper.Value(target['AioNodeQ7']) ip_address = aio.AioNodeToIpAddressString(aio_node) q7_address = 'root@' + ip_address self.jobs.append( CommandWorker(log_extra=config, command='scp', args=[application, q7_address + ':~'], timeout=30)) # Run Q7-side test application. q7_cmdline = '~/' + os.path.basename(application) self.jobs.append( CommandWorker(log_extra=config, command='ssh', args=[q7_address, '\'' + q7_cmdline + '\''], timeout=config['Timeout']))
def testBatt(self): parsed_args = self.RunParse('--target batt_a batt_application.elf') args = parsed_args['args'] self.assertEqual(parsed_args['file'], 'batt_application.elf') self.assertEqual(args.force_hardware, None) self.assertEqual(parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeBattA)) self.assertEqual(parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeBattA)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kBattA) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Application') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testCoreSwitchGroundStation(self): parsed_args = self.RunParse('--target cs_gs_a cs_application.elf') args = parsed_args['args'] self.assertEqual(args.target, 'cs_gs_a') self.assertEqual(parsed_args['file'], 'cs_application.elf') self.assertEqual(args.force_hardware, None) self.assertEqual(parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeCsGsA)) self.assertEqual(parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeCsGsA)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kCoreSwitchGsA) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Application') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testFcCalibParamsSuccess(self): parsed_args = self.RunParse( '--target fc_c rev_a3_fc_calib_params.bin --calib') args = parsed_args['args'] self.assertEqual(args.target, 'fc_c') self.assertEqual(parsed_args['file'], 'rev_a3_fc_calib_params.bin') self.assertEqual(parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeFcC)) self.assertEqual(parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeFcC)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kFlightComputerC) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'CalibParams') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testFlightComputer(self): parsed_args = self.RunParse('--target fc_b fc_application.elf') args = parsed_args['args'] self.assertEqual(args.target, 'fc_b') self.assertEqual(parsed_args['file'], 'fc_application.elf') self.assertEqual(args.force_hardware, None) self.assertEqual(parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeFcB)) self.assertEqual(parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeFcB)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kControllerB) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Application') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testBootloaderForceHardwareFc(self): parsed_args = self.RunParse( '--target cs_a --bootloader --force_hardware=fc cs_bootloader.elf') args = parsed_args['args'] self.assertEqual(args.target, 'cs_a') self.assertEqual(parsed_args['file'], 'cs_bootloader.elf') self.assertEqual(args.force_hardware, 'fc') self.assertEqual(parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeCsA)) self.assertEqual(parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeCsA)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kCoreSwitchA) self.assertEqual(parsed_args['new_node_index'], aio_labels.kCoreSwitchA) self.assertEqual(parsed_args['update_type'], 'Bootloader') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testIgnoreMismatch(self): parsed_args = self.RunParse( '--target motor_sbo --ignore_mismatch motor_application.elf') args = parsed_args['args'] self.assertEqual(args.target, 'motor_sbo') self.assertEqual(parsed_args['file'], 'motor_application.elf') self.assertEqual( parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeMotorSbo)) self.assertEqual( parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeMotorSbo)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kMotorSbo) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Application') self.assertFalse(args.dump_image) self.assertTrue(args.ignore_mismatch)
def testBootloaderSuccess(self): parsed_args = self.RunParse( '--target motor_sbo --bootloader bootloader.elf') args = parsed_args['args'] self.assertEqual(args.target, 'motor_sbo') self.assertEqual(parsed_args['file'], 'bootloader.elf') self.assertEqual( parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeMotorSbo)) self.assertEqual( parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeMotorSbo)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kMotorSbo) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Bootloader') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testDump(self): parsed_args = self.RunParse( '--target servo_e2 --dump_image servo_application.elf') args = parsed_args['args'] self.assertEqual(args.target, 'servo_e2') self.assertEqual(parsed_args['file'], 'servo_application.elf') self.assertEqual(args.force_hardware, None) self.assertEqual( parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeServoE2)) self.assertEqual( parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeServoE2)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kServoE2) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Application') self.assertTrue(args.dump_image)
def testDrum(self): parsed_args = self.RunParse( '--target drum_sensors_a drum_application.elf') args = parsed_args['args'] self.assertEqual(args.target, 'drum_sensors_a') self.assertEqual(parsed_args['file'], 'drum_application.elf') self.assertEqual(args.force_hardware, None) self.assertEqual( parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeDrumSensorsA)) self.assertEqual( parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeDrumSensorsA)) self.assertEqual(parsed_args['cur_node_index'], 0) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Application') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testBootloaderOverrideTarget(self): parsed_args = self.RunParse( '--target fc_a --bootloader --override_target gps_base_station' ' bootloader.elf') args = parsed_args['args'] self.assertEqual(args.target, 'fc_a') self.assertEqual(parsed_args['file'], 'bootloader.elf') self.assertEqual(parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeFcA)) self.assertEqual( parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeGpsBaseStation)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kFlightComputerA) self.assertEqual(parsed_args['new_node_index'], aio_labels.kGpsBaseStation) self.assertEqual(parsed_args['update_type'], 'Bootloader') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testGps(self): parsed_args = self.RunParse( '--target gps_base_station gps_application.elf') args = parsed_args['args'] self.assertEqual(args.target, 'gps_base_station') self.assertEqual(parsed_args['file'], 'gps_application.elf') self.assertEqual(args.force_hardware, None) self.assertEqual( parsed_args['cur_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeGpsBaseStation)) self.assertEqual( parsed_args['new_ip'], aio.AioNodeToIpAddressString(aio_node.kAioNodeGpsBaseStation)) self.assertEqual(parsed_args['cur_node_index'], 0) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Application') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)
def testRecorderTms570(self): parsed_args = self.RunParse( '--target recorder_tms570_platform recorder_application.elf') args = parsed_args['args'] self.assertEqual(args.target, 'recorder_tms570_platform') self.assertEqual(parsed_args['file'], 'recorder_application.elf') self.assertEqual(args.force_hardware, None) self.assertEqual( parsed_args['cur_ip'], aio.AioNodeToIpAddressString( aio_node.kAioNodeRecorderTms570Platform)) self.assertEqual( parsed_args['new_ip'], aio.AioNodeToIpAddressString( aio_node.kAioNodeRecorderTms570Platform)) self.assertEqual(parsed_args['cur_node_index'], aio_labels.kRecorderTms570Platform) self.assertEqual(parsed_args['new_node_index'], parsed_args['cur_node_index']) self.assertEqual(parsed_args['update_type'], 'Application') self.assertFalse(args.dump_image) self.assertFalse(args.ignore_mismatch)