Skip to content

Commit 1f296b9

Browse files
yzheng6GitHub Enterprise
authored andcommitted
Fix race condition in logging when calling tx and rx beamformer tests (#839)
The same log handler name was used in both tx and rx beamformer tests, resulting in race condition when generating the log.
1 parent b0a07ac commit 1f296b9

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tools/imagesets/imgset.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -468,15 +468,18 @@ def beamformtest(self, tests=None):
468468
testdir = os.path.abspath(pjoin(self.testdir, testname))
469469
os.makedirs(pjoin(testdir, f"output_beamform"), exist_ok=True)
470470
log = pjoin(testdir, f"output_beamform", "stdouterr.log")
471-
for btype, copt in [("tx", ""), ("rx", f"-c input_{dataname[0]}/{dataname[3]}")]:
472-
cmd = [f"""time beamform_{btype}.py -i input_{dataname[0]}/{dataname[1]} \
473-
-a input_{dataname[0]}/{dataname[2]} {copt} \
474-
-o output_beamform/beamform_{btype}_output.txt"""]
475-
try:
476-
self.distribrun(testdir, cmd, logfile=log, dataname=dataname[0], nisarimg=True,
477-
loghdlrname=f"wftest.{os.path.basename(testdir)}")
478-
except subprocess.CalledProcessError as e:
479-
raise RuntimeError(f"CalTool beamformer tool test {testname} failed") from e
471+
cmd = [f"""time beamform_tx.py -i input_{dataname[0]}/{dataname[1]} \
472+
-a input_{dataname[0]}/{dataname[2]} \
473+
-o output_beamform/beamform_tx_output.txt""",
474+
f"""time beamform_rx.py -i input_{dataname[0]}/{dataname[1]} \
475+
-a input_{dataname[0]}/{dataname[2]} \
476+
-c input_{dataname[0]}/{dataname[3]} \
477+
-o output_beamform/beamform_rx_output.txt"""]
478+
try:
479+
self.distribrun(testdir, cmd, logfile=log, dataname=dataname[0], nisarimg=True,
480+
loghdlrname=f"wftest.{os.path.basename(testdir)}")
481+
except subprocess.CalledProcessError as e:
482+
raise RuntimeError(f"CalTool beamformer tool test {testname} failed") from e
480483

481484
def mintests(self):
482485
"""

0 commit comments

Comments
 (0)