Commit 9b7f82ad authored by Federico Vaga's avatar Federico Vaga

tst: customize dump size on error

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 1f5b7104
......@@ -64,6 +64,8 @@ def pytest_addoption(parser):
parser.addoption("--fd-id", type=lambda x : int(x, 16),
required=True, help="Fmc Fine-Delay Linux Identifier")
parser.addoption("--dump-range", type=int, default=10,
help="Timestamps to show before and after an error")
parser.addoption("--channel", type=int, default=[],
action="append", choices=range(FmcTdc.CHANNEL_NUMBER),
help="Channel(s) to be used for acquisition tests. Default all channels")
......@@ -80,6 +82,7 @@ def pytest_configure(config):
pytest.channels = range(FmcTdc.CHANNEL_NUMBER)
pytest.usr_acq = (config.getoption("--usr-acq-period-ns"),
config.getoption("--usr-acq-count"))
pytest.dump_range = config.getoption("--dump-range")
pytest.transfer_mode = None
with open("/sys/bus/zio/devices/tdc-1n5c-{:04x}/transfer-mode".format(pytest.tdc_id)) as f_mode:
......
......@@ -99,7 +99,7 @@ class TestFmctdcAcquisition(object):
len(ts),
str(prev),
str(ts[i]),
"\n".join([str(x) for x in ts[max(0, i - 10):min(i + 10, len(ts) -1)]]))
"\n".join([str(x) for x in ts[max(0, i - pytest.dump_range):min(i + pytest.dump_range, len(ts) -1)]]))
prev = ts[i]
@pytest.mark.skipif(0 in pytest.usr_acq,
......@@ -149,7 +149,7 @@ class TestFmctdcAcquisition(object):
len(ts),
str(prev),
str(ts[i]),
"\n".join([str(x) for x in ts[max(0, i - 10):min(i + 10, len(ts) -1)]]))
"\n".join([str(x) for x in ts[max(0, i - pytest.dump_range):min(i + pytest.dump_range, len(ts) -1)]]))
prev = ts[i]
pending -= len(ts)
poll.unregister(fmctdc_chan.fileno)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment