Skip to content

Commit

Permalink
smbtorture: print output for all results
Browse files Browse the repository at this point in the history
At the moment we print output only in cases of failure. Change this to
output for all results.

Signed-off-by: Sachin Prabhu <[email protected]>
  • Loading branch information
spuiuk committed Nov 17, 2023
1 parent 2816a61 commit 8764af1
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions testcases/smbtorture/test_smbtorture.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
test_info_file = os.getenv("TEST_INFO_FILE")
test_info = testhelper.read_yaml(test_info_file)

# Temp filename containing the output of run commands.
output = testhelper.get_tmp_file()


def smbtorture(share_name: str, test: str, tmp_output: Path) -> bool:
# build smbtorture command
Expand Down Expand Up @@ -93,22 +90,19 @@ def smbtorture(share_name: str, test: str, tmp_output: Path) -> bool:
universal_newlines=True,
)

# Error - Print out the debugging data for this smbtorture run
if format_subunitc.returncode != 0:
# print the commands as they will be run.
cmd = "%s|%s|%s" % (
" ".join(smbtorture_cmd),
" ".join(filter_subunit_cmd),
" ".join(format_subunit_cmd),
)
print("Command: " + cmd + "\n\n")
# Print the intermediate output
with open(tmp_output, "r") as filter_subunit_stdout:
print(filter_subunit_stdout.read())
print("\n" + format_subunitc.stdout)
return False
# print the commands as they will be run.
cmd = "%s|%s|%s" % (
" ".join(smbtorture_cmd),
" ".join(filter_subunit_cmd),
" ".join(format_subunit_cmd),
)
print("Command: " + cmd + "\n\n")
# Print the intermediate output
with open(tmp_output, "r") as filter_subunit_stdout:
print(filter_subunit_stdout.read())
print("\n" + format_subunitc.stdout)

return True
return format_subunitc.returncode == 0


def list_smbtorture_tests():
Expand All @@ -128,6 +122,7 @@ def generate_smbtorture_tests() -> typing.List[typing.Tuple[str, str]]:

@pytest.mark.parametrize("share_name,test", generate_smbtorture_tests())
def test_smbtorture(share_name: str, test: str) -> None:
output = testhelper.get_tmp_file()
ret = smbtorture(share_name, test, output)
if os.path.exists(output):
os.unlink(output)
Expand Down

0 comments on commit 8764af1

Please sign in to comment.