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

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