From Fedora Project Wiki

Prerequisite(s)

Testing non-graphical packages with mock

The situation may arise when you want to test a package without having it installed on your main system or for a different release than what you're running.

Advantages

  • You can test packages without polluting your main system.
  • You can test packages for different releases than your running (rawhide?) without use of bare metal or virtual machines.

Disadvantages

  • Regardless of the release your testing, you're still using the kernel version of the host.

Procedure

There's three basic steps involved:

1. Initialize a chroot with mock for the release you want to test with.

mock -r fedora-<release>-<arch> --init

example:

mock -r fedora-rawhide-x86_64 --init


2. Install the test package and any additional packages you need.

mock -r fedora-<release>-<arch> --install <package(s)>

example:

mock -r fedora-rawhide-x86_64 --install libfoo rpmlint vi less python


3. Go into the mock shell and perform the tests.

mock -r fedora-<release>-<arch> --shell

example:

mock -r fedora-rawhide-x86_64 --shell
<mock-chroot> rpmlint libfoo

Testing graphical packages with mock and Xnest

It is also possible to test graphical programs with the addition of Xnest. It's subject to the same advantages and disadvantages with the following addition. The package will be using the X server of the host and not of the release being tested which could make reproducing an error problematic depending on the source of the problem.

Additionally, it is possible to test packages remotely over X11 forwarding, or even from Windows machines using Cygwin

Procedure

In addition to the above steps, you need to setup Xnest.

Xnest :<display #> -ac &

example using xclock: (assuming the mock chroot has already been initialized)

mock -r fedora-rawhide-x86_64 --install xclock
Xnest :1 -ac &
mock -r fedora-rawhide-x86_64 --shell
<mock-chroot> xclock -display :1