#11 fix tests in Koji
Merged 8 years ago by jhutar. Opened 8 years ago by dcallagh.
dcallagh/rpmfluff fix-tests  into  master

add some missing BuildRequires
Dan Callaghan • 8 years ago  
handle %{__isa_bits} being undefined
Dan Callaghan • 8 years ago  
file modified
+4 -3
@@ -25,6 +25,7 @@ 

  Summary:        %{summary}

  %{?python_provide:%python_provide python2-%{modname}}

  BuildRequires:  python2-devel

+ BuildRequires:  rpm-python

  Requires:       rpm-build

  Requires:       createrepo_c

  
@@ -36,6 +37,7 @@ 

  Summary:        %{summary}

  %{?python_provide:%python_provide python3-%{modname}}

  BuildRequires:  python3-devel

+ BuildRequires:  rpm-python3

  Requires:       rpm-build

  Requires:       createrepo_c

  
@@ -55,9 +57,8 @@ 

  %py3_install

  

  %check

- # Ignore errors as for now due to https://pagure.io/rpmfluff/issue/7

- python2 %{modname}.py || :

- python3 %{modname}.py || :

+ python2 %{modname}.py

+ python3 %{modname}.py

  

  %files -n python2-%{modname}

  %license LICENSE

file modified
+10 -5
@@ -475,6 +475,11 @@ 

  

  expectedArch = get_expected_arch()

  

+ def can_compile_m32():

+     # 64-bit hosts can compile 32-bit binaries by using -m32, but only if the 

+     # necessary bits are installed (they are often not).

+     return os.path.exists('/usr/include/gnu/stubs-32.h') and os.path.exists('/lib/libgcc_s.so.1')

+ 

  class Trigger:

      def __init__(self, event, triggerConds, script, program=None):

          """For documentation on RPM triggers, see
@@ -1102,7 +1107,7 @@ 

                                 subpackageSuffix=None):

          """Add a simple source file to the sources, build it, and install it somewhere, using the given compilation flags"""

          sourceId = self.add_source(SourceFile(sourceFileName, sourceContent))

-         self.section_build += "%if %{__isa_bits} == 32\n%define mopt -m32\n%endif\n"

+         self.section_build += "%if 0%{?__isa_bits} == 32\n%define mopt -m32\n%endif\n"

          self.section_build += "gcc %%{?mopt} %s %s\n"%(compileFlags, sourceFileName)

          if createParentDirs:

              self.create_parent_dirs(installPath)
@@ -1695,8 +1700,8 @@ 

                                "/usr/bin/perl"))

          self.rpmbuild.make()

  

-     @unittest.skipIf(expectedArch != 'x86_64',

-                      'host arch is not x86_64')

+     @unittest.skipIf(expectedArch != 'x86_64' or not can_compile_m32(),

+                      'host arch is not x86_64 or 32-bit support is missing')

      def test_multiarch_compilation(self):

          """Ensure that building on multiple archs works as expected"""

          self.rpmbuild.buildArchs = ['i386', 'x86_64']
@@ -1844,8 +1849,8 @@ 

          self.assert_is_file(os.path.join(repo.repoDir, 'test-package-devel-0.1-1.%s.rpm' % expectedArch))

          self.assert_is_file(os.path.join(repo.repoDir, 'test-package-python-0.1-1.%s.rpm' % expectedArch))

  

-     @unittest.skipIf(expectedArch != 'x86_64' or not shutil.which("createrepo_c"),

-                      'host arch is not x86_64 or createrepo_c not found in PATH')

+     @unittest.skipIf(expectedArch != 'x86_64' or not can_compile_m32() or not shutil.which("createrepo_c"),

+                      'host arch is not x86_64 or 32-bit support is missing or createrepo_c not found in PATH')

      def test_multiple_arches(self):

          package = SimpleRpmBuild('test-multilib-package', '0.1', '1', ['i386', 'x86_64'])

          repo = YumRepoBuild([package])

no initial comment

Hmm tests still fail on armhfp in Koji though...

======================================================================
ERROR: test_add_patch (__main__.TestSimpleRpmBuild)
Ensure that adding a patch works as expected
----------------------------------------------------------------------
Traceback (most recent call last):
  File "rpmfluff.py", line 1731, in test_add_patch
    self.rpmbuild.make()
  File "rpmfluff.py", line 241, in make
    self.do_make()
  File "rpmfluff.py", line 310, in do_make
    log = check_output(command).splitlines(True)
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['rpmbuild', '--define', '_topdir /builddir/build/BUILD/rpmfluff-0.5.1/test-rpmbuild-test-add-patch-0.1-1', '--define', '_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm', '-ba', '--target', u'arm', 'test-rpmbuild-test-add-patch-0.1-1/test-add-patch.spec']' returned non-zero exit status 1
======================================================================
ERROR: test_debuginfo_generation (__main__.TestSimpleRpmBuild)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "rpmfluff.py", line 1679, in test_debuginfo_generation
    self.rpmbuild.make()
  File "rpmfluff.py", line 241, in make
    self.do_make()
  File "rpmfluff.py", line 310, in do_make
    log = check_output(command).splitlines(True)
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['rpmbuild', '--define', '_topdir /builddir/build/BUILD/rpmfluff-0.5.1/test-rpmbuild-test-debuginfo-generation-0.1-1', '--define', '_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm', '-ba', '--target', u'arm', 'test-rpmbuild-test-debuginfo-generation-0.1-1/test-debuginfo-generation.spec']' returned non-zero exit status 1
======================================================================
ERROR: test_simple_compilation (__main__.TestSimpleRpmBuild)
Ensure that adding a compiled file works as expected
----------------------------------------------------------------------
Traceback (most recent call last):
  File "rpmfluff.py", line 1635, in test_simple_compilation
    self.rpmbuild.make()
  File "rpmfluff.py", line 241, in make
    self.do_make()
  File "rpmfluff.py", line 310, in do_make
    log = check_output(command).splitlines(True)
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['rpmbuild', '--define', '_topdir /builddir/build/BUILD/rpmfluff-0.5.1/test-rpmbuild-test-simple-compilation-0.1-1', '--define', '_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm', '-ba', '--target', u'arm', 'test-rpmbuild-test-simple-compilation-0.1-1/test-simple-compilation.spec']' returned non-zero exit status 1
----------------------------------------------------------------------

Ugh I guess Pagure doesn't support triple backticks for code blocks.

Hmm does armhfp not define %{__isa_bits} perhaps?

3 new commits added

  • add some missing BuildRequires
  • handle %{__isa_bits} being undefined
  • skip multiarch tests if gcc -m32 won't work
8 years ago

Series ending in ac36d4a adds a commit to handle __isa_bits being undefined.

This now gets the tests passing when I do a Koji scratch build with --arch-override=armhfp, although the actual RPM build still fails like this:

    File not found: /builddir/build/BUILDROOT/python-rpmfluff-0.5.1-1.dcallagh.1.fc25.%{_arch}/usr/lib/python2.7/site-packages/rpmfluff.py*

but that seems like either some kind of RPM brokenness, maybe just caused by my usage of --arch-override.

Pull-Request has been merged by jhutar

8 years ago

Thank you very much. This seems very nice.

Metadata