def generate_test_groups(self, arguments, log=None): timeout = 10 spi_i2c_test_device = self.get_devices_list()[0] setup = [ Step(Action.EXECUTE, spi_i2c_test_device, ('dut_reboot_mon', dut_reboot_monitor), Test.add_monitor), ] teardown = [ Step(Action.EXECUTE, spi_i2c_test_device, 'dut_reboot_mon', Test.remove_monitor), ] Arduino_Example_test_i2c_by_lower_case_letter = Test( name='Arduino_Example_test_i2c_by_lower_case_letter', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'abcdefghijklmnopqrstuvwxyz'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'abcdefghijklmnopqrstuvwxyz'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'uvwxyz'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'uvwxyz'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'abcdef'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'abcdef'), ], teardown=teardown) Arduino_Example_test_i2c_by_upper_case_letter = Test( name='Arduino_Example_test_i2c_by_upper_case_letter', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'ABCDEF'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'ABCDEF'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'UVWXYZ'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'UVWXYZ'), ], teardown=teardown) Arduino_Example_test_i2c_by_alphabet = Test( name='Arduino_Example_test_i2c_by_alphabet', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'LJLJLJLJLADFASdafdf'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'LJLJLJLJLADFASdafdf'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'abcABC'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'abcABC'), ], teardown=teardown) Arduino_Example_test_i2c_by_number = Test( name='Arduino_Example_test_i2c_by_number', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + '0123456789'), Step(Action.WAIT_FOR, spi_i2c_test_device, '0123456789'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + '9876543210'), Step(Action.WAIT_FOR, spi_i2c_test_device, '9876543210'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + '12379274923479172934792374'), Step(Action.WAIT_FOR, spi_i2c_test_device, '12379274923479172934792374'), ], teardown=teardown) Arduino_Example_test_i2c_by_punctuation = Test( name='Arduino_Example_test_i2c_by_punctuation', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + '|,./;:[]{}~!@#$%^&*()_+=-~'), Step(Action.WAIT_FOR, spi_i2c_test_device, '|,./;:[]{}~!@#$%^&*()_+=-~'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + '\"\',./'), Step(Action.WAIT_FOR, spi_i2c_test_device, '\"\',./'), ], teardown=teardown) Arduino_Example_test_i2c_by_mix_mode = Test( name='Arduino_Example_test_i2c_by_mix_mode', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + '56789%@@$^&*Pjj(9}z?!~`89.,./\\'), Step(Action.WAIT_FOR, spi_i2c_test_device, '56789%@@$^&*Pjj(9}z?!~`89.,./\\'), ], teardown=teardown) Arduino_Example_test_i2c_mode_by_comand = Test( name='Arduino_Example_test_i2c_mode_by_comand', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'err'), Step(Action.WAIT_FOR, spi_i2c_test_device, '#'), Step(Action.WRITE, spi_i2c_test_device, 'i2c'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'I2C#'), ], teardown=teardown) Arduino_Example_test_spi_by_lower_case_letter = Test( name='Arduino_Example_test_spi_by_lower_case_letter', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'abcdefghijklmnopqrstuvwxyz'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'abcdefghijklmnopqrstuvwxyz'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'uvwxyz'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'uvwxyz'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'abcdef'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'abcdef'), ], teardown=teardown) Arduino_Example_test_spi_by_upper_case_letter = Test( name='Arduino_Example_test_spi_by_upper_case_letter', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'ABCDEF'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'ABCDEF'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'UVWXYZ'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'UVWXYZ'), ], teardown=teardown) Arduino_Example_test_spi_by_alphabet = Test( name='Arduino_Example_test_spi_by_alphabet', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'LJLJLJLJLADFASdafdf'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'LJLJLJLJLADFASdafdf'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + 'abcABC'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'abcABC'), ], teardown=teardown) Arduino_Example_test_spi_by_number = Test( name='Arduino_Example_test_spi_by_number', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + '0123456789'), Step(Action.WAIT_FOR, spi_i2c_test_device, '0123456789'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + '9876543210'), Step(Action.WAIT_FOR, spi_i2c_test_device, '9876543210'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + '12379274923479172934792374'), Step(Action.WAIT_FOR, spi_i2c_test_device, '12379274923479172934792374'), ], teardown=teardown) Arduino_Example_test_spi_by_punctuation = Test( name='Arduino_Example_test_spi_by_punctuation', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + '|,./;:[]{}~!@#$%^&*()_+=-~'), Step(Action.WAIT_FOR, spi_i2c_test_device, '|,./;:[]{}~!@#$%^&*()_+=-~'), Step(Action.WRITE, spi_i2c_test_device, 'send ' + '\"\',./'), Step(Action.WAIT_FOR, spi_i2c_test_device, '\"\',./'), ], teardown=teardown) Arduino_Example_test_spi_by_mix_mode = Test( name='Arduino_Example_test_spi_by_mix_mode', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'send ' + '56789%@@$^&*Pjj(9}z?!~`89.,./\\'), Step(Action.WAIT_FOR, spi_i2c_test_device, '56789%@@$^&*Pjj(9}z?!~`89.,./\\'), ], teardown=teardown) Arduino_Example_test_spi_mode_by_comand = Test( name='Arduino_Example_test_spi_mode_by_comand', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, spi_i2c_test_device, 'err'), Step(Action.WAIT_FOR, spi_i2c_test_device, '#'), Step(Action.WRITE, spi_i2c_test_device, 'spi'), Step(Action.WAIT_FOR, spi_i2c_test_device, 'SPI#'), ], teardown=teardown) i2c_mode = TestGroup(name='i2c_mode', devices=[spi_i2c_test_device], tag=[Tag.POSITIVE], tests=[ Arduino_Example_test_i2c_mode_by_comand, Arduino_Example_test_i2c_by_lower_case_letter, Arduino_Example_test_i2c_by_upper_case_letter, Arduino_Example_test_i2c_by_alphabet, Arduino_Example_test_i2c_by_number, Arduino_Example_test_i2c_by_punctuation, Arduino_Example_test_i2c_by_mix_mode, ]) spi_mode = TestGroup(name='spi_mode', devices=[spi_i2c_test_device], tag=[Tag.POSITIVE], tests=[ Arduino_Example_test_spi_mode_by_comand, Arduino_Example_test_spi_by_lower_case_letter, Arduino_Example_test_spi_by_upper_case_letter, Arduino_Example_test_spi_by_alphabet, Arduino_Example_test_spi_by_number, Arduino_Example_test_spi_by_punctuation, Arduino_Example_test_spi_by_mix_mode, ]) test_groups = [ i2c_mode, spi_mode, ] return test_groups
def usb_e(device): r = [ Step(Action.EXECUTE, device, None, lambda test, source, data: mountEnd(test, source, data)), ] return r
def usb_e(device): r = [ Step(Action.WRITE, device, 'msdis'), Step(Action.WAIT_FOR, device, 'Disconnected'), ] return r
def generate_test_groups(self, arguments, log=None): timeout = 600 gnss16567_test_device = self.get_devices_list()[0] setup = [ Step( Action.EXECUTE, gnss16567_test_device, None, lambda test, source, data: call_shell( test, source, data, "./labsat_end.sh")), Step( Action.EXECUTE, gnss16567_test_device, None, lambda test, source, data: call_shell( test, source, data, "./labsat_start.sh")), ] teardown = [ Step( Action.EXECUTE, gnss16567_test_device, None, lambda test, source, data: call_shell( test, source, data, "./labsat_end.sh")), Step(Action.EXECUTE, gnss16567_test_device, 'dut_gnss_mon', Test.remove_monitor), ] SDK_Gnss_16567 = Test(name='SDK_Gnss_16567', timeout=timeout, setup=setup, test=[ Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : begin in'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : begin out'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : start in'), Step(Action.WAIT_FOR, gnss16567_test_device, 'mode = COLD_START'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : start out'), Step(Action.WAIT_FOR, gnss16567_test_device, 'Gnss setup OK'), Step(Action.EXECUTE, gnss16567_test_device, ('dut_gnss_mon', dut_gnss_monitor), Test.add_monitor), Step(Action.WAIT_FOR, gnss16567_test_device, "gnss type test OK"), Step(Action.WAIT_FOR, gnss16567_test_device, "gnss test OK"), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : stop in'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : stop out'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : end in'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : end out'), Step(Action.WAIT_FOR, gnss16567_test_device, 'Gnss stop OK.'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : begin in'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : begin out'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : start in'), Step(Action.WAIT_FOR, gnss16567_test_device, 'mode = WARM_START'), Step(Action.WAIT_FOR, gnss16567_test_device, 'SpGnss : start out'), Step(Action.WAIT_FOR, gnss16567_test_device, 'Gnss restart OK'), Step( Action.EXECUTE, gnss16567_test_device, None, lambda test, source, data: reset_count( test, source, data)), Step(Action.WAIT_FOR, gnss16567_test_device, "gnss type test OK"), Step(Action.WAIT_FOR, gnss16567_test_device, "gnss test OK"), ], teardown=teardown) gnss = TestGroup(name='gnss', devices=[gnss16567_test_device], tag=[Tag.POSITIVE], tests=[ SDK_Gnss_16567, ]) test_groups = [ gnss, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 300 player_device, recorder_device = self.get_devices_list() def usb_s(device): r = [ Step( Action.EXECUTE, device, None, lambda test, source, data: wait_sec( test, source, data, 5, 'wait sd')), Step( Action.EXECUTE, device, None, lambda test, source, data: mountStart(test, source, data)), ] return r def usb_e(device): r = [ Step(Action.EXECUTE, device, None, lambda test, source, data: mountEnd(test, source, data)), ] return r def dsp_steps(device): r = [ Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp0, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp1, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp2, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp3, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), ] return r def add_file_to_player(): r = [] for file in AUDIO_FILES: r += [ Step(Action.EXECUTE, player_device, None, lambda test, source, data, filename=file: cp_file( test, source, data, os.path.join(os.getcwd(), 'input/' + filename + '.mp3'), '')), Step(Action.WAIT_FOR, player_device, 'copied'), ] return r setup = [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] teardown = [] tc_16340_15432 = Test( name='tc_16340_15432', timeout=timeout, setup=setup, test=usb_s(recorder_device) + \ dsp_steps(recorder_device) + \ usb_e(recorder_device) + \ usb_s(player_device) + \ dsp_steps(player_device) + \ add_file_to_player() + \ usb_e(player_device) + [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WRITE, player_device, '16340_15432'), #Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), Step(Action.WRITE, recorder_device, '15947'), Step(Action.WAIT_FOR, recorder_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, recorder_device, 'Init Recorder!'), Step(Action.WAIT_FOR, recorder_device, 'Write Header!'), Step(Action.WAIT_FOR, recorder_device, 'Recording Start!'), Step(Action.WAIT_FOR, recorder_device, 'End Recording'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] + usb_s(recorder_device) + [ Step(Action.EXECUTE, recorder_device, None, lambda test, source, data: mv_file(test, source, data, '15947.wav', os.getcwd() + '/output', '16340_15432.wav')), Step(Action.WAIT_FOR, recorder_device, 'moved'), Step(Action.WRITE, recorder_device, 'end'), Step(Action.WAIT_FOR, recorder_device, 'Finish USB Mass Storage Operation', lambda test, source, data: verify_recorded_file(test, source, data, '16340_15432.wav')), Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success'), ], teardown=teardown ) tests = [] for i in range(1, len(AUDIO_FILES)): tests.append( Test( name='tc_' + AUDIO_FILES[i], timeout=timeout, setup=setup, test=[ #Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WRITE, player_device, AUDIO_FILES[i]), #Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), Step(Action.WRITE, recorder_device, '15947'), Step(Action.WAIT_FOR, recorder_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, recorder_device, 'Init Recorder!'), Step(Action.WAIT_FOR, recorder_device, 'Write Header!'), Step(Action.WAIT_FOR, recorder_device, 'Recording Start!'), Step(Action.WAIT_FOR, recorder_device, 'End Recording'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] + usb_s(recorder_device) + [ Step(Action.EXECUTE, recorder_device, None, lambda test, source, data, index=i: mv_file( test, source, data, '15947.wav', os.getcwd() + '/output', AUDIO_FILES[index] + '.wav')), Step(Action.WAIT_FOR, recorder_device, 'moved'), Step(Action.WRITE, recorder_device, 'end'), Step( Action.WAIT_FOR, recorder_device, 'Finish USB Mass Storage Operation', lambda test, source, data, index=i: verify_recorded_file(test, source, data, AUDIO_FILES[index] + '.wav')), Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success'), ], teardown=teardown)) test_group = TestGroup(name='test_group', devices=[player_device, recorder_device], tag=[Tag.POSITIVE], tests=[ tc_16340_15432, ] + tests) test_groups = [ test_group, ] return test_groups
def remove_recorded_files_steps(device): return [ Step(Action.EXECUTE, device, None, remove_recorded_file), ]
def generate_test_groups(self, arguments, log=None): timeout = 300 player16362_test_device = self.get_devices_list()[0] def usb_s(device): r = [ Step( Action.EXECUTE, device, None, lambda test, source, data: reset_data(test, source, data)), Step( Action.EXECUTE, device, None, lambda test, source, data: wait_sec( test, source, data, 5, 'wait sd')), Step( Action.EXECUTE, device, None, lambda test, source, data: checkDefaultDisk( test, source, data)), Step(Action.WRITE, device, 'usbmsc', None, '\r'), Step( Action.WAIT_FOR, device, 'Begin USB Mass Storage Operation', lambda test, source, data: wait_sec( test, source, data, 25, 'usb mount to PC')), Step( Action.EXECUTE, device, None, lambda test, source, data: checkNewDisk( test, source, data)), ] return r def usb_e(device): r = [ Step(Action.WRITE, device, 'end', None, '\r'), Step(Action.WAIT_FOR, device, 'Finish USB Mass Storage Operation'), ] return r def dsp_steps(device): r = [ Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp0, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp1, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp2, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp3, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), ] return r def add_file_to_player(): r = [] for file in AUDIO_FILES: r = [ Step(Action.EXECUTE, player16362_test_device, None, lambda test, source, data, filename=file: cp_file( test, source, data, os.path.join(os.getcwd(), 'input/' + filename + '.mp3'), '')), Step(Action.WAIT_FOR, player16362_test_device, 'copied'), ] return r setup = [ Step(Action.WAIT_FOR, player16362_test_device, 'Please input cmd'), ] teardown = [] arduino_lowpower_16362_player = Test( name='arduino_lowpower_16362_player', timeout=timeout, setup=setup, test=usb_s(player16362_test_device) + \ dsp_steps(player16362_test_device) + \ add_file_to_player() + \ usb_e(player16362_test_device) + [ Step(Action.WAIT_FOR, player16362_test_device, 'Please input cmd'), Step(Action.WRITE, player16362_test_device, '16362', None, '\r'), Step(Action.WAIT_FOR, player16362_test_device, 'Boot Cause: (0) Power On Reset with Power Supplied'), Step(Action.WAIT_FOR, player16362_test_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, player16362_test_device, 'Open!'), Step(Action.WAIT_FOR, player16362_test_device, 'Play!'), Step(Action.WAIT_FOR, player16362_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, player16362_test_device, 'Please input cmd'), Step(Action.WRITE, player16362_test_device, '16362', None, '\r'), Step(Action.WAIT_FOR, player16362_test_device, 'Please input cmd'), Step(Action.WRITE, player16362_test_device, '16362', None, '\r'), Step(Action.WAIT_FOR, player16362_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, player16362_test_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, player16362_test_device, 'Open!'), Step(Action.WAIT_FOR, player16362_test_device, 'Play!'), Step(Action.WAIT_FOR, player16362_test_device, 'test end'), ], teardown=teardown ) lowpower_16362 = TestGroup(name='lowpower_16362', devices=[player16362_test_device], tag=[Tag.POSITIVE], tests=[ arduino_lowpower_16362_player, ]) test_groups = [ lowpower_16362, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 10 mp3_test_device = self.get_devices_list()[0] setup = [] teardown = [] ARD_Example_test_16300_MP3ENC_sd0 = Test( name='ARD_Example_test_16300_MP3ENC_sd0', timeout=timeout, setup=setup, test=[ Step(Action.WAIT_FOR, mp3_test_device, 'Select where to install MP3ENC'), Step(Action.WAIT_FOR, mp3_test_device, '[1]: SD Card (Insert SD Card on the extension board)'), Step(Action.WAIT_FOR, mp3_test_device, '[2]: SPI-Flash'), Step(Action.WAIT_FOR, mp3_test_device, 'Please input number. [1-2]'), Step(Action.WRITE, mp3_test_device, '1'), Step(Action.WAIT_FOR, mp3_test_device, '1 -> SD Card'), Step(Action.WAIT_FOR, mp3_test_device, 'Install: /mnt/sd0/BIN/MP3ENC Done.'), Step(Action.WAIT_FOR, mp3_test_device, 'Finished.'), ], teardown=teardown) ARD_Example_test_16300_MP3ENC_spif = Test( name='ARD_Example_test_16300_MP3ENC_spif', timeout=timeout, setup=setup, test=[ Step(Action.WAIT_FOR, mp3_test_device, 'Select where to install MP3ENC'), Step(Action.WAIT_FOR, mp3_test_device, '[1]: SD Card (Insert SD Card on the extension board)'), Step(Action.WAIT_FOR, mp3_test_device, '[2]: SPI-Flash'), Step(Action.WAIT_FOR, mp3_test_device, 'Please input number. [1-2]'), Step(Action.WRITE, mp3_test_device, '2'), Step(Action.WAIT_FOR, mp3_test_device, '2 -> SPI-Flash'), Step(Action.WAIT_FOR, mp3_test_device, 'Install: /mnt/spif/BIN/MP3ENC'), Step(Action.WAIT_FOR, mp3_test_device, 'Finished.'), ], teardown=teardown) testGroup = TestGroup(name='testGroup', devices=[mp3_test_device], tag=[Tag.POSITIVE], tests=[ ARD_Example_test_16300_MP3ENC_sd0, ARD_Example_test_16300_MP3ENC_spif, ]) test_groups = [ testGroup, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 60 spresense_test_device = self.get_devices_list()[0] setup = [] teardown = [] ARD_MP_Example_test_16768 = Test( name='ARD_MP_Example_test_16768', timeout=timeout, setup=setup, test=[ Step(Action.WAIT_FOR, spresense_test_device, '[Main] Start Main core!'), Step(Action.WAIT_FOR, spresense_test_device, '[Main] Begin subcore1=0'), Step(Action.WAIT_FOR, spresense_test_device, '[Main] Begin subcore2=0'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 1'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 1'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 2'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 2'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 3'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 3'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 4'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 4'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 5'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 6'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 7'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 7'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 8'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 8'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 9'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 9'), Step(Action.WAIT_FOR, spresense_test_device, 'low_cnt = 10'), Step(Action.WAIT_FOR, spresense_test_device, 'high_cnt = 10'), ], teardown=teardown) Spresense = TestGroup(name='Spresense', devices=[spresense_test_device], tag=[Tag.POSITIVE], tests=[ ARD_MP_Example_test_16768, ]) test_groups = [ Spresense, ] return test_groups
def analysys_15774_steps(device): return [ Step(Action.EXECUTE, device, None, lambda test, source, data: analysys_15774(test, source, data)), Step(Action.WAIT_FOR, device, 'analysys_15774 ok!'), ]
def generate_test_groups(self, arguments, log=None): timeout = 300 analogread15777_test_device = self.get_devices_list()[0] setup = [] teardown = [ Step( Action.EXECUTE, analogread15777_test_device, None, lambda test, source, data: call_shell( test, source, data, "./kikusui_0V.sh")), ] ADN_Analog_io_15777 = Test( name='ADN_Analog_io_15777', timeout=timeout, setup=setup, test=[ Step( Action.EXECUTE, analogread15777_test_device, None, lambda test, source, data: call_shell( test, source, data, "./kikusui_0V.sh")), Step(Action.WAIT_FOR, analogread15777_test_device, 'wait sec completed'), Step(Action.EXECUTE, analogread15777_test_device, ('dut_analogread_monitor0', dut_analogread_monitor_0V), Test.add_monitor), Step(Action.WAIT_FOR, analogread15777_test_device, 'Test Done'), Step(Action.EXECUTE, analogread15777_test_device, 'dut_analogread_monitor0', Test.remove_monitor), Step( Action.EXECUTE, analogread15777_test_device, None, lambda test, source, data: call_shell( test, source, data, "./kikusui_2.5V.sh")), Step(Action.WAIT_FOR, analogread15777_test_device, 'wait sec completed'), Step( Action.EXECUTE, analogread15777_test_device, ('dut_analogread_monitor2p5', dut_analogread_monitor_2p5V), Test.add_monitor), Step(Action.WAIT_FOR, analogread15777_test_device, 'Test Done'), Step(Action.EXECUTE, analogread15777_test_device, 'dut_analogread_monitor2p5', Test.remove_monitor), Step( Action.EXECUTE, analogread15777_test_device, None, lambda test, source, data: call_shell( test, source, data, "./kikusui_5V.sh")), Step(Action.WAIT_FOR, analogread15777_test_device, 'wait sec completed'), Step(Action.EXECUTE, analogread15777_test_device, ('dut_analogread_monitor5', dut_analogread_monitor_5V), Test.add_monitor), Step(Action.WAIT_FOR, analogread15777_test_device, 'Test Done'), Step(Action.EXECUTE, analogread15777_test_device, 'dut_analogread_monitor5', Test.remove_monitor), ], teardown=teardown) analogread = TestGroup(name='analogread', devices=[analogread15777_test_device], tag=[Tag.POSITIVE], tests=[ ADN_Analog_io_15777, ]) test_groups = [ analogread, ] return test_groups
def analysys_15773_steps(device, write_value): return [ Step(Action.EXECUTE, device, None, lambda test, source, data: analysys_15773(test, source, data, write_value)), Step(Action.WAIT_FOR, device, 'analysys_15773 {} ok!'.format(write_value)), ]
def wait_sec_steps(device, sec, description=None): return [ Step(Action.EXECUTE, device, None, lambda test, source, data: wait_sec(test, source, data, sec, description)), Step(Action.WAIT_FOR, device, 'wait sec completed'), ]
def generate_test_groups(self, arguments, log=None): timeout = 60 * 60 gnss15588_test_device = self.get_devices_list()[0] setup = [ Step(Action.WAIT_FOR, gnss15588_test_device, gnss15588_test_device.NSH_PROMPT), Step(Action.WRITE, gnss15588_test_device, 'reboot'), Step(Action.WAIT_FOR, gnss15588_test_device, gnss15588_test_device.NUTTSHELL), Step(Action.EXECUTE, gnss15588_test_device, ('dut_reboot_mon', dut_reboot_monitor), Test.add_monitor), Step(Action.EXECUTE, gnss15588_test_device, ('dut_gnss_mon', dut_gnss_monitor), Test.add_monitor), Step( Action.EXECUTE, gnss15588_test_device, None, lambda test, source, data: call_shell( test, source, data, "./labsat_start.sh")), ] teardown = [ Step(Action.EXECUTE, gnss15588_test_device, 'dut_reboot_mon', Test.remove_monitor), Step( Action.EXECUTE, gnss15588_test_device, None, lambda test, source, data: call_shell( test, source, data, "./labsat_end.sh")), ] SDK_Gnss_15588 = Test(name='SDK_Gnss_15588', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, gnss15588_test_device, 'gnss_test utility getephameris 60'), Step(Action.WAIT_FOR, gnss15588_test_device, gnss15588_test_device.GNSSOK), Step(Action.WRITE, gnss15588_test_device, 'gnss_test hotrepeat'), Step(Action.WAIT_FOR, gnss15588_test_device, gnss15588_test_device.GNSSOK) ], teardown=teardown) gnss = TestGroup(name='gnss', devices=[gnss15588_test_device], tag=[Tag.POSITIVE], tests=[ SDK_Gnss_15588, ]) test_groups = [ gnss, ] return test_groups
def verify_pin(device): step = [] if 'lte' == device.ext_type: PINS = LTE_PINS else: PINS = EXT_PINS step += [ Step(Action.WAIT_FOR, device, 'Please Input Test PIN Count:'), Step(Action.WRITE, device, str(len(PINS)), None, '\r'), ] for i_pin in range(len(PINS)): if 0 == i_pin % 2: o_pin = i_pin + 1 else: o_pin = i_pin - 1 step += [ Step(Action.WAIT_FOR, device, 'Please Input Test PIN ID:'), Step(Action.WRITE, device, str(PINS[i_pin]), None, '\r'), Step(Action.WAIT_FOR, device, 'Please Input Out PIN ID:'), Step(Action.WRITE, device, str(PINS[o_pin]), None, '\r'), Step( Action.WAIT_FOR, device, '------Start Test pin[' + str(PINS[i_pin]) + '] Mode LOW------'), Step(Action.WAIT_FOR, device, 'to LOW'), Step( Action.WAIT_FOR, device, 'Interrupt occur! Pin[' + str(PINS[i_pin]) + '], count 1'), Step( Action.WAIT_FOR, device, 'Interrupt occur! Pin[' + str(PINS[i_pin]) + '], count 2'), Step( Action.WAIT_FOR, device, 'Interrupt occur! Pin[' + str(PINS[i_pin]) + '], count 3'), Step( Action.WAIT_FOR, device, 'Interrupt occur! Pin[' + str(PINS[i_pin]) + '], count 4'), Step( Action.WAIT_FOR, device, 'Interrupt occur! Pin[' + str(PINS[i_pin]) + '], count 5'), Step( Action.WAIT_FOR, device, 'Interrupt occur! Pin[' + str(PINS[i_pin]) + '], count 6'), Step(Action.WAIT_FOR, device, 'to HIGH'), Step(Action.WAIT_FOR, device, 'to LOW'), Step(Action.WAIT_FOR, device, 'to HIGH'), Step(Action.WAIT_FOR, device, 'Test pin[' + str(PINS[i_pin]) + '] = OK'), ] step += [ Step(Action.WAIT_FOR, device, 'Test Done'), ] return step
def generate_test_groups(self, arguments, log=None): timeout = 150 lowpower16353_test_device, mySerial2_test_device = self.get_devices_list( ) setup = [ Step(Action.EXECUTE, mySerial2_test_device, ('dut_reboot_mon', dut_reboot_monitor), Test.add_monitor), ] teardown = [ Step(Action.EXECUTE, mySerial2_test_device, 'dut_reboot_mon', Test.remove_monitor), ] arduino_lowpower_16353 = Test( name='arduino_lowpower_16353', timeout=timeout, setup=setup, test=[ Step(Action.WAIT_FOR, mySerial2_test_device, 'Example for RTC wakeup from deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 0'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (0) Power On Reset with Power Supplied'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 1'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 1'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 10'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 2'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 30'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 3'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 1'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 4'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 10'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 5'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 30'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 6'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 1'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 7'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 10'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 8'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 30'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'count = 9'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Boot Cause: (5) RTC Alarm expired in deep sleep'), Step(Action.WAIT_FOR, mySerial2_test_device, 'sleep time = 1'), Step(Action.WAIT_FOR, mySerial2_test_device, 'Go to deep sleep...'), Step(Action.WAIT_FOR, mySerial2_test_device, 'loop end'), ], teardown=teardown) lowpower_16355 = TestGroup( name='lowpower_16355', devices=[lowpower16353_test_device, mySerial2_test_device], tag=[Tag.POSITIVE], tests=[ arduino_lowpower_16353, ]) test_groups = [ lowpower_16355, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 60 play_record_timeout = 180 player_device, recorder_device = self.get_devices_list() def setup_steps(device, reboot_monitor, error_monitor): return [ Step(Action.WRITE, device, 'reboot'), Step(Action.WAIT_FOR, device, device.NUTTSHELL), Step(Action.EXECUTE, device, ('{}_reboot_mon'.format(str(device)), reboot_monitor), Test.add_monitor), Step(Action.EXECUTE, device, ('{}_error_mon'.format(str(device)), error_monitor), Test.add_monitor), ] def player_setup(device, reboot_monitor, error_monitor): if arguments.player_fs_ready: return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) else: return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) + prepare_player_fs_steps(device) def recorder_setup(device, reboot_monitor, error_monitor): if arguments.recorder_fs_ready: return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) else: return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) + prepare_recorder_fs_steps(device) def verify_sd_card_mount(device): return [ Step(Action.EXECUTE, device, ('{}_sd_mount_monitor'.format(str(device)), sd_mount_monitor), Test.add_monitor), Step(Action.WRITE, device, 'cd /mnt'), Step(Action.WRITE, device, 'ls'), Step(Action.EXECUTE, device, SD_CARD_MOUNT_VERIFY_TIME_OUT, start_timer), Step(Action.WAIT_FOR, device, 'SD card mounted'), Step(Action.EXECUTE, device, '{}_sd_mount_monitor'.format(str(device)), Test.remove_monitor), ] def prepare_player_fs_steps(device): return [ Step(Action.WAIT_FOR, device, device.NSH_PROMPT, lambda test, source, data: execute_command(test, source, data, 'cd sd0', False)), Step(Action.WAIT_FOR, device, 'cd sd0', lambda test, source, data: sz_send_file(test, source, data, self.audio_file)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(AUDIO_FILE.split('/')[1]), lambda test, source, data: sz_send_file(test, source, data, self.playlist)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(PLAYLIST_FILE.split('/')[1]), lambda test, source, data: sz_send_file(test, source, data, self.audio_decoder)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(DECODER), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: create_dirs(test, source, data, PLAYER_FOLDERS, AUDIO_EXAMPLE_PATH)), Step(Action.WAIT_FOR, device, 'Directories created', lambda test, source, data: mv_file(test, source, data, DECODER, BIN)), Step(Action.WAIT_FOR, device, 'File {} moved'.format(DECODER), lambda test, source, data: mv_file(test, source, data, PLAYLIST_FILE.split('/')[1], PLAYLIST)), Step(Action.WAIT_FOR, device, 'File {} moved'.format(PLAYLIST_FILE.split('/')[1]), lambda test, source, data: mv_file(test, source, data, AUDIO_FILE.split('/')[1], AUDIO)), ] def clean_player_fs(device): return [ Step(Action.EXECUTE, device, 'Start cleaning', trigger_cleaning), Step(Action.WAIT_FOR, device, 'Start cleaning', lambda test, source, data: execute_command(test, source, data, 'cd /', True)), Step(Action.WAIT_FOR, device, 'Command cd / executed', lambda test, source, data: execute_command(test, source, data, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), True)), Step(Action.WAIT_FOR, device, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'cd {}'.format(AUDIO), True)), Step(Action.WAIT_FOR, device, 'Command cd {} executed'.format(AUDIO), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(AUDIO), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(AUDIO), lambda test, source, data: execute_command(test, source, data, 'cd {}'.format(PLAYLIST), True)), Step(Action.WAIT_FOR, device, 'Command cd {} executed'.format(PLAYLIST), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(PLAYLIST), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(PLAYLIST)), ] def prepare_recorder_fs_steps(device): return [ Step(Action.WAIT_FOR, device, device.NSH_PROMPT, lambda test, source, data: execute_command(test, source, data, 'cd sd0', False)), Step(Action.WAIT_FOR, device, 'cd sd0', lambda test, source, data: sz_send_file(test, source, data, self.src)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(SRC), lambda test, source, data: sz_send_file(test, source, data, self.audio_encoder)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(ENCODER), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: create_dirs(test, source, data, RECORDER_FOLDERS, AUDIO_EXAMPLE_PATH)), Step(Action.WAIT_FOR, device, 'Directories created', lambda test, source, data: mv_file(test, source, data, ENCODER, BIN)), Step(Action.WAIT_FOR, device, 'File {} moved'.format(ENCODER), lambda test, source, data: mv_file(test, source, data, SRC, BIN)), ] def remove_recorded_files_steps(device): return [ Step(Action.EXECUTE, device, None, remove_recorded_file), ] def clean_recorder_fs(device): return [ Step(Action.EXECUTE, device, 'Start cleaning', trigger_cleaning), Step(Action.WAIT_FOR, device, 'Start cleaning', lambda test, source, data: execute_command(test, source, data, 'cd /', True)), Step(Action.WAIT_FOR, device, 'Command cd / executed', lambda test, source, data: execute_command(test, source, data, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), True)), Step(Action.WAIT_FOR, device, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'cd {}'.format(REC), True)), Step(Action.WAIT_FOR, device, 'Command cd {} executed'.format(REC), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(REC), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(REC)), ] def teardown(device): return [ Step(Action.EXECUTE, device, '{}_reboot_mon'.format(str(device)), Test.remove_monitor), Step(Action.EXECUTE, device, '{}_error_mon'.format(str(device)), Test.remove_monitor), ] def player_teardown(device): if arguments.preserve_player_fs: return teardown(device) else: return clean_player_fs(device) + teardown(device) def recorder_teardown(device): if arguments.preserve_recorder_fs: return teardown(device) + remove_recorded_files_steps(device) else: return clean_recorder_fs(device) + teardown(device) audio_tc_01_player = Test( name='audio_tc_01_player', timeout=timeout, setup=player_setup(player_device, player_reboot_monitor, player_error_monitor), test=[ Step(Action.WRITE, player_device, 'player'), Step(Action.WAIT_FOR, player_device, player_device.PLAYER_START), Step(Action.WAIT_FOR, player_device, player_device.PLAYER_EXIT), ], teardown=player_teardown(player_device), ) audio_tc_02_recorder = Test( name='audio_tc_02_recorder', timeout=timeout, setup=recorder_setup(recorder_device, recorder_reboot_monitor, recorder_error_monitor), test=[ Step(Action.WRITE, recorder_device, 'recorder'), Step(Action.WAIT_FOR, recorder_device, recorder_device.RECORDER_START), Step(Action.WAIT_FOR, recorder_device, recorder_device.RECORD_DATA, lambda test, source, data: store_rec_file_path(test, source, data)), Step(Action.WAIT_FOR, recorder_device, recorder_device.RECORDER_EXIT), ], teardown=recorder_teardown(recorder_device), ) audio_tc_03_play_record = Test( name='audio_tc_03_play_record', timeout=play_record_timeout, setup=player_setup(player_device, player_reboot_monitor, player_error_monitor) + recorder_setup(recorder_device, recorder_reboot_monitor, recorder_error_monitor), test=[ Step(Action.WRITE, player_device, 'player'), Step(Action.WAIT_FOR, player_device, player_device.RUNNING_TIME, lambda test, source, data: execute_command(test, recorder_device, data, 'recorder', False)), Step(Action.WAIT_FOR, recorder_device, recorder_device.RECORDER_START), Step(Action.WAIT_FOR, recorder_device, recorder_device.RECORD_DATA, lambda test, source, data: store_rec_file_path(test, source, data)), Step(Action.WAIT_FOR, player_device, player_device.PLAYER_EXIT), Step(Action.WAIT_FOR, recorder_device, recorder_device.RECORDER_EXIT, lambda test, source, data: sz_send_file_from_target(test, source, data)), Step(Action.WAIT_FOR, recorder_device, 'Sending file from {}'.format(recorder_device), lambda test, source, data: rz_receive_file(test, source, data)), Step(Action.WAIT_FOR, recorder_device, 'successfully transferred', lambda test, source, data: verify_recorded_file(test, source, data)), ], teardown=player_teardown(player_device) + recorder_teardown(recorder_device) + [ Step(Action.EXECUTE, recorder_device, None, remove_transferred_file), ], ) audio = TestGroup( name='audio', devices=[player_device, recorder_device], tag=[Tag.POSITIVE], tests=[ # audio_tc_01_player, # audio_tc_02_recorder, audio_tc_03_play_record, ] ) test_groups = [ audio, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 60 pwm_test_device = self.get_devices_list()[0] setup = [ Step(Action.WAIT_FOR, pwm_test_device, pwm_test_device.NSH_PROMPT), Step(Action.WRITE, pwm_test_device, 'reboot'), Step(Action.WAIT_FOR, pwm_test_device, pwm_test_device.NUTTSHELL), Step(Action.EXECUTE, pwm_test_device, ('dut_reboot_mon', dut_reboot_monitor), Test.add_monitor), ] teardown = [ Step(Action.EXECUTE, pwm_test_device, 'dut_reboot_mon', Test.remove_monitor), ] SDK_Example_test_16283 = Test( name='SDK_Example_test_16283', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, pwm_test_device, 'pwm'), Step( Action.WAIT_FOR, pwm_test_device, 'pwm_main: starting output with frequency: 1000 duty: 00008000' ), Step(Action.WAIT_FOR, pwm_test_device, 'pwm_main: stopping output'), Step(Action.EXECUTE, pwm_test_device, None, lambda test, source, data: time.sleep(5)), Step( Action.EXECUTE, pwm_test_device, None, lambda test, source, data: analysys_15773( test, source, data, 127)), Step(Action.WAIT_FOR, pwm_test_device, 'analysys_15773 {} ok!'.format(127)), ], teardown=teardown) pwm = TestGroup(name='pwm', devices=[pwm_test_device], tag=[Tag.POSITIVE], tests=[ SDK_Example_test_16283, ]) test_groups = [ pwm, ] return test_groups
def clean_recorder_fs(device): return [ Step(Action.EXECUTE, device, 'Start cleaning', trigger_cleaning), Step(Action.WAIT_FOR, device, 'Start cleaning', lambda test, source, data: execute_command(test, source, data, 'cd /', True)), Step(Action.WAIT_FOR, device, 'Command cd / executed', lambda test, source, data: execute_command(test, source, data, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), True)), Step(Action.WAIT_FOR, device, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'cd {}'.format(REC), True)), Step(Action.WAIT_FOR, device, 'Command cd {} executed'.format(REC), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(REC), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(REC)), ]
def generate_test_groups(self, arguments, log=None): timeout = 90 accel_example_test_device = self.get_devices_list()[0] setup = [ Step(Action.WAIT_FOR, accel_example_test_device, accel_example_test_device.NSH_PROMPT), Step(Action.WRITE, accel_example_test_device, 'reboot'), Step(Action.WAIT_FOR, accel_example_test_device, accel_example_test_device.NUTTSHELL), Step(Action.EXECUTE, accel_example_test_device, ('dut_reboot_mon', dut_reboot_monitor), Test.add_monitor), Step(Action.EXECUTE, accel_example_test_device, ('dut_accel_mon', dut_accel_monitor), Test.add_monitor), ] teardown = [ Step(Action.EXECUTE, accel_example_test_device, 'dut_accel_mon', Test.remove_monitor), Step(Action.EXECUTE, accel_example_test_device, 'dut_reboot_mon', Test.remove_monitor), ] SDK_Example_test_15832 = Test( name='SDK_Example_test_15832', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, accel_example_test_device, 'accel'), Step(Action.EXECUTE, accel_example_test_device, None, lambda test, source, data: time.sleep(10)), Step(Action.EXECUTE, accel_example_test_device, ('dut_accel_mon', dut_accel_monitor), Test.add_monitor), Step(Action.WAIT_FOR, accel_example_test_device, 'ACCEL example end'), ], teardown=[ Step(Action.EXECUTE, accel_example_test_device, 'dut_accel_mon', Test.remove_monitor) ] ) accel = TestGroup( name='accel', devices=[accel_example_test_device], tag=[Tag.POSITIVE], tests=[ SDK_Example_test_15832, ] ) test_groups = [ accel, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 120 spresense_test_device = self.get_devices_list()[0] setup = [ ] teardown = [ ] adn_subcore_Write_Read_16770_16771 = Test( name='adn_subcore_Write_Read_16770_16771', timeout=timeout, setup=setup, test=[ Step(Action.WAIT_FOR, spresense_test_device, '[Main] Start Main core!'), Step(Action.WAIT_FOR, spresense_test_device, '[Sub1] Start subcore1=0'), Step(Action.WAIT_FOR, spresense_test_device, '[Main] Begin subcore1=0'), Step(Action.WAIT_FOR, spresense_test_device, 'nA0He5$'), Step(Action.WAIT_FOR, spresense_test_device, 'He5'), Step(Action.WAIT_FOR, spresense_test_device, '116'), Step(Action.WAIT_FOR, spresense_test_device, '1001110'), Step(Action.WAIT_FOR, spresense_test_device, '78'), Step(Action.WAIT_FOR, spresense_test_device, '4E'), Step(Action.WAIT_FOR, spresense_test_device, '1.23456'), Step(Action.WRITE, spresense_test_device, 'abc123abc123'), Step(Action.WAIT_FOR, spresense_test_device, 'Serial read = abc123abc123'), ], teardown=teardown ) Spresense = TestGroup( name='Spresense', devices=[spresense_test_device], tag=[Tag.POSITIVE], tests=[ adn_subcore_Write_Read_16770_16771, ] ) test_groups = [ Spresense, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 10 spiloopback16298_test_device = self.get_devices_list()[0] setup = [] teardown = [] Arduino_SpiLoopback_16298 = Test( name='Arduino_SpiLoopback_16298', timeout=timeout, setup=setup, test=[ Step(Action.WAIT_FOR, spiloopback16298_test_device, 'SPI loopback test'), Step(Action.WAIT_FOR, spiloopback16298_test_device, '8 bit loopback test passed'), Step(Action.WAIT_FOR, spiloopback16298_test_device, '16 bit loopback test passed'), Step(Action.WAIT_FOR, spiloopback16298_test_device, "0 0 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "1 1 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "2 2 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "3 3 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "4 4 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "5 5 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "6 6 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "7 7 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "8 8 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "9 9 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "10 10 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "11 11 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "12 12 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "13 13 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "14 14 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "15 15 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "16 16 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "17 17 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "18 18 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "19 19 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "20 20 pass"), Step(Action.WAIT_FOR, spiloopback16298_test_device, "21 21 pass"), ], teardown=teardown) spiloopback = TestGroup(name='spiloopback', devices=[spiloopback16298_test_device], tag=[Tag.POSITIVE], tests=[ Arduino_SpiLoopback_16298, ]) test_groups = [ spiloopback, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 120 spresense_test_device = self.get_devices_list()[0] setup = [ ] teardown = [ ] adn_subcore_tone_16767 = Test( name='adn_subcore_tone_16767', timeout=timeout, setup=setup, test=[ Step(Action.WAIT_FOR, spresense_test_device, '[Main] Start Main core!'), Step(Action.WAIT_FOR, spresense_test_device, '[Main] Begin subcore1=0'), Step(Action.WAIT_FOR, spresense_test_device, 'test tone 15783'), Step(Action.WAIT_FOR, spresense_test_device, 'tone set 31'), Step(Action.EXECUTE, spresense_test_device, None, lambda test, source, data: time.sleep(2)), Step(Action.EXECUTE, spresense_test_device, None, lambda test, source, data: analysys_15783(test, source, data, 0, 31)), Step(Action.WAIT_FOR, spresense_test_device, 'analysys_15783 ok!'), Step(Action.WAIT_FOR, spresense_test_device, 'tone set 10000'), Step(Action.EXECUTE, spresense_test_device, None, lambda test, source, data: time.sleep(2)), Step(Action.EXECUTE, spresense_test_device, None, lambda test, source, data: analysys_15783(test, source, data, 0, 10000)), Step(Action.WAIT_FOR, spresense_test_device, 'analysys_15783 ok!'), Step(Action.WAIT_FOR, spresense_test_device, 'tone set 65535'), Step(Action.EXECUTE, spresense_test_device, None, lambda test, source, data: time.sleep(2)), Step(Action.EXECUTE, spresense_test_device, None, lambda test, source, data: analysys_15783(test, source, data, 0, 65535)), Step(Action.WAIT_FOR, spresense_test_device, 'analysys_15783 ok!'), Step(Action.WAIT_FOR, spresense_test_device, 'tone set notone'), Step(Action.EXECUTE, spresense_test_device, None, lambda test, source, data: time.sleep(2)), Step(Action.EXECUTE, spresense_test_device, None, lambda test, source, data: analysys_15783(test, source, data, 0, 0)), Step(Action.WAIT_FOR, spresense_test_device, 'analysys_15783 ok!'), ], teardown=teardown ) Spresense = TestGroup( name='Spresense', devices=[spresense_test_device], tag=[Tag.POSITIVE], tests=[ adn_subcore_tone_16767, ] ) test_groups = [ Spresense, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 10 asmp_test_device = self.get_devices_list()[0] setup = [ # Step(Action.WAIT_FOR, asmp_test_device, asmp_test_device.NSH_PROMPT), Step(Action.WRITE, asmp_test_device, 'reboot'), Step(Action.WAIT_FOR, asmp_test_device, asmp_test_device.NUTTSHELL), Step(Action.EXECUTE, asmp_test_device, ('dut_reboot_mon', dut_reboot_monitor), Test.add_monitor), ] teardown = [ Step(Action.EXECUTE, asmp_test_device, 'dut_reboot_mon', Test.remove_monitor), ] tc_05_sub_core_communication_between_secure_secure = Test( name='tc_05_sub_core_communication_between_secure_secure', timeout=timeout, setup=setup, test=[ Step(Action.WRITE, asmp_test_device, 'asmp_extensions'), Step(Action.WAIT_FOR, asmp_test_device, 'asmp app start'), Step(Action.WRITE, asmp_test_device, 'SHM_INIT --index 0 --keyid 1 --size 1024'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'SHM_ATTATCH --index 0 --flag 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MT_INIT --index 0 --keyid 3'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_INIT_SEC --index 0 --filename worker_extensions'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_ASSIGN --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_INIT_SEC --index 1 --filename worker_extensions'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_ASSIGN --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_INIT --index 2 --filename worker_extensions'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_ASSIGN --index 2'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_INIT --index 3 --filename worker_extensions'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_ASSIGN --index 3'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_INIT --index 4 --filename worker_extensions'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_ASSIGN --index 4'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_INIT --index 0 --keyid 2 --cpuid 3'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_INIT --index 1 --keyid 2 --cpuid 4'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_INIT --index 2 --keyid 2 --cpuid 5'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_INIT --index 3 --keyid 2 --cpuid 6'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_INIT --index 4 --keyid 2 --cpuid 7'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_BIND --index 0 --mutex 0 --mq 0 --shm 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_BIND --index 1 --mutex 0 --mq 1 --shm 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_BIND --index 2 --mutex 0 --mq 2 --shm 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_BIND --index 3 --mutex 0 --mq 3 --shm 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_BIND --index 4 --mutex 0 --mq 4 --shm 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_EXEC --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_EXEC --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_EXEC --index 2'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_EXEC --index 3'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_EXEC --index 4'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), #supervisor work0 Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 0 --lock'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'LOCK DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 0 --write'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'WRITE SHM DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 0 --unlock'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'UNLOCK DONE'), Step(Action.WRITE, asmp_test_device, 'MT_LOCK --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'RD_SHM --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'Hello,CPU'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MT_UNLOCK --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), #supervisor work1 Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 1 --lock'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'LOCK DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 1 --write'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'WRITE SHM DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 1 --unlock'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'UNLOCK DONE'), Step(Action.WRITE, asmp_test_device, 'MT_LOCK --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'RD_SHM --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'Hello,CPU'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MT_UNLOCK --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), #work0 to work1 Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 0 --lock'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'LOCK DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 0 --write'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'WRITE SHM DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 0 --unlock'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'UNLOCK DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 0 --send --value 4'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'SEND DONE'), #work1 to work0 Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 1 --lock'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'LOCK DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 1 --write'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'WRITE SHM DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 1 --unlock'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'UNLOCK DONE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 1 --rev --value 3'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_RECV --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'REV DONE'), #end Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 1 --quit'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 0 --quit'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 2 --quit'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 3 --quit'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_SEND --index 4 --quit'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_DESTROY --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_DESTROY --index 1'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_DESTROY --index 2'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_DESTROY --index 3'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'TASK_DESTROY --index 4'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'SHM_DETATCH --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'SHM_DESTROY --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MT_DESTROY --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_DESTROY --index 0'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_DESTROY --index 2'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_DESTROY --index 3'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'MQ_DESTROY --index 4'), Step(Action.WAIT_FOR, asmp_test_device, 'TRUE'), Step(Action.WRITE, asmp_test_device, 'QUIT'), Step(Action.WAIT_FOR, asmp_test_device, 'asmp app end'), ], teardown=teardown ) asmp = TestGroup( name='asmp', devices=[asmp_test_device], tag=[Tag.POSITIVE], tests=[ tc_05_sub_core_communication_between_secure_secure, ] ) test_groups = [ asmp, ] return test_groups
def generate_test_groups(self, arguments, log=None): play_record_timeout = 300 player_device, recorder_device = self.get_devices_list() def setup_steps(device, reboot_monitor, error_monitor): return [ Step(Action.WRITE, device, 'reboot'), Step(Action.WAIT_FOR, device, device.NUTTSHELL), Step(Action.EXECUTE, device, ('{}_reboot_mon'.format(str(device)), reboot_monitor), Test.add_monitor), Step(Action.EXECUTE, device, ('{}_error_mon'.format(str(device)), error_monitor), Test.add_monitor), ] def verify_sd_card_mount(device): return [ Step(Action.EXECUTE, device, ('{}_sd_mount_monitor'.format( str(device)), sd_mount_monitor), Test.add_monitor), Step(Action.WRITE, device, 'cd /mnt'), Step(Action.WRITE, device, 'ls'), Step(Action.EXECUTE, device, SD_CARD_MOUNT_VERIFY_TIME_OUT, start_timer), Step(Action.WAIT_FOR, device, 'SD card mounted'), Step(Action.EXECUTE, device, '{}_sd_mount_monitor'.format(str(device)), Test.remove_monitor), ] def teardown(device): return [ Step(Action.EXECUTE, device, '{}_reboot_mon'.format(str(device)), Test.remove_monitor), Step(Action.EXECUTE, device, '{}_error_mon'.format(str(device)), Test.remove_monitor), ] def usb_s(device): r = [ Step( Action.EXECUTE, device, None, lambda test, source, data: mountStart(test, source, data)), ] return r def usb_e(device): r = [ Step(Action.EXECUTE, device, None, lambda test, source, data: mountEnd(test, source, data)), ] return r def dsp_steps(device): r = [ Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp0, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp1, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp2, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp3, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), ] return r def add_file_to_player(): r = [] r += [ Step( Action.EXECUTE, player_device, None, lambda test, source, data: cp_file( test, source, data, os.path.join(os.getcwd(), AUDIO_FILE), 'AUDIO')), Step(Action.WAIT_FOR, player_device, 'copied'), Step( Action.EXECUTE, player_device, None, lambda test, source, data: cp_file( test, source, data, os.path.join(os.getcwd(), PLAYLIST_FILE), 'PLAYLIST')), Step(Action.WAIT_FOR, player_device, 'copied'), ] return r def verify_rec_file(): r = [ Step( Action.EXECUTE, recorder_device, None, lambda test, source, data: mv_file( test, source, data, 'REC', os.getcwd() + '/output')), Step(Action.WAIT_FOR, recorder_device, 'moved'), Step( Action.EXECUTE, recorder_device, None, lambda test, source, data: verify_recorded_file( test, source, data)), Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success'), ] return r tc_player_objif_16282_17163 = Test( name='tc_player_objif_16282_17163', timeout=play_record_timeout, setup=setup_steps(player_device, player_reboot_monitor, player_error_monitor) + \ setup_steps(recorder_device, recorder_reboot_monitor, recorder_error_monitor) + \ verify_sd_card_mount(player_device) + verify_sd_card_mount(recorder_device), test=usb_s(recorder_device) + \ dsp_steps(recorder_device) + \ usb_e(recorder_device) + \ usb_s(player_device) + \ dsp_steps(player_device) + \ add_file_to_player() + \ usb_e(player_device) + [ Step(Action.WRITE, player_device, 'audio_player_objif'), Step(Action.WRITE, recorder_device, 'audio_recorder_objif'), Step(Action.WAIT_FOR, recorder_device, recorder_device.RECORD_DATA, lambda test, source, data: store_rec_file_path(test, source, data)), Step(Action.WAIT_FOR, player_device, player_device.RUNNING_TIME), Step(Action.WAIT_FOR, player_device, player_device.PLAYER_EXIT), Step(Action.WAIT_FOR, recorder_device, recorder_device.RECORDER_EXIT), ] + usb_s(recorder_device) + verify_rec_file() + usb_e(recorder_device), teardown=teardown(player_device) + teardown(recorder_device), ) audio = TestGroup(name='audio', devices=[player_device, recorder_device], tag=[Tag.POSITIVE], tests=[ tc_player_objif_16282_17163, ]) test_groups = [ audio, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 300 player_device, recorder_device = self.get_devices_list() def usb_s(device): r = [ Step(Action.EXECUTE, device, None, lambda test, source, data: reset_data(test, source, data)), Step(Action.EXECUTE, device, None, lambda test, source, data: wait_sec(test, source, data, 5, 'wait sd')), Step(Action.EXECUTE, device, None, lambda test, source, data: checkDefaultDisk(test, source, data)), Step(Action.WRITE, device, 'usbmsc'), Step(Action.WAIT_FOR, device, 'Begin USB Mass Storage Operation', lambda test, source, data: wait_sec(test, source, data, 25, 'usb mount to PC')), Step(Action.EXECUTE, device, None, lambda test, source, data: checkNewDisk(test, source, data)), ] return r def usb_e(device): r = [ Step(Action.WRITE, device, 'end'), Step(Action.WAIT_FOR, device, 'Finish USB Mass Storage Operation'), ] return r def dsp_steps(device): r = [ Step(Action.EXECUTE, device, None, lambda test, source, data: cp_file(test, source, data, self.audio_encoder, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step(Action.EXECUTE, device, None, lambda test, source, data: cp_file(test, source, data, self.audio_decoder, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), ] return r def add_file_to_player(): r = [] for file in PLAY_FILES: r += [ Step(Action.EXECUTE, player_device, None, lambda test, source, data, filename=file: cp_file(test, source, data, os.path.join(os.getcwd(), 'input/' + filename), '')), Step(Action.WAIT_FOR, player_device, 'copied'), ] return r setup = [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] teardown = [ ] tc_adn_recorder_digmic_16650 = Test( name='tc_adn_recorder_digmic_16650', timeout=timeout, setup=setup, test=usb_s(recorder_device) + dsp_steps(recorder_device) + usb_e(recorder_device) + usb_s(player_device) + dsp_steps(player_device) + add_file_to_player() + usb_e(player_device) + [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WRITE, player_device, 'player'), Step(Action.WRITE, recorder_device, '16650'), Step(Action.WAIT_FOR, recorder_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, recorder_device, 'Init Recorder!'), Step(Action.WAIT_FOR, recorder_device, 'Write Header!'), Step(Action.WAIT_FOR, recorder_device, 'Recording Start!'), Step(Action.WAIT_FOR, recorder_device, 'End Recording'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] + usb_s(recorder_device) + [ Step(Action.EXECUTE, recorder_device, None, lambda test, source, data: mv_file(test, source, data, '16650.wav', os.getcwd() + '/output', '16650.wav')), Step(Action.WAIT_FOR, recorder_device, 'moved'), Step(Action.WRITE, recorder_device, 'end'), Step(Action.WAIT_FOR, recorder_device, 'Finish USB Mass Storage Operation', lambda test, source, data: verify_recorded_file(test, source, data, '16650.wav')), Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success'), ], teardown=teardown ) test_group = TestGroup( name='test_group', devices=[player_device, recorder_device], tag=[Tag.POSITIVE], tests=[ tc_adn_recorder_digmic_16650, ] ) test_groups = [ test_group, ] return test_groups
def generate_test_groups(self, arguments, log=None): timeout = 1200 device = self.get_devices_list()[0] def usb_s(device): r = umount(device) + [ Step( Action.EXECUTE, device, None, lambda test, source, data: reset_data(test, source, data)), Step( Action.EXECUTE, device, None, lambda test, source, data: wait_sec(test, source, data, 5, 'wait sd')), Step( Action.EXECUTE, device, None, lambda test, source, data: checkDefaultDisk(test, source, data)), Step(Action.WRITE, device, 'msconn', terminator='\n'), Step( Action.WAIT_FOR, device, 'Connected', lambda test, source, data: wait_sec(test, source, data, 25, 'usb mount to PC')), Step( Action.EXECUTE, device, None, lambda test, source, data: checkNewDisk(test, source, data)), ] return r def usb_e(device): r = [ Step(Action.WRITE, device, 'msdis'), Step(Action.WAIT_FOR, device, 'Disconnected'), ] return r def umount(device): r = [ Step(Action.WRITE, device, 'umount /mnt/sd0'), Step( Action.EXECUTE, device, '', lambda test, source, data: wait_sec( test, source, data, 1, 'umount')), ] return r def setup_steps(device, reboot_monitor): return [ Step(Action.WRITE, device, 'reboot'), Step(Action.WAIT_FOR, device, device.NUTTSHELL), Step(Action.EXECUTE, device, ('{}_reboot_mon'.format(str(device)), reboot_monitor), Test.add_monitor), ] def setup(device, reboot_monitor): return setup_steps(device, reboot_monitor) +\ verify_sd_card_mount(device) def verify_sd_card_mount(device): return [ Step(Action.EXECUTE, device, ('{}_sd_mount_monitor'.format( str(device)), sd_mount_monitor), Test.add_monitor), Step(Action.WRITE, device, 'cd /mnt'), Step(Action.WRITE, device, 'ls'), Step(Action.EXECUTE, device, SD_CARD_MOUNT_VERIFY_TIME_OUT, start_timer), Step(Action.WAIT_FOR, device, 'SD card mounted'), Step(Action.EXECUTE, device, '{}_sd_mount_monitor'.format(str(device)), Test.remove_monitor), ] def teardown(device): return [ Step(Action.EXECUTE, device, '{}_reboot_mon'.format(str(device)), Test.remove_monitor), ] tc_usbmsc = Test( name='tc_usbmsc', timeout=timeout, setup=setup(device, reboot_monitor) + usb_s(device), test=[ Step( Action.EXECUTE, device, None, lambda test, source, data: func( test, source, data, arguments)), ], teardown=teardown(device), ) func_move = TestGroup( name='tg', devices=[device], tag=[Tag.POSITIVE], tests=[tc_usbmsc], ) test_groups = [ func_move, ] return test_groups
def usb_e(device): r = [ Step(Action.WRITE, device, 'end'), Step(Action.WAIT_FOR, device, 'Finish USB Mass Storage Operation'), ] return r
def teardown(device): return [ Step(Action.EXECUTE, device, '{}_reboot_mon'.format(str(device)), Test.remove_monitor), ]
def generate_test_groups(self, arguments, log=None): timeout = 600 #play_record_timeout = 1800 player_device, recorder_device = self.get_devices_list() """ def setup_steps(device, reboot_monitor, error_monitor): return [ Step(Action.WRITE, device, 'reboot'), Step(Action.WAIT_FOR, device, device.NUTTSHELL), Step(Action.EXECUTE, device, ('{}_reboot_mon'.format(str(device)), reboot_monitor), Test.add_monitor), Step(Action.EXECUTE, device, ('{}_error_mon'.format(str(device)), error_monitor), Test.add_monitor), ] def player_setup(device, reboot_monitor, error_monitor): if arguments.player_fs_ready: return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) else: return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) + prepare_player_fs_steps(device) def player_verify_setup(device, reboot_monitor, error_monitor): return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) +\ prepare_player_verify_steps(device) def recorder_verify_setup(device, reboot_monitor, error_monitor): return setup_steps(device, reboot_monitor, error_monitor) + verify_sd_card_mount(device) def recorder_setup(device, reboot_monitor, error_monitor): if arguments.recorder_fs_ready: return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) else: return setup_steps(device, reboot_monitor, error_monitor) +\ verify_sd_card_mount(device) + prepare_recorder_fs_steps(device) def verify_sd_card_mount(device): return [ Step(Action.EXECUTE, device, ('{}_sd_mount_monitor'.format(str(device)), sd_mount_monitor), Test.add_monitor), Step(Action.WRITE, device, 'cd /mnt'), Step(Action.WRITE, device, 'ls'), Step(Action.EXECUTE, device, SD_CARD_MOUNT_VERIFY_TIME_OUT, start_timer), Step(Action.WAIT_FOR, device, 'SD card mounted'), Step(Action.EXECUTE, device, '{}_sd_mount_monitor'.format(str(device)), Test.remove_monitor), ] def prepare_player_verify_steps(device): return [ Step(Action.WAIT_FOR, device, device.NSH_PROMPT, lambda test, source, data: execute_command(test, source, data, 'cd sd0', False)), Step(Action.WAIT_FOR, device, 'cd sd0', lambda test, source, data: sz_send_output_file(test, source, data, 'LPCM_192K_STEREO_24BIT.wav')), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format('LPCM_192K_STEREO_24BIT.wav'), lambda test, source, data: mv_file(test, source, data, 'LPCM_192K_STEREO_24BIT.wav', AUDIO)), Step(Action.WAIT_FOR, device, 'File {} moved'.format('LPCM_192K_STEREO_24BIT.wav')), ] def prepare_player_fs_steps(device): return [ Step(Action.WAIT_FOR, device, device.NSH_PROMPT, lambda test, source, data: execute_command(test, source, data, 'cd sd0', False)), Step(Action.WAIT_FOR, device, 'cd sd0', lambda test, source, data: sz_send_file(test, source, data, self.audio_file)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(AUDIO_FILE.split('/')[1]), lambda test, source, data: sz_send_file(test, source, data, self.audio_file2)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(AUDIO_FILE2.split('/')[1]), lambda test, source, data: sz_send_file(test, source, data, self.playlist)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(PLAYLIST_FILE.split('/')[1]), lambda test, source, data: sz_send_file(test, source, data, os.path.join(self.audio_decoder, DECODERS[0]))), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(DECODERS[0]), lambda test, source, data: sz_send_file(test, source, data, os.path.join(self.audio_decoder, DECODERS[1]))), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(DECODERS[1]), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: create_dirs(test, source, data, PLAYER_FOLDERS, AUDIO_EXAMPLE_PATH)), Step(Action.WAIT_FOR, device, 'Directories created', lambda test, source, data: mv_file(test, source, data, DECODERS[0], BIN)), Step(Action.WAIT_FOR, device, 'File {} moved'.format(DECODERS[0]), lambda test, source, data: mv_file(test, source, data, DECODERS[1], BIN)), Step(Action.WAIT_FOR, device, 'File {} moved'.format(DECODERS[1]), lambda test, source, data: mv_file(test, source, data, PLAYLIST_FILE.split('/')[1], PLAYLIST)), Step(Action.WAIT_FOR, device, 'File {} moved'.format(PLAYLIST_FILE.split('/')[1]), lambda test, source, data: mv_file(test, source, data, AUDIO_FILE.split('/')[1], AUDIO)), Step(Action.WAIT_FOR, device, 'File {} moved'.format(AUDIO_FILE.split('/')[1]), lambda test, source, data: mv_file(test, source, data, AUDIO_FILE2.split('/')[1], AUDIO)), ] def clean_player_fs(device): return [ Step(Action.EXECUTE, device, 'Start cleaning', trigger_cleaning), Step(Action.WAIT_FOR, device, 'Start cleaning', lambda test, source, data: execute_command(test, source, data, 'cd /', True)), Step(Action.WAIT_FOR, device, 'Command cd / executed', lambda test, source, data: execute_command(test, source, data, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), True)), Step(Action.WAIT_FOR, device, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'cd {}'.format(AUDIO), True)), Step(Action.WAIT_FOR, device, 'Command cd {} executed'.format(AUDIO), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(AUDIO), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(AUDIO), lambda test, source, data: execute_command(test, source, data, 'cd {}'.format(PLAYLIST), True)), Step(Action.WAIT_FOR, device, 'Command cd {} executed'.format(PLAYLIST), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(PLAYLIST), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(PLAYLIST)), ] def prepare_recorder_fs_steps(device): return [ Step(Action.WAIT_FOR, device, device.NSH_PROMPT, lambda test, source, data: execute_command(test, source, data, 'cd sd0', False)), Step(Action.WAIT_FOR, device, 'cd sd0', lambda test, source, data: sz_send_file(test, source, data, self.src)), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(SRC), lambda test, source, data: sz_send_file(test, source, data, os.path.join(self.audio_encoder, ENCODERS[0]))), Step(Action.WAIT_FOR, device, 'File {} successfully transferred'.format(ENCODERS[0]), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: create_dirs(test, source, data, RECORDER_FOLDERS, AUDIO_EXAMPLE_PATH)), Step(Action.WAIT_FOR, device, 'Directories created', lambda test, source, data: mv_file(test, source, data, ENCODERS[0], BIN)), Step(Action.WAIT_FOR, device, 'File {} moved'.format(ENCODERS[0]), lambda test, source, data: mv_file(test, source, data, SRC, BIN)), ] def remove_recorded_files_steps(device): return [ Step(Action.EXECUTE, device, None, remove_recorded_file), ] def clean_recorder_fs(device): return [ Step(Action.EXECUTE, device, 'Start cleaning', trigger_cleaning), Step(Action.WAIT_FOR, device, 'Start cleaning', lambda test, source, data: execute_command(test, source, data, 'cd /', True)), Step(Action.WAIT_FOR, device, 'Command cd / executed', lambda test, source, data: execute_command(test, source, data, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), True)), Step(Action.WAIT_FOR, device, 'cd {}{}'.format(AUDIO_EXAMPLE_PATH, BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(BIN), lambda test, source, data: execute_command(test, source, data, 'cd {}'.format(REC), True)), Step(Action.WAIT_FOR, device, 'Command cd {} executed'.format(REC), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: clean_dir(test, source, data)), Step(Action.WAIT_FOR, device, 'Files removed from {}'.format(REC), lambda test, source, data: execute_command(test, source, data, 'ls', False)), Step(Action.WAIT_FOR, device, device.NSH_LS, lambda test, source, data: rm_dir(test, source, data)), Step(Action.WAIT_FOR, device, '{} folder removed'.format(REC)), ] def teardown(device): return [ Step(Action.EXECUTE, device, '{}_reboot_mon'.format(str(device)), Test.remove_monitor), Step(Action.EXECUTE, device, '{}_error_mon'.format(str(device)), Test.remove_monitor), ] def player_teardown(device): if arguments.preserve_player_fs: return teardown(device) else: return clean_player_fs(device) + teardown(device) def recorder_teardown(device): if arguments.preserve_recorder_fs: return teardown(device) + remove_recorded_files_steps(device) else: return clean_recorder_fs(device) + teardown(device) """ def usb_s(device): r = [ Step( Action.EXECUTE, device, None, lambda test, source, data: wait_sec( test, source, data, 5, 'wait sd')), Step( Action.EXECUTE, device, None, lambda test, source, data: mountStart(test, source, data)), ] return r def usb_e(device): r = [ Step(Action.EXECUTE, device, None, lambda test, source, data: mountEnd(test, source, data)), ] return r def dsp_steps(device): r = [ Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp0, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp1, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp2, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), Step( Action.EXECUTE, device, None, lambda test, source, data: cp_file( test, source, data, self.audio_dsp3, 'BIN')), Step(Action.WAIT_FOR, device, 'copied'), ] return r def add_file_to_player(): return [ Step( Action.EXECUTE, player_device, None, lambda test, source, data, : cp_file( test, source, data, os.path.join(os.getcwd(), DATA_PATH, 'input/' + '16340.mp3'), '')), Step(Action.WAIT_FOR, player_device, 'copied'), ] setup = [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] tc_player_16340_recorder_16344 = Test( name='tc_player_16340_recorder_16344', timeout=timeout, setup=setup, # player_verify_setup(player_device, player_reboot_monitor, player_error_monitor) + # recorder_verify_setup(recorder_device, recorder_reboot_monitor, recorder_error_monitor), test=usb_s(recorder_device) + \ dsp_steps(recorder_device) + \ usb_e(recorder_device) + \ usb_s(player_device) + \ dsp_steps(player_device) + \ add_file_to_player() + \ usb_e(player_device) + [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WRITE, player_device, '16340'), #Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), Step(Action.WRITE, recorder_device, '16344'), Step(Action.WAIT_FOR, recorder_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, recorder_device, 'Init Recorder!'), Step(Action.WAIT_FOR, recorder_device, 'Recording Start!'), Step(Action.WAIT_FOR, recorder_device, 'End Recording'), Step(Action.WAIT_FOR, player_device, 'End.'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] + usb_s(recorder_device) + [ Step(Action.EXECUTE, recorder_device, None, lambda test, source, data: mv_file(test, source, data, '16344.mp3', os.path.join(os.getcwd(), DATA_PATH, 'output'),'MP3_48K_STEREO_16BIT.mp3')), Step(Action.WAIT_FOR, recorder_device, 'moved'), Step(Action.WRITE, recorder_device, 'end'), Step(Action.WAIT_FOR, recorder_device, 'Finish USB Mass Storage Operation', lambda test, source, data: verify_recorded_file(test, source, data, 'MP3_48K_STEREO_16BIT.mp3')), Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success'), ], # lambda test, source, data: sz_send_file_from_target(test, source, data)), # Step(Action.WAIT_FOR, recorder_device, # 'Sending file from {}'.format(recorder_device), # lambda test, source, data: rz_receive_file(test, source, data, False)), # Step(Action.WAIT_FOR, recorder_device, 'successfully transferred', # lambda test, source, data: verify_recorded_file(test, source, data)), # Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success', # lambda test, source, data: test.stop()), teardown=[], # player_teardown(player_device) + recorder_teardown(recorder_device) + [ # Step(Action.EXECUTE, recorder_device, None, remove_transferred_file), # ], ) tc_player_16340_recorder_16642 = Test( name='tc_player_16340_recorder_16642', timeout=timeout, setup=setup, test=usb_s(recorder_device) + \ dsp_steps(recorder_device) + \ usb_e(recorder_device) + \ usb_s(player_device) + \ dsp_steps(player_device) + \ add_file_to_player() + \ usb_e(player_device) + [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WRITE, player_device, '16340'), Step(Action.WRITE, recorder_device, '16642'), Step(Action.WAIT_FOR, recorder_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, recorder_device, 'Init Recorder!'), Step(Action.WAIT_FOR, recorder_device, 'Recording Start!'), Step(Action.WAIT_FOR, recorder_device, 'End Recording'), Step(Action.WAIT_FOR, player_device, 'End.'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] + usb_s(recorder_device) + [ Step(Action.EXECUTE, recorder_device, None, lambda test, source, data: mv_file(test, source, data, '16642.mp3', os.path.join(os.getcwd(), DATA_PATH, 'output'), 'MP3_16K_MONO_16BIT.mp3')), Step(Action.WAIT_FOR, recorder_device, 'moved'), Step(Action.WRITE, recorder_device, 'end'), Step(Action.WAIT_FOR, recorder_device, 'Finish USB Mass Storage Operation', lambda test, source, data: verify_recorded_file(test, source, data, 'MP3_16K_MONO_16BIT.mp3')), Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success'), ], teardown=[], ) tc_player_16340_recorder_16643 = Test( name='tc_player_16340_recorder_16643', timeout=timeout, setup=setup, test=usb_s(recorder_device) + \ dsp_steps(recorder_device) + \ usb_e(recorder_device) + \ usb_s(player_device) + \ dsp_steps(player_device) + \ add_file_to_player() + \ usb_e(player_device) + [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WRITE, player_device, '16340'), Step(Action.WRITE, recorder_device, '16643'), Step(Action.WAIT_FOR, recorder_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, recorder_device, 'Init Recorder!'), Step(Action.WAIT_FOR, recorder_device, 'Recording Start!'), Step(Action.WAIT_FOR, recorder_device, 'End Recording'), Step(Action.WAIT_FOR, player_device, 'End.'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] + usb_s(recorder_device) + [ Step(Action.EXECUTE, recorder_device, None, lambda test, source, data: mv_file(test, source, data, '16643.mp3', os.path.join(os.getcwd(), DATA_PATH, 'output'), 'MP3_16K_STEREO_16BIT.mp3')), Step(Action.WAIT_FOR, recorder_device, 'moved'), Step(Action.WRITE, recorder_device, 'end'), Step(Action.WAIT_FOR, recorder_device, 'Finish USB Mass Storage Operation', lambda test, source, data: verify_recorded_file(test, source, data, 'MP3_16K_STEREO_16BIT.mp3')), Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success'), ], teardown=[], ) tc_player_16340_recorder_16644 = Test( name='tc_player_16340_recorder_16644', timeout=timeout, setup=setup, test=usb_s(recorder_device) + \ dsp_steps(recorder_device) + \ usb_e(recorder_device) + \ usb_s(player_device) + \ dsp_steps(player_device) + \ add_file_to_player() + \ usb_e(player_device) + [ Step(Action.WAIT_FOR, player_device, 'Please input cmd'), Step(Action.WRITE, player_device, '16340'), Step(Action.WRITE, recorder_device, '16644'), Step(Action.WAIT_FOR, recorder_device, 'initialization Audio Library'), Step(Action.WAIT_FOR, recorder_device, 'Init Recorder!'), Step(Action.WAIT_FOR, recorder_device, 'Recording Start!'), Step(Action.WAIT_FOR, recorder_device, 'End Recording'), Step(Action.WAIT_FOR, player_device, 'End.'), Step(Action.WAIT_FOR, recorder_device, 'Please input cmd'), ] + usb_s(recorder_device) + [ Step(Action.EXECUTE, recorder_device, None, lambda test, source, data: mv_file(test, source, data, '16644.mp3', os.path.join(os.getcwd(), DATA_PATH, 'output'), 'MP3_48K_MONO_16BIT.mp3')), Step(Action.WAIT_FOR, recorder_device, 'moved'), Step(Action.WRITE, recorder_device, 'end'), Step(Action.WAIT_FOR, recorder_device, 'Finish USB Mass Storage Operation', lambda test, source, data: verify_recorded_file(test, source, data, 'MP3_48K_MONO_16BIT.mp3')), Step(Action.WAIT_FOR, recorder_device, 'Recorded file verification success'), ], teardown=[], ) audio = TestGroup(name='audio', devices=[player_device, recorder_device], tag=[Tag.POSITIVE], tests=[ tc_player_16340_recorder_16344, tc_player_16340_recorder_16642, tc_player_16340_recorder_16643, tc_player_16340_recorder_16644, ]) test_groups = [ audio, ] return test_groups