On 19 June 2016 at 19:38, Jake Petroules <[email protected]> wrote: > AutotestRunner (https://doc.qt.io/qbs/autotestrunner-item.html) provides an > environment property that you can use to control the environment that your > tests are run with. Create an item derived from AutotestRunner, like so: > > AutotestRunner { > Depends { name: "Qt.core" } > environment: base.concat(["QT_PLUGIN_PATH=" + Qt.core.pluginPath]) > }
Thanks a lot Jake, somehow I missed that one! > > ...and then use that in place of AutotestRunner. In fact, I'd argue that we > should provide this by default in qbs as "QtAutotestRunner", so maybe look > for that in a future release. :) Sounds like a good idea, if this is a typical workaround people have to do. Thanks again, Chris > > Good luck! > > On Jun 19, 2016, at 12:23 AM, Ch'Gans <[email protected]> wrote: > > 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 > _______________________________________________ > QBS mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/qbs > > > -- > Jake Petroules - [email protected] > Consulting Services Engineer - The Qt Company > Qbs build system evangelist - qbs.io > _______________________________________________ QBS mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/qbs
