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

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