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

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