#3 test cases for multilib enhancements
Merged 6 years ago by jhutar. Opened 6 years ago by dcallagh.
dcallagh/rpmfluff multilib-tests  into  master

file modified
+24 -3
@@ -27,6 +27,7 @@ 

  import unittest

  import os

  import os.path

+ import shutil

  import rpm

  #import base64

@@ -1269,7 +1270,6 @@ 

                  "build directory %s already exists" % self.rpmbuild.get_base_dir())


      def tearDown(self):

-         import shutil

          shutil.rmtree(self.rpmbuild.get_base_dir(), ignore_errors=True)


      def test_build(self):
@@ -1681,10 +1681,17 @@ 




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

+                      'host arch is not x86_64')

      def test_multiarch_compilation(self):

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

-         self.rpmbuild.add_simple_compilation()

+         self.rpmbuild.buildArchs = ['i386', 'x86_64']

+         self.rpmbuild.add_simple_compilation(installPath='/usr/bin/program')


+         hdr = self.rpmbuild.get_built_rpm_header('i386')

+         self.assertEqual(1, rpm.files(hdr)['/usr/bin/program'].color)

+         hdr = self.rpmbuild.get_built_rpm_header('x86_64')

+         self.assertEqual(2, rpm.files(hdr)['/usr/bin/program'].color)


      def test_multilib_conflict(self):

          """Ensure that the hooks to create a multilib conflict work as expected"""
@@ -1804,11 +1811,25 @@ 

                  self.assertTrue(len(element) == 1, "Could not find data for type %s" % mdtype)

                  self.assert_is_file(os.path.join(repo.repoDir, element[0].get('href')))


-             import shutil

              shutil.rmtree(repo.repoDir, ignore_errors=True)

              for pkg in repo.rpmBuilds:



+     @unittest.skipIf(expectedArch != 'x86_64' or not os.path.isfile('/usr/bin/createrepo'),

+                      'host arch is not x86_64 or /usr/bin/createrepo not found')

+     def test_multiple_arches(self):

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

+         repo = YumRepoBuild([package])

+         self.addCleanup(shutil.rmtree, package.get_base_dir())

+         self.addCleanup(shutil.rmtree, repo.repoDir)


+         repo.make('i386', 'x86_64')


+         # Check that the repo was built with both the i386 and x86_64 packages

+         self.assert_is_dir(os.path.join(repo.repoDir, 'repodata'))

+         self.assert_is_file(os.path.join(repo.repoDir, 'test-multilib-package-0.1-1.i386.rpm'))

+         self.assert_is_file(os.path.join(repo.repoDir, 'test-multilib-package-0.1-1.x86_64.rpm'))


  if __name__ == "__main__":



Pull-Request has been merged by jhutar

6 years ago

Hello. After I have installed glibc-devel.i686 on my F23@x86_64 I'm getting:

$ python rpmfluff.py TestSimpleRpmBuild.test_multiarch_compilation
+ umask 022
+ cd /home/pok/Checkouts/rpmfluff/test-rpmbuild-test-multiarch-compilation-0.1-1/BUILD
+ cp /home/pok/Checkouts/rpmfluff/test-rpmbuild-test-multiarch-compilation-0.1-1/SOURCES/main.c .
+ exit 0
+ umask 022
+ cd /home/pok/Checkouts/rpmfluff/test-rpmbuild-test-multiarch-compilation-0.1-1/BUILD
+ gcc -m32 main.c
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/5.3.1/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
error: Bad exit status from /var/tmp/rpm-tmp.RVx8Ot (%build)
    Bad exit status from /var/tmp/rpm-tmp.RVx8Ot (%build)
ERROR: test_multiarch_compilation (__main__.TestSimpleRpmBuild)
Ensure that building on multiple archs works as expected
Traceback (most recent call last):
  File "rpmfluff.py", line 1690, in test_multiarch_compilation
  File "rpmfluff.py", line 229, in make
  File "rpmfluff.py", line 297, in do_make
    log = check_output(command).splitlines(True)
  File "/usr/lib64/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['rpmbuild', '--define', '_topdir /home/pok/Checkouts/rpmfluff/test-rpmbuild-test-multiarch-compilation-0.1-1', '-ba', '--target', 'i386', 'test-rpmbuild-test-multiarch-compilation-0.1-1/test-multiarch-compilation.spec']' returned non-zero exit status 1

Ran 1 test in 0.042s

FAILED (errors=1)

Any idea on what I need to install now? I have tried to install gcc.i686 as a blind attempt to get gcc_s, but that conflicts with gcc.x86_64 because of /usr/libexec/getconf/default file and I have no clue if it is a bug or feature.

You want libgcc.i686 I think.

And yes I should have actually made that test skip unless you have all those multilib bits installed. I didn't think of it.

Thank you, that helped! I'll add that as a comment at least to the test case.