Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package flashrom for openSUSE:Factory 
checked in at 2026-12-03 13:59:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/flashrom (Old)
 and      /work/SRC/openSUSE:Factory/.flashrom.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "flashrom"

Thu Dec  3 13:59:30 2026 rev:36 rq:1402632 version:1.8.0+git0.90b6b437

Changes:
--------
--- /work/SRC/openSUSE:Factory/flashrom/flashrom.changes        2026-09-08 
16:59:39.438846032 +0200
+++ /work/SRC/openSUSE:Factory/.flashrom.new.1340718/flashrom.changes   
2026-12-03 14:02:30.960473877 +0100
@@ -1,0 +2,14 @@
+Wed Dec  2 07:59:34 UTC 2026 - Zoltan Balogh <[email protected]>
+
+- Add flashrom-tests-fix-bad-chip-scope.patch so the bad-chip tests
+  keep their mock chip alive on aarch64.
+
+-------------------------------------------------------------------
+Wed Dec  2 07:42:27 UTC 2026 - Zoltan Balogh <[email protected]>
+
+- Enable the upstream unit tests: build with -Dtests=enabled and
+  run them with %meson_test.
+- Add flashrom-tests-disable-lto.patch, the cmocka tests use
+  linker wrappers and fail with -flto.
+
+-------------------------------------------------------------------

New:
----
  flashrom-tests-disable-lto.patch
  flashrom-tests-fix-bad-chip-scope.patch

----------(New B)----------
  New:  run them with %meson_test.
- Add flashrom-tests-disable-lto.patch, the cmocka tests use
  linker wrappers and fail with -flto.
  New:
- Add flashrom-tests-fix-bad-chip-scope.patch so the bad-chip tests
  keep their mock chip alive on aarch64.
----------(New E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ flashrom.spec ++++++
--- /var/tmp/diff_new_pack.VQvHSI/_old  2026-12-03 14:02:32.028519097 +0100
+++ /var/tmp/diff_new_pack.VQvHSI/_new  2026-12-03 14:02:32.030519182 +0100
@@ -24,6 +24,11 @@
 Group:          Development/Tools/Other
 URL:            https://www.flashrom.org/
 Source0:        %{name}-%{version}.tar.xz
+Patch0:         flashrom-tests-disable-lto.patch
+# Backport of upstream commit
+# 0a5d23d4b8c7cd090eefdf39ebfe1d9a7360c386
+# "tests/chip: Move the mock chip for bad status tests to the caller".
+Patch1:         flashrom-tests-fix-bad-chip-scope.patch
 BuildRequires:  git
 BuildRequires:  meson >= 0.56.0
 BuildRequires:  pkgconfig
@@ -101,7 +106,7 @@
 
 %build
 %meson \
-    -Dtests=disabled -Dgenerate_authors_list=disabled
+    -Dtests=enabled -Dgenerate_authors_list=disabled
 %meson_build
 
 %install
@@ -109,6 +114,9 @@
 rm %{buildroot}%{_libdir}/libflashrom.a
 rm %{buildroot}%{_datadir}/doc/%{name}/html/.buildinfo
 
+%check
+%meson_test --verbose
+
 %post -n libflashrom1 -p /sbin/ldconfig
 %postun -n libflashrom1 -p /sbin/ldconfig
 

++++++ flashrom-tests-disable-lto.patch ++++++
Disable LTO for the unit test executable.

The cmocka tests mock internal functions with the linker --wrap
option. With -flto the compiler resolves these calls before the final
link, so the wrappers are bypassed and default_spi_read_test_success
recurses endlessly. The test binaries are not installed, so building
them without LTO does not affect the shipped package.

--- a/tests/meson.build
+++ b/tests/meson.build
@@ -126,9 +126,10 @@
     '-fdata-sections',
     '-U_FORTIFY_SOURCE',
     '-DFLASHROM_TEST',
+    '-fno-lto',
   ],
   export_dynamic : true,
-  link_args : mocks + link_args,
+  link_args : mocks + link_args + ['-fno-lto'],
   dependencies : [cmocka_dep, flashrom_test_dep, threads_dep],
 )
 test('cmocka test flashrom', flashrom_tests)

++++++ flashrom-tests-fix-bad-chip-scope.patch ++++++
Keep the bad-chip mock alive for the whole test.

setup_bad_chip() created the mock chip as a local variable and stored a
pointer to it in the flash context. The pointer dangled after the
helper returned, so read_chip_bad_status_test and
write_chip_bad_status_test read freed stack memory on aarch64 and
failed instead of returning ERROR_FLASHROM_PREPARE_FLASH_ACCESS. Let
the caller own the mock, as in current upstream.

--- a/tests/chip.c
+++ b/tests/chip.c
@@ -772,7 +772,7 @@
        free(newcontents);
 }
 
-static void setup_bad_chip(struct flashrom_flashctx *flashctx)
+static void setup_bad_chip(struct flashrom_flashctx *flashctx, struct 
flashchip *mock_chip)
 {
        /* This test injectors are not expected to be called, because the
         * chip has known bad test status and chip_safety_check should fail
@@ -781,10 +781,9 @@
        g_test_read_injector = NULL;
        g_test_erase_injector[0] = NULL;
 
-       struct flashchip mock_chip = chip_bad;
        const char *param = ""; /* Default values for all params. */
 
-       setup_chip(flashctx, &mock_chip, param, NULL);
+       setup_chip(flashctx, mock_chip, param, NULL);
 }
 
 void erase_chip_bad_status_test(void **state)
@@ -792,7 +791,8 @@
        (void) state; /* unused */
 
        struct flashrom_flashctx flashctx = {0};
-       setup_bad_chip(&flashctx);
+       struct flashchip mock_chip = chip_bad;
+       setup_bad_chip(&flashctx, &mock_chip);
 
        printf("flashrom_flash_erase called: ");
        assert_int_equal(ERROR_FLASHROM_PREPARE_FLASH_ACCESS, 
flashrom_flash_erase(&flashctx));
@@ -806,7 +806,8 @@
        (void) state; /* unused */
 
        struct flashrom_flashctx flashctx = {0};
-       setup_bad_chip(&flashctx);
+       struct flashchip mock_chip = chip_bad;
+       setup_bad_chip(&flashctx, &mock_chip);
 
        unsigned long size = chip_bad.total_size * 1024;
        unsigned char *buf = calloc(size, sizeof(unsigned char));
@@ -827,7 +828,8 @@
        (void) state; /* unused */
 
        struct flashrom_flashctx flashctx = {0};
-       setup_bad_chip(&flashctx);
+       struct flashchip mock_chip = chip_bad;
+       setup_bad_chip(&flashctx, &mock_chip);
 
        unsigned long size = chip_bad.total_size * 1024;
        uint8_t *const newcontents = malloc(size);

Reply via email to