def runTest(args): """ The test program - needs to yield on each expect and be decorated with @inlineCallbacks """ startup = AllOf([Expected(e, "PTP Role: Master", 30) for e in endpoints]) ptpslave = OneOf([ Sequence([Expected(e, "PTP Role: Slave", 5), Expected(e, "PTP sync locked", 1)]) for e in endpoints ]) talker_connections = [ Sequence([Expected(e, "MAAP reserved Talker stream #0 address: 91:E0:F0:0", 30), Expected(e, "CONNECTING Talker stream #0", 10), Expected(e, "Talker stream #0 ready", 10), Expected(e, "Talker stream #0 on", 10)]) for e in endpoints ] listener_connections = [ Sequence([Expected(e, "CONNECTING Listener sink #0", 30), AllOf([Expected(e, "%d -> %d" % (n, n), 10) for n in range(4)]), AllOf([Expected(e, "Media output %d locked" % n, 10) for n in range(4)]), NoneOf([Expected(e, "lost lock", 10)])]) for e in endpoints ] yield master.expect(startup) for name,process in base.getActiveProcesses().iteritems(): process.registerErrorPattern("PTP Role: Master") yield master.expect(AllOf([ptpslave] + talker_connections + listener_connections)) base.testComplete(reactor)
def runTest(args): """ The test program - needs to yield on each expect and be decorated with @inlineCallbacks """ for y in configure_generators(): yield y for y in configure_analyzers(): yield y for y in check_endpoint_startup(): yield y expected = [] for y in action_discover(args, generator.Command("discover"), expected, []): yield y for e in expected: yield args.master.expect(e) expected = [] if not getEntities(): base.testError("no entities found", critical=True) test_num = 1 check_num = 1 for test_step in test_steps: state.move_next_to_current() command = test_step.command print_title("Command %d: %s" % (test_num, command)) test_num += 1 action = command.split(' ') action_function = eval('action_%s' % action[0]) for y in action_function(args, test_step, expected, action[1:]): yield y if test_step.checkpoint or test_step.checkpoint is None: print_title("Check: %d" % check_num) check_num += 1 if expected: yield args.master.expect(AllOf(expected)) expected = [] # Ensure that any remaining output of a previous test step is flushed for process in getActiveProcesses(): master.clearExpectHistory(process) # Allow everything time to settle (in case an error is being generated) yield base.sleep(5) base.testComplete(reactor)
def runTest(args): """ The test program - needs to yield on each expect and be decorated with @inlineCallbacks """ for y in configure_generators(): yield y for y in configure_analyzers(): yield y for y in check_endpoint_startup(): yield y expected = [] for y in action_discover(args, generator.Command("discover"), expected, []): yield y check_num = 1 for test_step in test_steps: print_comment(test_step) state.move_next_to_current() command = test_step.get_command() if command is None: continue action = command.split(' ') action_function = eval('action_%s' % action[0]) expected = [] for y in action_function(args, test_step, expected, action[1:]): yield y if expected: args.master.addExpected(AllOf(expected)) if (test_step.checkpoint or test_step.checkpoint is None) and args.master.nextExpected: print_title("Check: %d" % check_num) check_num += 1 args.master.startNext() yield args.master.expect() # Ensure that any remaining output of a previous test step is flushed for process in getActiveProcesses(): master.clearExpectHistory(process) # Allow everything time to settle (in case an error is being generated) yield base.sleep(5) base.testComplete(reactor)
def runTest(args): """ The test program - needs to yield on each expect and be decorated with @inlineCallbacks """ startup = AllOf([Expected(e, "Started", 10) for e in endpoints]) log_debug(startup) yield master.expect(startup) next_steps = AllOf([AllOf([Expected('ep0', "Next", 10)]), AllOf([Expected('ep1', "Next", 10)])]) log_debug(next_steps) yield master.expect(next_steps) seq = AllOf([Sequence([Expected(e, "Count0", 10), Expected(e, "Count1", 10)]) for e in endpoints]) log_debug(seq) yield master.expect(seq) base.testComplete(reactor)
def runTest(args): master = xmos.test.master.Master() analysis_bin = os.path.join(rootDir, 'sw_audio_analyzer', 'app_audio_analyzer_avb', 'bin', 'audio_analyzer.xe') xrun = xrunProcess(master, args.adapter_id, "xrun", analysis_bin) controller_path = os.path.join(rootDir, 'sw_audio_analyzer', 'host_audio_analyzer') controller_id = 'controller' controller = process.Process(controller_id, master, output_file="controller.log", verbose=True) reactor.spawnProcess(controller, './audio_analyzer', ['./audio_analyzer'], env=os.environ, path=controller_path) # Wait for the controller to have started yield master.expect(Expected(controller_id, "^Starting I2S$", 10)) # Allow time for everything to settle yield base.sleep(5) master.sendLine(controller_id, "d a") yield master.expect(Expected(controller_id, "Channel 0: disabled", 15)) # There needs to be small delays to allow the audio signals to settle, otherwise # spurious glitches are detected. delay = 0.5 test_frequencies = [1000, 2000, 4000, 8000] # Ensure that there is no glitch by default for freq in test_frequencies: master.sendLine(controller_id, "d 0") yield master.expect(Expected(controller_id, "Channel 0: disabled", 15)) yield base.sleep(delay) master.sendLine(controller_id, "c 0 {freq}".format(freq=freq)) yield master.expect(Expected(controller_id, "Generating sine table for chan 0", 15)) yield base.sleep(delay) master.sendLine(controller_id, "e 0") yield master.expect(Sequence([ Expected(controller_id, "Channel 0: enabled", 5), Expected(controller_id, "Channel 0: Signal detected", 10), Expected(controller_id, "Channel 0: Frequency %d" % freq, 5)])) yield master.expect(NoneOf([Expected(controller_id, "ERROR: Channel 0: glitch detected", 30)])) offset = 5000 for freq in test_frequencies: log_info("-----------------") log_info("Test %d Hz" % freq) num_points = int(48000/freq); for period in range(0, num_points): log_info("Test for glitch at %d (%d/%d)" % (freq, period + 1, num_points)) # Disable all channels master.sendLine(controller_id, "d 0") yield master.expect(Expected(controller_id, "Channel 0: disabled", 15)) yield base.sleep(delay) master.sendLine(controller_id, "c 0 {freq} -1 0 {period}".format(freq=freq, period=period+offset)) yield master.expect(Expected(controller_id, "Generating sine table for chan 0", 15)) yield base.sleep(delay) master.sendLine(controller_id, "e 0") yield master.expect(Sequence([ Expected(controller_id, "Channel 0: enabled", 5), Expected(controller_id, "Channel 0: Signal detected", 10), Expected(controller_id, "Channel 0: Frequency %d" % freq, 5)])) yield master.expect(Expected(controller_id, "ERROR: Channel 0: glitch detected", 15)) yield base.sleep(delay) base.testComplete(reactor)