[QBS] Autotest runner and Qt plugin path

Ch'Gans chgans at gna.org
Sun Jun 19 09:23:04 CEST 2016


Hi there,

I'm using the Autorunner for my project to run my automated unit tests.
I am using multi QBS profile  (Qt version/toolchains) with no default profile.

When using QtCreator on my dev machine to run my autotests everything
is fine, when using qbs command line within my CI system the tests
fail because of the app being unable unable to find the required Qt
Plugins.
My command looks like: qbs build -p autotest-runner profile:qt57-lnxgcc53_64

One way to solve this on CI is to export QT_QPA_PLATFORM_PLUGIN_PATH
in the shell before running Qbs, something I don't want to do since
the plugin path depends on the profile and i want to use a clean and
predictable shell env. (Note: exporting QTDIR didn't do the trick)

I have tried to use 'qbs.setupBuildEnvironment: {
Environment.putEnv('QT_QPA_PLATFORM_PLUGIN_PATH', Qt.core.pluginPath);
}' inside my product definition, but then Qbs complains that it cannot
find the variable 'Qt'.

Ideally i would like a simple solution that work out of the box. I
don't want to go with qt.conf or the likes.

So my question is: What is the best way to build/setup my
autotest-runner environment so that it can load Qt plugins correctly?

Notes:
* CI doesn't have an XServer runniing, so i'm trying to use the
'offscreen' platform plugin, anyway this is not the source of my
problem, since by default the testapp try to load xcb and it doesn't
work for the reason explained above
* my test application's rpath contains
"/path/to/qt/unifed/5.X/gcc_64/lib" where 5.X correspond to the Qt
version defined for the Qbs profile in use.
 * For now I'm only dealing with Linux, but later I would like to exec
my tests on Windows, and eventually on MacOSX too.

Thanks in advance for any information that could shed some light on
how to achieve that 'the right way' (tm) with Qbs,
Chris



More information about the Qbs mailing list