mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-02 08:00:41 +02:00
minor changes that got lost in the merge of automate_version_part 2 PR
This commit is contained in:
parent
f40dc00757
commit
35bc4b9c92
@ -48,16 +48,14 @@ def startFrameSynchronizer(num_mods, fp):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def acquire(fp):
|
def acquire(fp, det):
|
||||||
Log(LogLevel.INFO, 'Acquiring')
|
Log(LogLevel.INFO, 'Acquiring')
|
||||||
Log(LogLevel.INFO, 'Acquiring', fp)
|
Log(LogLevel.INFO, 'Acquiring', fp)
|
||||||
d = Detector()
|
det.acquire()
|
||||||
d.acquire()
|
|
||||||
|
|
||||||
|
|
||||||
def testFramesCaught(name, num_frames):
|
def testFramesCaught(name, det, num_frames):
|
||||||
d = Detector()
|
fnum = det.rx_framescaught[0]
|
||||||
fnum = d.rx_framescaught[0]
|
|
||||||
if fnum != num_frames:
|
if fnum != num_frames:
|
||||||
raise RuntimeException(f"{name} caught only {fnum}. Expected {num_frames}")
|
raise RuntimeException(f"{name} caught only {fnum}. Expected {num_frames}")
|
||||||
|
|
||||||
@ -65,7 +63,7 @@ def testFramesCaught(name, num_frames):
|
|||||||
Log(LogLevel.INFOGREEN, f'Frames caught test passed for {name}', fp)
|
Log(LogLevel.INFOGREEN, f'Frames caught test passed for {name}', fp)
|
||||||
|
|
||||||
|
|
||||||
def testZmqHeadetTypeCount(name, num_mods, num_frames, fp):
|
def testZmqHeadetTypeCount(name, det, num_mods, num_frames, fp):
|
||||||
|
|
||||||
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}")
|
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}")
|
||||||
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}", fp)
|
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}", fp)
|
||||||
@ -92,8 +90,7 @@ def testZmqHeadetTypeCount(name, num_mods, num_frames, fp):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# test if file contents matches expected counts
|
# test if file contents matches expected counts
|
||||||
d = Detector()
|
num_ports_per_module = 1 if name == "gotthard2" else det.numinterfaces
|
||||||
num_ports_per_module = 1 if name == "gotthard2" else d.numinterfaces
|
|
||||||
total_num_frame_parts = num_ports_per_module * num_mods * num_frames
|
total_num_frame_parts = num_ports_per_module * num_mods * num_frames
|
||||||
for htype, expected_count in [("header", num_mods), ("series_end", num_mods), ("module", total_num_frame_parts)]:
|
for htype, expected_count in [("header", num_mods), ("series_end", num_mods), ("module", total_num_frame_parts)]:
|
||||||
if htype_counts[htype] != expected_count:
|
if htype_counts[htype] != expected_count:
|
||||||
@ -115,10 +112,10 @@ def startTestsForAll(args, fp):
|
|||||||
startDetectorVirtualServer(server, args.num_mods, fp)
|
startDetectorVirtualServer(server, args.num_mods, fp)
|
||||||
startFrameSynchronizerPullSocket(server, fp)
|
startFrameSynchronizerPullSocket(server, fp)
|
||||||
startFrameSynchronizer(args.num_mods, fp)
|
startFrameSynchronizer(args.num_mods, fp)
|
||||||
loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=args.num_mods, num_frames=args.num_frames)
|
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=args.num_mods, num_frames=args.num_frames)
|
||||||
acquire(fp)
|
acquire(fp, d)
|
||||||
testFramesCaught(server, args.num_frames)
|
testFramesCaught(server, d, args.num_frames)
|
||||||
testZmqHeadetTypeCount(server, args.num_mods, args.num_frames, fp)
|
testZmqHeadetTypeCount(server, d, args.num_mods, args.num_frames, fp)
|
||||||
Log(LogLevel.INFO, '\n')
|
Log(LogLevel.INFO, '\n')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeException(f'Synchronizer Tests failed') from e
|
raise RuntimeException(f'Synchronizer Tests failed') from e
|
||||||
|
@ -156,7 +156,7 @@ def startDetectorVirtualServer(name :str, num_mods, fp):
|
|||||||
for i in range(num_mods):
|
for i in range(num_mods):
|
||||||
port_no = SERVER_START_PORTNO + (i * 2)
|
port_no = SERVER_START_PORTNO + (i * 2)
|
||||||
cmd = [name + 'DetectorServer_virtual', '-p', str(port_no)]
|
cmd = [name + 'DetectorServer_virtual', '-p', str(port_no)]
|
||||||
startProcessInBackground(cmd, fp)
|
startProcessInBackgroundWithLogFile(cmd, fp, "/tmp/virtual_det_" + name + str(i) + ".txt")
|
||||||
match name:
|
match name:
|
||||||
case 'jungfrau':
|
case 'jungfrau':
|
||||||
time.sleep(7)
|
time.sleep(7)
|
||||||
@ -217,6 +217,8 @@ def loadConfig(name, rx_hostname, settingsdir, fp, num_mods = 1, num_frames = 1)
|
|||||||
d.frames = num_frames
|
d.frames = num_frames
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
|
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
|
||||||
|
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
def ParseArguments(description, default_num_mods=1):
|
def ParseArguments(description, default_num_mods=1):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user