def test_eTP_008(self): logging.info('1、注入8号TP点,模拟控制任务剩余堆栈量为49' '//产生控制堆栈异常告警system_alarm为2,下位机状态显示堆栈剩余量为49') # 检查告警为bit1 tp_main_set(self.container,'8','1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '2': raise Exception('告警不正确') # 检查堆栈剩余量 result = chassis_state_echo(self.container) if result['stack_control'] != '49': raise Exception('堆栈剩余量不为49') logging.info('2、取消TP点' '//告警恢复system_alarm为0,且下位机状态堆栈剩余量不为49') # 检查告警恢复 tp_main_set(self.container,'8','0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复') # 检查堆栈剩余量 result = chassis_state_echo(self.container) if result['stack_control'] == '49': raise Exception('堆栈剩余量未恢复')
def test_eTP_007(self): logging.info('1、注入7号TP点,模拟传感器任务剩余堆栈量为49' '//产生传感器堆栈异常告警system_alarm为1,下位机状态显示堆栈剩余量为49') # 检查告警为bit0 tp_main_set(self.container, '7', '1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '1': raise Exception('告警不正确') # 检查堆栈剩余量 result = chassis_state_echo(self.container) if result['stack_sensor'] != '49': raise Exception('堆栈剩余量不为49') logging.info('2、取消TP点' '//告警恢复system_alarm为0,且下位机状态堆栈剩余量不为49') # 检查告警恢复 tp_main_set(self.container, '7', '0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复') # 检查堆栈剩余量 result = chassis_state_echo(self.container) if result['stack_sensor'] == '49': raise Exception('堆栈剩余量未恢复')
def test_eTP_055(self): logging.info( '1、注入imu温度高异常TP点' '//产生正确告警,internal_sensor_alarm为16,/chassis_state状态imu为16') tp_main_set(self.container, '55', '1') result = chassis_alarm_echo(self.container) if result['internal_sensor_alarm'] != '16': raise Exception('告警不正确') # 检查imu状态 result = chassis_state_echo(self.container) if result['imu'] != '16': raise Exception('下位机imu状态不正确') logging.info('2、取消TP点' '//告警恢复,internal_sensor_alarm为0,/chassis_state状态imu恢复为0') tp_main_set(self.container, '55', '0') result = chassis_alarm_echo(self.container) if result['internal_sensor_alarm'] != '0': raise Exception('告警未恢复') # 检查imu状态 result = chassis_state_echo(self.container) if result['imu'] != '0': raise Exception('下位机imu状态不正确')
def test_eTP_061(self): logging.info('1、注入系统SD卡未连接TP点' '//产生异常告警system_alarm为8192,/chassis_state状态flash为1') # 检查告警为bit13 tp_main_set(self.container, '61', '1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '8192': raise Exception('告警不正确') # 检查flash状态 result = chassis_state_echo(self.container) if result['flash'] != '1': raise Exception('下位机flash状态不正确') logging.info('2、取消TP点' '//告警恢复system_alarm为0,/chassis_state状态flash为0') # 检查告警恢复 tp_main_set(self.container, '61', '0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复') # 检查flash状态 result = chassis_state_echo(self.container) if result['flash'] != '0': raise Exception('下位机flash状态未恢复')
def test_eTP_002(self): logging.info('1、注入2号TP点,模拟CPU使用率90%' '//产生cpu异常告警system_alarm为16384,下位机状态显示cpu使用率90%') # 检查告警为bit14 tp_main_set(self.container, '2', '1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '16384': raise Exception('告警不正确') # 检查cpu使用率 result = chassis_state_echo(self.container) if result['cpu_usage'] != '90': raise Exception('CPU使用率不为90') logging.info('2、取消TP点' '//告警恢复system_alarm为0,且下位机状态cpu使用率不为90%') # 检查告警恢复 tp_main_set(self.container, '2', '0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复') # 检查cpu使用率 result = chassis_state_echo(self.container) if result['cpu_usage'] == '90': raise Exception('CPU使用率未恢复')
def test_eTP_010(self): logging.info('1、注入10号TP点,模拟状态机任务剩余堆栈量为49' '//产生状态机堆栈异常告警system_alarm为8,下位机状态显示堆栈剩余量为49') # 检查告警为bit3 tp_main_set(self.container,eTP_num='10',switch='1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '8': raise Exception('告警不正确') # 检查堆栈剩余量 result = chassis_state_echo(self.container) if '[49,' not in result['stack_rec']: raise Exception('堆栈剩余量不为49') logging.info('2、取消TP点' '//告警恢复system_alarm为0,且下位机状态堆栈剩余量不为49') # 检查告警恢复 tp_main_set(self.container,'10','0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复') # 检查堆栈剩余量 result = chassis_state_echo(self.container) if '[49,' in result['stack_rec']: raise Exception('堆栈剩余量未恢复')
def test_eTP_013(self): logging.info('1、注入10号TP点,模拟日志任务剩余堆栈量为49' '//产生日志堆栈异常告警system_alarm为8,下位机状态显示堆栈剩余量为49') # 检查告警为bit3 tp_main_set(self.container, eTP_num='11', switch='1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '16': raise Exception('告警不正确') # 检查堆栈剩余量 result = chassis_state_echo(self.container) stack_rec = result['stack_rec'] if re.match('\[\d+, (\d+)', stack_rec).group(1) != '49': raise Exception('堆栈剩余量不为49') logging.info('2、取消TP点' '//告警恢复system_alarm为0,且下位机状态堆栈剩余量不为49') # 检查告警恢复 tp_main_set(self.container, '11', '0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复') # 检查堆栈剩余量 result = chassis_state_echo(self.container) stack_rec = result['stack_rec'] if re.match('\[\d+, (\d+)', stack_rec).group(1) == '49': raise Exception('堆栈剩余量未恢复')
def test_eTP_064(self): logging.info('1、注入电源板温度高TP点' '//产生正确告警,power_alarm为8388608(bit23)') tp_main_set(self.container, '64', '1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '8388608': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复') tp_main_set(self.container, '64', '0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_053(self): logging.info('1、注入摇杆数据异常TP点' '//产生正确告警,external_sensor_alram为1') tp_main_set(self.container, '53', '1') result = chassis_alarm_echo(self.container) if result['external_sensor_alarm'] != '1': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复,external_sensor_alarm为0') tp_main_set(self.container, '53', '0') result = chassis_alarm_echo(self.container) if result['external_sensor_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_044(self): logging.info('1、注入左驱动器过压TP点' '//产生正确告警,motor_driver_alarm为131072') tp_main_set(self.container, '44', '1') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '131072': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复,motor_driver_alarm为0') tp_main_set(self.container, '44', '0') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_040(self): logging.info('1、注入右驱动器无刷传感器故障TP点' '//产生正确告警,motor_driver_alarm为8192') tp_main_set(self.container, '40', '1') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '8192': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复,motor_driver_alarm为0') tp_main_set(self.container, '40', '0') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_038(self): logging.info('1、注入右驱动器短路TP点' '//产生正确告警,motor_driver_alarm为2048') tp_main_set(self.container, '38', '1') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '2048': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复,motor_driver_alarm为0') tp_main_set(self.container, '38', '0') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_031(self): logging.info('1、注入摇杆供电过流TP点' '//产生正确告警,power_alarm为4194304') tp_main_set(self.container, '31', '1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '4194304': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复') tp_main_set(self.container, '31', '0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_026(self): logging.info('1、注入TX2电压异常TP点' '//产生正确告警,power_alarm为8192') tp_main_set(self.container, '26', '1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '8192': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复') tp_main_set(self.container, '26', '0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_065(self): logging.info('1、注入电源板温度超高TP点' '//产生正确告警,power_alarm为16777216(bit24)') tp_main_set(self.container, '65', '1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '16777216': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复') tp_main_set(self.container, '65', '0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_029(self): logging.info('1、注入PAD供电过流TP点' '//产生正确告警,power_alarm为1048576') tp_main_set(self.container, '29', '1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '1048576': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复') tp_main_set(self.container, '29', '0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_056(self): logging.info('1、注入电源板与主控通讯断开标识TP点' '//产生正确告警,power_alarm为16') tp_main_set(self.container, '56', '1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '32': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复,power_alarm为0') tp_main_set(self.container, '56', '0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_042(self): logging.info('1、注入右驱动器启动时加载默认配置故障TP点' '//产生正确告警,motor_driver_alarm为32768') tp_main_set(self.container, '42', '1') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '32768': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复,motor_driver_alarm为0') tp_main_set(self.container, '42', '0') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_049(self): logging.info('1、注入左驱动器MOSFET故障TP点' '//产生正确告警,motor_driver_alarm为4194304') tp_main_set(self.container, '49', '1') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '4194304': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复,motor_driver_alarm为0') tp_main_set(self.container, '49', '0') result = chassis_alarm_echo(self.container) if result['motor_driver_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_030(self): logging.info('1、注入外设供电过流(超声波/路由器/RTK)TP点' '//产生正确告警,power_alarm为2097152') tp_main_set(self.container, '30', '1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '2097152': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复') tp_main_set(self.container, '30', '0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_004(self): logging.info('1、注入4号TP点,模拟SD卡存储占满' '//产生cpu异常告警system_alarm为256') # 检查告警为bit8 tp_main_set(self.container, '4', '1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '256': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复system_alarm为256') # 检查告警恢复 tp_main_set(self.container, '4', '0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_059(self): logging.info('1、注入系统cpu温度高TP点' '//产生异常告警system_alarm为256') # 检查告警为bit17 tp_main_set(self.container, '59', '1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '131072': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复system_alarm为0') # 检查告警恢复 tp_main_set(self.container, '59', '0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_005(self): logging.info('1、注入超低温TP点' '//产生正确告警,bit8超低温') tp_main_set(self.container,'5','1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '256': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复') tp_main_set(self.container,'5','0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_062(self): logging.info('1、注入接收控制命令超时TP点' '//产生告警system_alarm为1048576') # 检查告警为bit20 tp_main_set(self.container, '62', '1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '1048576': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复system_alarm为0') # 检查告警恢复 tp_main_set(self.container, '62', '0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_060(self): logging.info('1、注入系统cpu温度超高TP点' '//产生异常告警system_alarm为262144') # 检查告警为bit18 tp_main_set(self.container, '60', '1') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '262144': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复system_alarm为0') # 检查告警恢复 tp_main_set(self.container, '60', '0') result = chassis_alarm_echo(self.container) if result['system_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_006(self): logging.info('1、注入超高温TP点' '//产生正确告警,power_alarm为bit9--512') tp_main_set(self.container,'6','1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '512': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复,power_alarm为0') tp_main_set(self.container,'6','0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_017(self): logpath = os.getcwd().replace( 'autotest', 'auto_result/log') + '/' + os.path.basename(__file__) logging.info('前置步骤:所有docker均已启动。roscore已运行') logging.info('1、注入低电量TP点' '//产生正确告警,bit0低电量') tp_main_set(self.container, '17', '1') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '1': raise Exception('告警不正确') logging.info('2、取消TP点' '//告警恢复') tp_main_set(self.container, '17', '0') result = chassis_alarm_echo(self.container) if result['power_alarm'] != '0': raise Exception('告警未恢复')
def test_eTP_054(self): logging.info( '1、注入右驱动器通讯异常TP点' '//产生校验错误告警和通讯异常,external_sensor_alram为262146 (bit18+bit1)') tp_main_set(self.container, '54', '1') result = chassis_alarm_echo(self.container) if result['external_sensor_alarm'] != '262146': raise Exception('告警不正确') # 检查imu状态 result = chassis_state_echo(self.container) if result['joystick'] != '2': raise Exception('下位机joystick状态不正确') logging.info('2、取消TP点' '//告警恢复,external_sensor_alarm为0') tp_main_set(self.container, '54', '0') result = chassis_alarm_echo(self.container) if result['external_sensor_alarm'] != '0': raise Exception('告警未恢复') # 检查imu状态 result = chassis_state_echo(self.container) if result['joystick'] != '0': raise Exception('下位机joystick状态不正确')
def teardown_method(self): logging.info('---------after-----------') tp_main_set(self.container, '53', '0')