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

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