util-linux/tests/ts/misc/lsclocks
Thomas Weißschuh e9ddea7912 lsclocks: new util to interact with system clocks
Usecases:
* Compare current monotonic time to timestamps reported by systemd
* Validate time namespace operations
* Inspect clock resolutions

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-30 14:12:48 +02:00

42 lines
1 KiB
Bash
Executable file

#!/bin/bash
# Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de>
#
# This file is part of util-linux.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
TS_TOPDIR="${0%/*}/../.."
TS_DESC="lsclocks"
. "$TS_TOPDIR"/functions.sh
ts_init "$*"
ts_check_test_command "$TS_CMD_LSCLOCKS"
ts_check_prog sed
mask_timestamps() {
sed 's/[0-9]\+\.[0-9]\+/X.X/g'
}
ts_init_subtest basic
"$TS_CMD_LSCLOCKS" -o ID,CLOCK,NAME > "$TS_OUTPUT" 2>> "$TS_ERRLOG"
ts_finalize_subtest
ts_init_subtest time
"$TS_CMD_LSCLOCKS" --time monotonic | mask_timestamps > "$TS_OUTPUT" 2>> "$TS_ERRLOG"
ts_finalize_subtest
ts_finalize