From: Jérémie Galarneau Date: Tue, 18 Apr 2023 18:58:04 +0000 (-0400) Subject: Tests: metadata-regeneration: restore date at the end of the test X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a99a847c47f9cdbc329b6e87cccfafe94d34091f;p=lttng-tools.git Tests: metadata-regeneration: restore date at the end of the test The metadata-regeneration test sets the date is the past to validate that the clock offset is re-computed when regenerating a trace's metadata. In doing so, it leaves the time in the past which causes 'make' to panic when it checks for changes while continuing to evaluate the 'check' target. make[4]: Entering directory '/root/workspace/lttng-tools_master_rootbuild_i386/babeltrace_version/stable-2.0/build/std/conf/agents/liburcu_version/master/node/i386-rootnode/platform/deb11-i386/test_type/base/src/lttng-tools/tests/perf' make[4]: Warning: File '.deps/find_event.Po' has modification time 1363500490 s in the future ============================================================================ Testsuite summary for lttng-tools 2.14.0-pre ============================================================================ # TOTAL: 0 # PASS: 0 # SKIP: 0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ make[4]: warning: Clock skew detected. Your build may be incomplete. make[4]: Leaving directory '/root/workspace/lttng-tools_master_rootbuild_i386/babeltrace_version/stable-2.0/build/std/conf/agents/liburcu_version/master/node/i386-rootnode/platform/deb11-i386/test_type/base/src/lttng-tools/tests/perf' make[3]: warning: Clock skew detected. Your build may be incomplete. make[3]: Leaving directory '/root/workspace/lttng-tools_master_rootbuild_i386/babeltrace_version/stable-2.0/build/std/conf/agents/liburcu_version/master/node/i386-rootnode/platform/deb11-i386/test_type/base/src/lttng-tools/tests/perf' make[2]: warning: Clock skew detected. Your build may be incomplete. make[2]: Leaving directory '/root/workspace/lttng-tools_master_rootbuild_i386/babeltrace_version/stable-2.0/build/std/conf/agents/liburcu_version/master/node/i386-rootnode/platform/deb11-i386/test_type/base/src/lttng-tools/tests/perf' make[1]: *** [Makefile:557: check-recursive] Error 1 The date is sampled at the beginning of the test and restored when it ends. This leaves the system with a wrong time (offset by the duration of the test itself). Still, its better than being 40 years in the past. Signed-off-by: Jérémie Galarneau Change-Id: I4a128b57d4d9fd61eec097948b688060815f4a4c --- diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration index 7311b3002..048c601b6 100755 --- a/tests/destructive/metadata-regeneration +++ b/tests/destructive/metadata-regeneration @@ -204,6 +204,7 @@ fi skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || { + original_date=$(date) start_lttng_relayd "-o $TRACE_PATH" start_lttng_sessiond @@ -217,4 +218,11 @@ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || stop_lttng_sessiond stop_lttng_relayd + + # This set of test sets the date in the past which causes + # `make` to panic when it sees files created in the "future" + # while running the "check" target. Obviously this doesn't set + # the correct date, but at least its close enough to allow the + # test suite to continue. + date --set "$original_date" }