File: tst_blackboxproviders.cpp

package info (click to toggle)
qbs 3.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,968 kB
  • sloc: cpp: 120,478; ansic: 72,055; javascript: 14,887; python: 5,882; asm: 1,742; sh: 1,059; java: 693; objc: 409; lex: 194; xml: 141; perl: 137; yacc: 86; makefile: 55; cs: 41
file content (503 lines) | stat: -rw-r--r-- 21,285 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
/****************************************************************************
**
** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights.  These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/

#include "tst_blackboxproviders.h"

#include "../shared.h"

#define WAIT_FOR_NEW_TIMESTAMP() waitForNewTimestamp(testDataDir)

TestBlackboxProviders::TestBlackboxProviders()
    : TestBlackboxBase(SRCDIR "/testdata-providers", "blackbox-providers")
{
}

void TestBlackboxProviders::allowedValues()
{
    QFETCH(QStringList, arguments);
    QFETCH(bool, expectFailure);

    QDir::setCurrent(testDataDir + "/allowed-values");
    rmDirR(relativeBuildDir());
    QbsRunParameters params;
    params.arguments = arguments;
    params.expectFailure = expectFailure;

    QVERIFY2(runQbs(params) == int(expectFailure), m_qbsStderr);
}

void TestBlackboxProviders::allowedValues_data()
{
    QTest::addColumn<QStringList>("arguments");
    QTest::addColumn<bool>("expectFailure");

    QTest::newRow("invalid js value") << QStringList{} << true;
    QTest::newRow("invalid variant value")
        << QStringList{"moduleProviders.provider.aProperty:three"} << true;
    QTest::newRow("valid variant value")
        << QStringList{"moduleProviders.provider.aProperty:one"} << false;
}

void TestBlackboxProviders::brokenProvider()
{
    QDir::setCurrent(testDataDir + "/broken-provider");
    QbsRunParameters params;
    params.expectFailure = true;
    QVERIFY(runQbs(params) != 0);

    QVERIFY(m_qbsStderr.contains("Error executing provider for module 'qbsothermodule'"));
    QVERIFY(m_qbsStderr.contains("Error executing provider for module 'qbsmetatestmodule'"));
    QCOMPARE(m_qbsStderr.count("This provider is broken"), 2);
}

void TestBlackboxProviders::conanProvider()
{
    QFETCH(bool, generateConanFiles);
    QFETCH(bool, successExpected);

    const auto executable = findExecutable({"conan"});
    if (executable.isEmpty())
        QSKIP("conan is not installed or not available in PATH.");

    const auto conanVersion = this->conanVersion(executable);
    if (!conanVersion.isValid())
        QSKIP("Can't get conan version.");
    if (compare(conanVersion, qbs::Version(2, 6)) < 0)
        QSKIP("This test apples only to conan 2.6 and newer.");

    const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test";
    if (!QFileInfo(profilePath).exists())
        QSKIP("conan profile is not installed, run './scripts/setup-conan-profiles.sh'.");

    // install testlibdep first
    QProcess conan;
    QDir::setCurrent(testDataDir + "/conan-provider/testlibdep");
    conan.start(executable, {"create", ".", "--profile:all=qbs-test"});
    QVERIFY(waitForProcessSuccess(conan));

    // install testlib second
    QDir::setCurrent(testDataDir + "/conan-provider/testlib");
    conan.start(executable, {"create", ".", "--profile:all=qbs-test"});
    QVERIFY(waitForProcessSuccess(conan));

    // install header lib third
    QDir::setCurrent(testDataDir + "/conan-provider/testlibheader");
    conan.start(executable, {"create", ".", "--profile:all=qbs-test"});
    QVERIFY(waitForProcessSuccess(conan));

    // install lib-order-test
    QDir::setCurrent(testDataDir + "/conan-provider/lib-order-test");
    conan.start(executable, {"create", ".", "--profile:all=qbs-test"});
    QVERIFY(waitForProcessSuccess(conan));

    // now build an app using those libs
    QDir::setCurrent(testDataDir + "/conan-provider");

    rmDirR(relativeBuildDir());
    rmDirR("build");

    if (generateConanFiles) {
        QStringList arguments{
            "install", ".", "-g=QbsDeps", "--profile:all=qbs-test", "--output-folder=build"};
        QProcess conan;
        conan.start(executable, arguments);
        QVERIFY(waitForProcessSuccess(conan));
    }

    QbsRunParameters buildParams(
        "build",
        {"--force-probe-execution",
         "moduleProviders.conan.installDirectory:" + QDir::currentPath() + "/build"});
    buildParams.expectFailure = !successExpected;
    QCOMPARE(runQbs(buildParams) == 0, successExpected);
}

void TestBlackboxProviders::conanProvider_data()
{
    QTest::addColumn<bool>("generateConanFiles");
    QTest::addColumn<bool>("successExpected");

    QTest::addRow("no conan files generated") << false << false;
    QTest::addRow("conan files generated") << true << true;
}

void TestBlackboxProviders::conanFileProbe()
{
    const auto executable = findExecutable({"conan"});
    if (executable.isEmpty())
        QSKIP("conan is not installed or not available in PATH.");

    const auto conanVersion = this->conanVersion(executable);
    if (!conanVersion.isValid())
        QSKIP("Can't get conan version.");
    if (compare(conanVersion, qbs::Version(2, 6)) < 0)
        QSKIP("This test apples only to conan 2.6 and newer.");

    const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test";
    if (!QFileInfo(profilePath).exists())
        QSKIP("conan profile is not installed, run './scripts/setup-conan-profiles.sh'.");

    // install testlib
    QProcess conan;
    QDir::setCurrent(testDataDir + "/conanfile-probe/testlib");
    conan.start(executable, {"create", ".", "--profile:all=qbs-test"});
    QVERIFY(waitForProcessSuccess(conan));

    // now build an app
    QDir::setCurrent(testDataDir + "/conanfile-probe");

    QCOMPARE(runQbs(QbsRunParameters{"resolve"}), 0);
    QCOMPARE(runQbs(QbsRunParameters{"build"}), 0);
}

void TestBlackboxProviders::moduleProviders()
{
    QDir::setCurrent(testDataDir + "/module-providers");

    // Resolving in dry-run mode must not leave any data behind.
    QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
    if (m_qbsStdout.contains("target platform/arch differ from host platform/arch"))
        QSKIP("Cannot run binaries in cross-compiled build");
    QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 2);
    QVERIFY(!QFile::exists(relativeBuildDir()));

    // Initial build.
    QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app1"})), 0);
    QVERIFY(QFile::exists(relativeBuildDir()));
    QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 2);
    QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData());
    QVERIFY2(m_qbsStdout.contains("The MY_DEFINE is app1"), m_qbsStdout.constData());
    QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app2"})), 0);
    QVERIFY2(m_qbsStdout.contains("The letters are Z and Y"), m_qbsStdout.constData());
    QVERIFY2(m_qbsStdout.contains("The MY_DEFINE is app2"), m_qbsStdout.constData());

    // Rebuild with overridden module provider config. The output for product 2 must change,
    // but no setup script must be re-run, because both config values have already been
    // handled in the first run.
    const QStringList resolveArgs("moduleProviders.mygenerator.chooseLettersFrom:beginning");
    QCOMPARE(runQbs(QbsRunParameters("resolve", resolveArgs)), 0);
    QVERIFY2(!m_qbsStdout.contains("Running setup script"), m_qbsStdout.constData());
    QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app1"})), 0);
    QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData());
    QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app2"})), 0);
    QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData());

    // Forcing Probe execution triggers a re-run of the setup script. But only once,
    // because the module provider config is the same now.
    QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList(resolveArgs)
                                     << "--force-probe-execution")), 0);
    QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 1);
    QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app1"})), 0);
    QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData());
    QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app2"})), 0);
    QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData());

    // Now re-run without the module provider config override. Again, the setup script must
    // run once, for the config value that was not present in the last run.
    QCOMPARE(runQbs(QbsRunParameters("resolve")), 0);
    QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 1);
    QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app1"})), 0);
    QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData());
    QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app2"})), 0);
    QVERIFY2(m_qbsStdout.contains("The letters are Z and Y"), m_qbsStdout.constData());
}

// Checks regression - when loading 2 modules from the same provider, the second module should
// come from provider cache
void TestBlackboxProviders::moduleProvidersCache()
{
    QDir::setCurrent(testDataDir + "/module-providers-cache");

    QbsRunParameters params("resolve", {"-v"});
    QCOMPARE(runQbs(params), 0);
    const auto qbsmetatestmoduleMessage = "Re-checking for module \"qbsmetatestmodule\" with "
                                          "newly added search paths from module provider";
    const auto qbsothermoduleMessage = "Re-checking for module \"qbsothermodule\" with "
                                       "newly added search paths from module provider";
    QCOMPARE(m_qbsStderr.count(qbsmetatestmoduleMessage), 1);
    QCOMPARE(m_qbsStderr.count(qbsothermoduleMessage), 1);
    QCOMPARE(m_qbsStderr.count("Re-using provider \"provider_a\" from cache"), 1);

    // We didn't change providers, so both modules should come from cache.
    params.arguments << "project.dummyProp:value";
    QCOMPARE(runQbs(params), 0);
    QCOMPARE(m_qbsStderr.count(qbsmetatestmoduleMessage), 1);
    QCOMPARE(m_qbsStderr.count(qbsothermoduleMessage), 1);
    QCOMPARE(m_qbsStderr.count("Re-using provider \"provider_a\" from cache"), 2);
}

void TestBlackboxProviders::nonEagerModuleProvider()
{
    QDir::setCurrent(testDataDir + "/non-eager-provider");

    QbsRunParameters params("resolve");
    QCOMPARE(runQbs(params), 0);
    QVERIFY2(m_qbsStdout.contains(("Running setup script for qbsmetatestmodule")), m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("Running setup script for qbsothermodule")), m_qbsStdout);
    QVERIFY2(!m_qbsStdout.contains(("Running setup script for nonexistentmodule")), m_qbsStdout);

    QVERIFY2(m_qbsStdout.contains(("p1.qbsmetatestmodule.prop: from_provider_a")),
             m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("p1.qbsothermodule.prop: from_provider_a")),
             m_qbsStdout);
}

void TestBlackboxProviders::probeInModuleProvider()
{
    QDir::setCurrent(testDataDir + "/probe-in-module-provider");

    QbsRunParameters params;
    params.command = "build";
    params.arguments << "--force-probe-execution";
    QCOMPARE(runQbs(params), 0);
    QVERIFY2(m_qbsStdout.contains("Running probe"), m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains("p.qbsmetatestmodule.boolProp: true"), m_qbsStdout);
    WAIT_FOR_NEW_TIMESTAMP();
    touch("probe-in-module-provider.qbs");
    QCOMPARE(runQbs(), 0);
    QVERIFY2(m_qbsStdout.contains("p.qbsmetatestmodule.boolProp: true"), m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains("p.qbsmetatestmodule.prop: \"value\""), m_qbsStdout);
    QVERIFY2(!m_qbsStdout.contains("Running probe"), m_qbsStdout);
}

void TestBlackboxProviders::providersCondition()
{
    QDir::setCurrent(testDataDir + "/providers-condition");

    QbsRunParameters params("resolve");
    QCOMPARE(runQbs(params), 0);
    QVERIFY2(m_qbsStdout.contains("p1.qbsmetatestmodule.prop: from_provider_a"), m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("p1.qbsothermodule.prop: from_provider_b")), m_qbsStdout);
}

void TestBlackboxProviders::providersConditionProbes()
{
    QDir::setCurrent(testDataDir + "/providers-condition-probes");

    QbsRunParameters params("resolve");
    QCOMPARE(runQbs(params), 0);
    QVERIFY2(m_qbsStdout.contains("p1.qbsmetatestmodule.prop: from_provider_a"), m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("p1.qbsothermodule.prop: from_provider_b")), m_qbsStdout);
}

// Tests whether it is possible to set providers properties in a Product or from command-line
void TestBlackboxProviders::providersProperties()
{
    QDir::setCurrent(testDataDir + "/providers-properties");

    QbsRunParameters params("build");
    params.arguments = QStringList("moduleProviders.provider_b.someProp: \"first,second\"");
    QCOMPARE(runQbs(params), 0);
    QVERIFY2(m_qbsStdout.contains("p.qbsmetatestmodule.listProp: [\"someValue\"]"), m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(
            "p.qbsothermodule.listProp: [\"first\",\"second\"]"), m_qbsStdout);
}

// checks that we can set qbs module properties in providers and provider cache works corectly
void TestBlackboxProviders::qbsModulePropertiesInProviders()
{
    QDir::setCurrent(testDataDir + "/qbs-module-properties-in-providers");

    QbsRunParameters params("resolve");

    QCOMPARE(runQbs(params), 0);

    // We have 2 products in 2 configurations, but second product should use the cached value
    // so we should have only 2 copies of the module, not 4.
    QCOMPARE(m_qbsStdout.count("Running setup script for qbsmetatestmodule"), 2);

    // Check that products get correct values from modules
    QVERIFY2(m_qbsStdout.contains(("product1.qbsmetatestmodule.prop: /sysroot1")), m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("product1.qbsmetatestmodule.prop: /sysroot2")), m_qbsStdout);

    QVERIFY2(m_qbsStdout.contains(("product2.qbsmetatestmodule.prop: /sysroot1")), m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("product2.qbsmetatestmodule.prop: /sysroot2")), m_qbsStdout);
}

void TestBlackboxProviders::qbsModuleProviders_data()
{
    QTest::addColumn<QStringList>("arguments");
    QTest::addColumn<QString>("firstProp");
    QTest::addColumn<QString>("secondProp");

    QTest::newRow("default") << QStringList() << "from_provider_a" << "undefined";
    QTest::newRow("override")
            << QStringList("projects.project.qbsModuleProviders:provider_b")
            << "from_provider_b"
            << "from_provider_b";
    QTest::newRow("override list a")
            << QStringList("projects.project.qbsModuleProviders:provider_a,provider_b")
            << "from_provider_a"
            << "from_provider_b";
    QTest::newRow("override list b")
            << QStringList("projects.project.qbsModuleProviders:provider_b,provider_a")
            << "from_provider_b"
            << "from_provider_b";
}

// Tests whether it is possible to set qbsModuleProviders in Product and Project items
// and that the order of providers results in correct priority
void TestBlackboxProviders::qbsModuleProviders()
{
    QFETCH(QStringList, arguments);
    QFETCH(QString, firstProp);
    QFETCH(QString, secondProp);

    QDir::setCurrent(testDataDir + "/qbs-module-providers");

    QbsRunParameters params("resolve");
    params.arguments << arguments << "-f"
                     << "qbs-module-providers.qbs";
    QCOMPARE(runQbs(params), 0);
    QVERIFY2(m_qbsStdout.contains(("p1.qbsmetatestmodule.prop: " + firstProp).toUtf8()),
             m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("p1.qbsothermodule.prop: " + secondProp).toUtf8()),
             m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("p2.qbsmetatestmodule.prop: " + firstProp).toUtf8()),
             m_qbsStdout);
    QVERIFY2(m_qbsStdout.contains(("p2.qbsothermodule.prop: " + secondProp).toUtf8()),
             m_qbsStdout);
}

void TestBlackboxProviders::qbsModuleProvidersCliOverride_data()
{
    QTest::addColumn<QStringList>("arguments");
    QTest::addColumn<QString>("propertyValue");

    QTest::newRow("default") << QStringList() << "undefined";
    QTest::newRow("project-wide")
            << QStringList("project.qbsModuleProviders:provider_a")
            << "from_provider_a";
    QTest::newRow("concrete project")
            << QStringList("projects.innerProject.qbsModuleProviders:provider_a")
            << "from_provider_a";
    QTest::newRow("concrete product")
            << QStringList("products.product.qbsModuleProviders:provider_a")
            << "from_provider_a";
    QTest::newRow("concrete project override project-wide")
            << QStringList({
                    "project.qbsModuleProviders:provider_a",
                    "projects.innerProject.qbsModuleProviders:provider_b"})
            << "from_provider_b";
    QTest::newRow("concrete product override project-wide")
            << QStringList({
                    "project.qbsModuleProviders:provider_a",
                    "products.product.qbsModuleProviders:provider_b"})
            << "from_provider_b";
}

// Tests possible use-cases how to override providers from command-line
void TestBlackboxProviders::qbsModuleProvidersCliOverride()
{
    QFETCH(QStringList, arguments);
    QFETCH(QString, propertyValue);

    QDir::setCurrent(testDataDir + "/qbs-module-providers-cli-override");

    QbsRunParameters params("resolve");
    params.arguments = arguments;
    QCOMPARE(runQbs(params), 0);
    QVERIFY2(m_qbsStdout.contains(("qbsmetatestmodule.prop: " + propertyValue).toUtf8()),
             m_qbsStdout);
}

void TestBlackboxProviders::qbsModuleProvidersCompatibility_data()
{
    QTest::addColumn<QStringList>("arguments");
    QTest::addColumn<QString>("propertyValue");

    QTest::newRow("default") << QStringList() << "from_scoped_provider";
    QTest::newRow("scoped by name") << QStringList("project.qbsModuleProviders:qbsmetatestmodule") << "from_scoped_provider";
    QTest::newRow("named") << QStringList("project.qbsModuleProviders:named_provider") << "from_named_provider";
}

// Tests whether scoped providers can be used as named, i.e. new provider machinery
// is compatible with the old one
void TestBlackboxProviders::qbsModuleProvidersCompatibility()
{
    QFETCH(QStringList, arguments);
    QFETCH(QString, propertyValue);

    QDir::setCurrent(testDataDir + "/qbs-module-providers-compatibility");

    QbsRunParameters params("resolve");
    params.arguments = arguments;
    QCOMPARE(runQbs(params), 0);
    QVERIFY2(m_qbsStdout.contains(("qbsmetatestmodule.prop: " + propertyValue).toUtf8()),
             m_qbsStdout);
}

void TestBlackboxProviders::qbspkgconfigModuleProvider()
{
    QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider/libs");
    rmDirR(relativeBuildDir());

    const auto commonParams = QbsRunParameters(QStringLiteral("install"), {
            QStringLiteral("--install-root"),
            QStringLiteral("install-root")
    });
    auto dynamicParams = commonParams;
    dynamicParams.arguments << "config:library" << "projects.libs.isBundle:false";
    QCOMPARE(runQbs(dynamicParams), 0);

    QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider");
    rmDirR(relativeBuildDir());

    const auto sysroot = testDataDir + "/qbspkgconfig-module-provider/libs/install-root";

    QbsRunParameters params;
    params.arguments << "moduleProviders.qbspkgconfig.sysroot:" + sysroot;
    QCOMPARE(runQbs(params), 0);
}

void TestBlackboxProviders::qtBug51237()
{
    const SettingsPtr s = settings();
    qbs::Internal::TemporaryProfile profile("qbs_autotests_qtBug51237", s.get());
    profile.p.setValue("moduleProviders.provider.theProperty", QStringList());
    s->sync();

    QDir::setCurrent(testDataDir + "/QTBUG-51237");
    QbsRunParameters params;
    params.profile = profile.p.name();
    QCOMPARE(runQbs(params), 0);
}

void TestBlackboxProviders::removalVersion()
{
    QDir::setCurrent(testDataDir + "/removal-version");
    QbsRunParameters params;
    params.expectFailure = true;
    QVERIFY(runQbs(params) != 0);
    QVERIFY(m_qbsStderr.contains(
        "Property 'deprecated' was scheduled for removal in version 2.2.0, but is still present"));
}

QTEST_MAIN(TestBlackboxProviders)