Blame SOURCES/openscap-1.3.7-PR-1843-fix-test-ds-misc.patch

ac15c6
From e49669a0dde7e3a9123925347fbf3234602371ee Mon Sep 17 00:00:00 2001
ac15c6
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
ac15c6
Date: Mon, 31 Jan 2022 13:45:15 +0100
ac15c6
Subject: [PATCH] Prevent fails of test_ds_misc.sh
ac15c6
ac15c6
The SOURCE_DATE_EPOCH environment variable is effective only when it's
ac15c6
set to a value that's older than mtime of the processed file.  See the
ac15c6
implementation in ds_sds_compose_add_component_internal in src/DS/sds.c.
ac15c6
However, the file in our test suite has originally been created before
ac15c6
(in 2019) and this mtime can be used when a tarball is produced. To
ac15c6
avoid the test failing, we can modify the mtime using the touch command
ac15c6
just before we run the tests.
ac15c6
---
ac15c6
 tests/DS/test_ds_misc.sh | 2 ++
ac15c6
 1 file changed, 2 insertions(+)
ac15c6
ac15c6
diff --git a/tests/DS/test_ds_misc.sh b/tests/DS/test_ds_misc.sh
ac15c6
index 159007518..cffbef303 100755
ac15c6
--- a/tests/DS/test_ds_misc.sh
ac15c6
+++ b/tests/DS/test_ds_misc.sh
ac15c6
@@ -269,6 +269,8 @@ function test_source_date_epoch() {
ac15c6
 	local timestamp="2020-03-05T12:09:37"
ac15c6
 	export SOURCE_DATE_EPOCH="1583410177"
ac15c6
 	export TZ=UTC
ac15c6
+	# ensure the file mtime is always newer than the $timestamp
ac15c6
+	touch -c "$xccdf"
ac15c6
 	$OSCAP ds sds-compose "$xccdf" "$result"
ac15c6
 	assert_exists 3 '//ds:component[@timestamp="'$timestamp'"]'
ac15c6
 	rm -f "$result"
ac15c6
-- 
ac15c6
2.34.1
ac15c6