def test_trace_run(): """Test for the TraceAnalyzer class. This group of tests will examine 1, 2, or MAX_NUM_TRACE_SAMPLES samples. No exception should be raised in these cases. For each case, all the methods are tested, and the states of the trace analyzer have been checked. """ ol.download() for num_samples in [1, 2, MAX_NUM_TRACE_SAMPLES]: analyzer = TraceAnalyzer(mb_info) assert analyzer.status == 'RESET' analyzer.setup(num_analyzer_samples=num_samples) assert analyzer.status == 'READY' analyzer.run() analyzer.stop() assert analyzer.status == 'READY' analyzer.analyze(0) analyzer.reset() assert analyzer.status == 'RESET' analyzer.__del__()
def test_trace_max_samples(): """Test for the TraceAnalyzer class. The loop back data tests will be conducted for pattern generator and FSM generator, hence this test only checks basic properties, attributes, etc. for the trace analyzer. The 1st group of tests will examine 0, or (MAX_NUM_TRACE_SAMPLES + 1) samples. An exception should be raised in these cases. """ ol.download() for num_samples in [0, MAX_NUM_TRACE_SAMPLES + 1]: exception_raised = False analyzer = None try: analyzer = TraceAnalyzer(mb_info) analyzer.setup(num_analyzer_samples=num_samples) except ValueError: exception_raised = True finally: analyzer.logictools_controller.reset_buffers() analyzer.__del__() assert exception_raised, \ 'Should raise exception when capturing {} sample(s).'.format( num_samples)