From 81efe7427b2a0166558c676549d98c8b51b738ed Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Mon, 14 Apr 2025 11:39:12 +0200 Subject: [PATCH] Don't mangle the shebangs of test files Shebangs are mangled from #!/bin/bash to #!/usr/bin/bash, which causes the change in data_offset calculated in tests, resulting in a test_zipfile failure: FAIL: test_data_offset_with_exe_prepended (test.test_zipfile.test_core.TestDataOffsetPrependedZip.test_data_offset_with_exe_prepended) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib64/python3.14/test/test_zipfile/test_core.py", line 3431, in test_data_offset_with_exe_prepended self._test_data_offset(self.exe_zip) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/test/test_zipfile/test_core.py", line 3428, in _test_data_offset self.assertEqual(zipfp.data_offset, 713) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 717 != 713 --- python3.14.spec | 4 ++++ tests/tests.yml | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/python3.14.spec b/python3.14.spec index ac88f05..818289a 100644 --- a/python3.14.spec +++ b/python3.14.spec @@ -209,6 +209,10 @@ Provides: bundled(python3dist(packaging)) = 24 # Remove the default -O2 flag, our flags are applied in %%build/%%install %global __global_compiler_flags %(echo '%{__global_compiler_flags}' | sed 's/-O[[:digit:]]//') +# Changing the shebangs of the test files confuses the tests which count with a specific data offset +# We can't remove the executable bit, the files are run directly in other tests +%global __brp_mangle_shebangs_exclude_from ^%{pylibdir}/test/archivetestdata/exe_with_.*$ + # Disable automatic bytecompilation. The python3 binary is not yet be # available in /usr/bin when Python is built. Also, the bytecompilation fails # on files that test invalid syntax. diff --git a/tests/tests.yml b/tests/tests.yml index 8db7040..b1255ce 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -30,12 +30,11 @@ run: "PYTHON=python{{ pybasever }}d TOX=false VERSION={{ pybasever }} CYTHON=false ./venv.sh" - selftest: dir: python/selftest - # test_data_offset_with_exe_prepended and test_data_offset_with_exe_prepended_zip64: https://github.com/python/cpython/issues/84481 - run: "VERSION={{ pybasever }} X='-i test_check_probes -i test_sysconfigdata_json -i test_data_offset_with_exe_prepended -i test_data_offset_with_exe_prepended_zip64' ./parallel.sh" + run: "VERSION={{ pybasever }} X='-i test_check_probes -i test_sysconfigdata_json' ./parallel.sh" - debugtest: dir: python/selftest # test_base_interpreter: https://github.com/python/cpython/issues/131372 - run: "VERSION={{ pybasever }} PYTHON=python{{ pybasever }}d X='-i test_check_probes -i test_sysconfigdata_json -i test_base_interpreter -i test_data_offset_with_exe_prepended -i test_data_offset_with_exe_prepended_zip64' ./parallel.sh" + run: "VERSION={{ pybasever }} PYTHON=python{{ pybasever }}d X='-i test_check_probes -i test_sysconfigdata_json -i test_base_interpreter' ./parallel.sh" - optimizedflags: dir: python/flags run: "python{{ pybasever }} ./assertflags.py -O3 CFLAGS PY_BUILTIN_MODULE_CFLAGS PY_CFLAGS PY_CORE_CFLAGS PY_CFLAGS_NODIST PY_STDMODULE_CFLAGS"