Skip to content

Commit 1bc7cb6

Browse files
Run dmesg and coredump commands with silent=True (teemtee#3767)
This is to keep it consistent with avc test check and have less noisy output for users by default, especially from coredump, which prints `err: No match found.` when, it passes by not finding any new coredumps. Co-authored-by: Lukáš Zachar <lzachar@redhat.com>
1 parent 868a8fb commit 1bc7cb6

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

tests/test/check/test-coredump.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ rlJournalStart
6363
assert_check_result "coredump as an after-test should fail" "fail" "after-test" "/coredump/segfault"
6464

6565
# Verify coredump was captured
66-
rlRun find $run/plan/execute/data/guest/default-0/coredump/segfault-1/checks/ -maxdepth 1 \ # grep needed as find returns 0 even without match
67-
\( -name 'dump._usr_bin_bash_SIGSEGV_*.core' -o -name 'dump._usr_bin_sleep_SIGSEGV_*.core' \) -print | grep -q .
66+
rlRun "find $run/plan/execute/data/guest/default-0/coredump/segfault-1/checks/ -maxdepth 1 \
67+
# grep needed as find returns 0 even without match \
68+
\\\( -name 'dump._usr_bin_bash_SIGSEGV_*.core' -o -name 'dump._usr_bin_sleep_SIGSEGV_*.core' \\\) -print | grep -q ."
6869
rlLogInfo "$(ls -l $run/plan/execute/data/guest/default-0/coredump/segfault-1/checks/)"
6970
fi
7071
rlPhaseEnd

tmt/checks/coredump.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ def _configure_coredump(self, guest: "Guest", logger: tmt.log.Logger) -> None:
7878
guest.execute(
7979
ShellScript("mkdir -p /etc/systemd/coredump.conf.d")
8080
& ShellScript(
81-
f"echo '{COREDUMP_CONFIG}' > /etc/systemd/coredump.conf.d/50-tmt.conf"
82-
)
81+
f"echo '{COREDUMP_CONFIG}' > /etc/systemd/coredump.conf.d/50-tmt.conf",
82+
),
83+
silent=True,
8384
)
8485
return
8586
except tmt.utils.RunError:
@@ -93,7 +94,8 @@ def _configure_coredump(self, guest: "Guest", logger: tmt.log.Logger) -> None:
9394
& ShellScript(
9495
f"echo '{COREDUMP_CONFIG}' | sudo tee "
9596
"/etc/systemd/coredump.conf.d/50-tmt.conf > /dev/null"
96-
)
97+
),
98+
silent=True,
9799
)
98100
logger.debug("Configured coredump with sudo")
99101
return
@@ -309,7 +311,7 @@ def _get_crashes(
309311
cmd = f"{sudo_prefix}coredumpctl list --all --no-legend --no-pager"
310312
logger.debug("No prior coredumps found, checking all available coredumps")
311313

312-
output = guest.execute(ShellScript(cmd)).stdout
314+
output = guest.execute(ShellScript(cmd), silent=True).stdout
313315

314316
if not output:
315317
return []

tmt/checks/dmesg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _test_output_logger(
9696
if not guest.facts.is_superuser:
9797
script = tmt.utils.ShellScript(f'sudo {script.to_shell_command()}')
9898

99-
return guest.execute(script, log=_test_output_logger)
99+
return guest.execute(script, log=_test_output_logger, silent=True)
100100

101101
def _save_dmesg(
102102
self, invocation: 'TestInvocation', event: CheckEvent, logger: tmt.log.Logger

0 commit comments

Comments
 (0)