Run embedded test suite as a part of the build

Although, %meson_test has been part of the .spec file, the test suite was
not explicitly enabled, and thus it has never run.

Related: #2029425

(cherry picked from Fedora commit cd3085ec58)
This commit is contained in:
Ondrej Holy 2021-12-07 10:32:22 +01:00
parent dab0cacb12
commit 3a73c3159c
2 changed files with 47 additions and 0 deletions

View File

@ -11,6 +11,9 @@ Source0: https://download.gnome.org/sources/gnome-autoar/0.4/gnome-autoar
Patch0: extractor-Fix-extraction-of-raw-format-archives.patch
Patch1: extractor-Fix-extraction-to-root-directory.patch
# https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/34
Patch2: tests-Do-not-left-read-only-directory-in-the-tree.patch
BuildRequires: gcc
BuildRequires: meson
BuildRequires: gtk-doc
@ -42,6 +45,7 @@ developing applications that use %{name}.
%build
%meson -Dvapi=true \
-Dgtk_doc=true \
-Dtests=true \
%{nil}
%meson_build
@ -82,6 +86,7 @@ developing applications that use %{name}.
%changelog
* Tue Dec 07 2021 Ondrej Holy <oholy@redhat.com> - 0.4.1-2
- Fix extraction of raw format archives
- Run embedded test suite as a part of the build
* Mon Nov 01 2021 Kalev Lember <klember@redhat.com> - 0.4.1-1
- Update to 0.4.1

View File

@ -0,0 +1,42 @@
From 0f528ab688d4b01c51c0d33c3893854aae3d80ac Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Tue, 30 Nov 2021 10:53:22 +0100
Subject: [PATCH] tests: Do not left read-only directory in the tree
Currently, various tools fail to remove the read-only directory, which
is created as an output from the test suite. This for example breaks
package building when tests are enabled. Let's make it writable again
when test is done to fix the issue.
Fixes: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/34
---
tests/test-extract-unit.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/test-extract-unit.c b/tests/test-extract-unit.c
index 615ba22..5965f48 100644
--- a/tests/test-extract-unit.c
+++ b/tests/test-extract-unit.c
@@ -1264,6 +1264,7 @@ test_readonly_directory (void)
g_autoptr (ExtractTest) extract_test = NULL;
g_autoptr (ExtractTestData) data = NULL;
g_autoptr (GFile) archive = NULL;
+ g_autoptr (GFile) readonly = NULL;
g_autoptr (AutoarExtractor) extractor = NULL;
extract_test = extract_test_new ("test-readonly-directory");
@@ -1285,6 +1286,11 @@ test_readonly_directory (void)
g_assert_no_error (data->error);
g_assert_true (data->completed_signalled);
assert_reference_and_output_match (extract_test);
+
+ /* Make the directory writable again to avoid issues when deleting. */
+ readonly = g_file_get_child (extract_test->output, "arextract");
+ g_file_set_attribute_uint32 (readonly, G_FILE_ATTRIBUTE_UNIX_MODE, 0755,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
}
static void
--
2.33.1