Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZTS: include microsecond timestamps on all output #17045

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/test-runner/bin/test-runner.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# Copyright (c) 2012, 2018 by Delphix. All rights reserved.
# Copyright (c) 2019 Datto Inc.
# Copyright (c) 2025, Klara, Inc.
#
# This script must remain compatible with Python 3.6+.
#
Expand Down Expand Up @@ -363,6 +364,8 @@ User: %s
stdout/stderr/merged in its own file.
"""

timeprefix = datetime.now().strftime('[%FT%T.%f] ')

logname = getpwuid(os.getuid()).pw_name
rer = ''
if self.reran is True:
Expand All @@ -374,7 +377,7 @@ User: %s
msga = 'Test: %s%s ' % (self.pathname, user)
msgb = '[%s] [%s]%s\n' % (self.result.runtime, self.result.result, rer)
pad = ' ' * (80 - (len(msga) + len(msgb)))
result_line = msga + pad + msgb
result_line = timeprefix + msga + pad + msgb

# The result line is always written to the log file. If -q was
# specified only failures are written to the console, otherwise
Expand Down
3 changes: 2 additions & 1 deletion tests/test-runner/include/logapi.shlib
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# Use is subject to license terms.
#
# Copyright (c) 2012, 2020 by Delphix. All rights reserved.
# Copyright (c) 2025, Klara, Inc.
#

STF_PASS=0
Expand Down Expand Up @@ -464,7 +465,7 @@ function _endlog

function _printline
{
echo "$@"
printf '[%(%FT%T.%6N)T] %s\n' now "$*"
}

# Output an error message
Expand Down
7 changes: 6 additions & 1 deletion tests/zfs-tests/callbacks/zfs_dmesg.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# Copyright (c) 2016 by Delphix. All rights reserved.
# Copyright (c) 2017 Lawrence Livermore National Security, LLC.
# Copyright (c) 2025, Klara, Inc.
#

# $1: number of lines to output (default: 200)
Expand All @@ -24,7 +25,11 @@ echo " Tailing last $lines lines of dmesg log"
echo "================================================================="

# report and reset afterwards
sudo dmesg -c | tail -n $lines
dmesg_args="-c"
if [[ $(uname) = "Linux" ]] ; then
dmesg_args="$dmesg_args --time-format=iso"
fi
sudo dmesg $dmesg_args | tail -n $lines

echo "================================================================="
echo " End of dmesg log"
Expand Down