Tests: metadata-regeneration: restore date at the end of the test
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 18 Apr 2023 18:58:04 +0000 (14:58 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 19 Apr 2023 15:05:31 +0000 (11:05 -0400)
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 <jeremie.galarneau@efficios.com>
Change-Id: I4a128b57d4d9fd61eec097948b688060815f4a4c

tests/destructive/metadata-regeneration

index 7311b3002707c985040d1bd6a40d88f8b26ff85d..048c601b60f06f4f9d0aff58d375c2243e4ddc21 100755 (executable)
@@ -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"
 }
This page took 0.025426 seconds and 4 git commands to generate.