aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/api/tst_api.cpp4
-rw-r--r--tests/auto/blackbox/testdata-android/qt-app/test.keystorebin0 -> 1284 bytes
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs2
-rw-r--r--tests/auto/blackbox/testdata-apple/codesign/app.cpp1
-rw-r--r--tests/auto/blackbox/testdata-apple/codesign/codesign.qbs48
-rw-r--r--tests/auto/blackbox/testdata-apple/multiarch-helpers.js (renamed from tests/auto/blackbox/testdata-apple/apple-multiconfig/helpers.js)21
-rw-r--r--tests/auto/blackbox/testdata-baremetal/BareMetalApplication.qbs105
-rw-r--r--tests/auto/blackbox/testdata-baremetal/BareMetalProduct.qbs158
-rw-r--r--tests/auto/blackbox/testdata-baremetal/BareMetalStaticLibrary.qbs105
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/app.c (renamed from tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/main.c)0
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/compiler-defines-by-language.qbs69
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/cpptest.cpp0
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/ctest.c0
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-include-paths/compiler-include-paths.qbs9
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-include-paths/main.c (renamed from tests/auto/blackbox/testdata-baremetal/generate-linker-map/main.c)0
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-listing/compiler-listing.qbs (renamed from tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/generate-compiler-listing.qbs)4
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-listing/fun.c (renamed from tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/fun.c)0
-rw-r--r--tests/auto/blackbox/testdata-baremetal/compiler-listing/main.c (renamed from tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/main.c)0
-rw-r--r--tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/do-not-generate-compiler-listing.qbs16
-rw-r--r--tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/do-not-generate-linker-map.qbs11
-rw-r--r--tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs14
-rw-r--r--tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/main.c6
-rw-r--r--tests/auto/blackbox/testdata-baremetal/generate-linker-map/generate-linker-map.qbs11
-rw-r--r--tests/auto/blackbox/testdata-baremetal/linker-map/linker-map.qbs8
-rw-r--r--tests/auto/blackbox/testdata-baremetal/linker-map/main.c (renamed from tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/fun.c)2
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs12-iar.s7
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-iar.s6
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-sdcc.s6
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m32c-iar.s6
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-iar.s6
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs14
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-asm-application/riscv-iar.s7
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rx-iar.s5
-rw-r--r--tests/auto/blackbox/testdata/dynamicRuleOutputs/before/flexoptionsreader.js4
-rw-r--r--tests/auto/blackbox/testdata/path-probe/BaseApp.qbs2
-rw-r--r--tests/auto/blackbox/testdata/undefined-target-platform/undefined-target-platform.qbs2
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp18
-rw-r--r--tests/auto/blackbox/tst_blackboxandroid.cpp108
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp114
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.h2
-rw-r--r--tests/auto/blackbox/tst_blackboxbaremetal.cpp142
-rw-r--r--tests/auto/blackbox/tst_blackboxbaremetal.h3
-rw-r--r--tests/auto/blackbox/tst_blackboxbase.h9
-rw-r--r--tests/auto/buildgraph/buildgraph.qbs2
-rw-r--r--tests/auto/language/language.qbs7
-rw-r--r--tests/auto/shared.h5
-rw-r--r--tests/auto/tools/tools.qbs2
-rw-r--r--tests/auto/tools/tst_tools.cpp24
-rw-r--r--tests/auto/tools/tst_tools.h1
-rw-r--r--tests/benchmarker/benchmarker.cpp4
-rw-r--r--tests/benchmarker/benchmarker.h5
-rw-r--r--tests/benchmarker/runsupport.h2
-rw-r--r--tests/benchmarker/valgrindrunner.cpp24
-rw-r--r--tests/benchmarker/valgrindrunner.h7
-rw-r--r--tests/fuzzy-test/fuzzytester.cpp4
55 files changed, 759 insertions, 383 deletions
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index 7a585f641..a51eb3e0c 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -2507,7 +2507,9 @@ qbs::SetupProjectParameters TestApi::defaultSetupParameters(const QString &proje
}
qbs::SetupProjectParameters setupParams;
- setupParams.setEnvironment(QProcessEnvironment::systemEnvironment());
+ auto environment = QProcessEnvironment::systemEnvironment();
+ environment.insert("QBS_AUTOTEST_CODE_SIGNING_REQUIRED", "0");
+ setupParams.setEnvironment(environment);
setupParams.setProjectFilePath(projectFilePath);
setupParams.setPropertyCheckingMode(qbs::ErrorHandlingMode::Strict);
setupParams.setOverrideBuildGraphData(true);
diff --git a/tests/auto/blackbox/testdata-android/qt-app/test.keystore b/tests/auto/blackbox/testdata-android/qt-app/test.keystore
new file mode 100644
index 000000000..5713d10d2
--- /dev/null
+++ b/tests/auto/blackbox/testdata-android/qt-app/test.keystore
Binary files differ
diff --git a/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs b/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs
index c1d35eb8c..6b7fab390 100644
--- a/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs
+++ b/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs
@@ -1,6 +1,6 @@
import qbs.Utilities
-import "helpers.js" as Helpers
+import "../multiarch-helpers.js" as Helpers
Project {
minimumQbsVersion: "1.8"
diff --git a/tests/auto/blackbox/testdata-apple/codesign/app.cpp b/tests/auto/blackbox/testdata-apple/codesign/app.cpp
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/codesign/app.cpp
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs b/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs
new file mode 100644
index 000000000..eafb0be84
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs
@@ -0,0 +1,48 @@
+import "../multiarch-helpers.js" as Helpers
+
+Project {
+ name: "p"
+ property string xcodeVersion
+
+ property bool isBundle: true
+ property bool enableSigning: true
+
+ CppApplication {
+ name: "A"
+ bundle.isBundle: project.isBundle
+ files: "app.cpp"
+ codesign.enableCodeSigning: project.enableSigning
+ codesign.signingType: "ad-hoc"
+ install: true
+ installDir: ""
+
+ qbs.architectures:
+ project.xcodeVersion ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ }
+
+ DynamicLibrary {
+ Depends { name: "cpp" }
+ name: "B"
+ bundle.isBundle: project.isBundle
+ files: "app.cpp"
+ codesign.enableCodeSigning: project.enableSigning
+ codesign.signingType: "ad-hoc"
+ install: true
+ installDir: ""
+ qbs.architectures:
+ project.xcodeVersion ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ }
+
+ LoadableModule {
+ Depends { name: "cpp" }
+ name: "C"
+ bundle.isBundle: project.isBundle
+ files: "app.cpp"
+ codesign.enableCodeSigning: project.enableSigning
+ codesign.signingType: "ad-hoc"
+ install: true
+ installDir: ""
+ qbs.architectures:
+ project.xcodeVersion ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ }
+}
diff --git a/tests/auto/blackbox/testdata-apple/apple-multiconfig/helpers.js b/tests/auto/blackbox/testdata-apple/multiarch-helpers.js
index 16ba00fa9..5d1c0f273 100644
--- a/tests/auto/blackbox/testdata-apple/apple-multiconfig/helpers.js
+++ b/tests/auto/blackbox/testdata-apple/multiarch-helpers.js
@@ -36,12 +36,16 @@ var Utilities = require("qbs.Utilities");
function enableOldArch(qbs, xcodeVersion) {
return qbs.targetOS.contains("macos")
&& xcodeVersion
- && Utilities.versionCompare(xcodeVersion, "10") < 0
+ && (Utilities.versionCompare(xcodeVersion, "10") < 0
+ || Utilities.versionCompare(xcodeVersion, "12.2") >= 0)
|| qbs.targetOS.contains("ios")
}
-function getNewArch(qbs) {
- if (qbs.targetOS.contains("macos") || qbs.targetOS.contains("ios-simulator"))
+function getNewArch(qbs, xcodeVersion) {
+ if (qbs.targetOS.contains("macos"))
+ return xcodeVersion
+ && Utilities.versionCompare(xcodeVersion, "12.2") >= 0 ? "arm64" : "x86_64";
+ else if (qbs.targetOS.contains("ios-simulator"))
return "x86_64"
else if (qbs.targetOS.contains("ios"))
return "arm64"
@@ -52,8 +56,11 @@ function getNewArch(qbs) {
throw "unsupported targetOS: " + qbs.targetOS;
}
-function getOldArch(qbs) {
- if (qbs.targetOS.contains("macos") || qbs.targetOS.contains("ios-simulator"))
+function getOldArch(qbs, xcodeVersion) {
+ if (qbs.targetOS.contains("macos"))
+ return xcodeVersion
+ && Utilities.versionCompare(xcodeVersion, "12.2") >= 0 ? "x86_64" : "x86";
+ else if (qbs.targetOS.contains("ios-simulator"))
return "x86"
else if (qbs.targetOS.contains("ios"))
return "armv7a"
@@ -62,6 +69,6 @@ function getOldArch(qbs) {
function getArchitectures(qbs, xcodeVersion) {
return enableOldArch(qbs, xcodeVersion)
- ? [getOldArch(qbs), getNewArch(qbs)]
- : [getNewArch(qbs)];
+ ? [getOldArch(qbs, xcodeVersion), getNewArch(qbs, xcodeVersion)]
+ : [getNewArch(qbs, xcodeVersion)];
}
diff --git a/tests/auto/blackbox/testdata-baremetal/BareMetalApplication.qbs b/tests/auto/blackbox/testdata-baremetal/BareMetalApplication.qbs
index fa678ebb2..a52bb4c4e 100644
--- a/tests/auto/blackbox/testdata-baremetal/BareMetalApplication.qbs
+++ b/tests/auto/blackbox/testdata-baremetal/BareMetalApplication.qbs
@@ -1,104 +1,3 @@
-CppApplication {
- cpp.positionIndependentCode: false
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "stm8"
- cpp.driverLinkerFlags: [
- "--config_def", "_CSTACK_SIZE=0x100",
- "--config_def", "_HEAP_SIZE=0x100",
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "rl78"
- cpp.driverLinkerFlags: [
- "--config_def", "_NEAR_HEAP_SIZE=256",
- "--config_def", "_FAR_HEAP_SIZE=4096",
- "--config_def", "_HUGE_HEAP_SIZE=0",
- "--config_def", "_STACK_SIZE=128",
- "--config_def", "_NEAR_CONST_LOCATION_SIZE=0x6F00",
- "--config_def", "_NEAR_CONST_LOCATION_START=0x3000",
- "--define_symbol", "_NEAR_CONST_LOCATION=0",
- "--config", cpp.toolchainInstallPath + "/../config/lnkrl78_s3.icf"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "rh850"
- cpp.driverLinkerFlags: [
- "--config_def", "CSTACK_SIZE=0x1000",
- "--config_def", "HEAP_SIZE=0x1000",
- "--config", cpp.toolchainInstallPath + "/../config/lnkrh850_g3m.icf"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "v850"
- cpp.driverLinkerFlags: [
- "-D_CSTACK_SIZE=1000",
- "-D_HEAP_SIZE=1000",
- "-f", cpp.toolchainInstallPath + "/../config/lnk85.xcl"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "78k"
- cpp.cFlags: [
- "--core", "78k0",
- "--code_model", "standard"
- ]
- cpp.driverLinkerFlags: [
- "-D_CSTACK_SIZE=80",
- "-D_HEAP_SIZE=200",
- "-D_CODEBANK_START=0",
- "-D_CODEBANK_END=0",
- "-D_CODEBANK_BANKS=0",
- "-f", cpp.toolchainInstallPath + "/../config/lnk.xcl",
- cpp.toolchainInstallPath + "/../lib/clib/cl78ks1.r26"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "sh"
- cpp.driverLinkerFlags: [
- "--config_def", "_CSTACK_SIZE=0x800",
- "--config_def", "_HEAP_SIZE=0x800",
- "--config_def", "_INT_TABLE=0x10",
- "--config", cpp.toolchainInstallPath + "/../config/generic.icf"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("keil")
- && qbs.architecture.startsWith("arm")
- && cpp.compilerName.startsWith("armcc")
- cpp.assemblerFlags: ["--cpu", "cortex-m0"]
- cpp.driverFlags: ["--cpu", "cortex-m0"]
- }
- Properties {
- condition: qbs.toolchain.contains("keil")
- && qbs.architecture.startsWith("arm")
- && cpp.compilerName.startsWith("armclang")
- cpp.assemblerFlags: ["--cpu", "cortex-m0"]
- cpp.driverFlags: ["-mcpu=cortex-m0", "--target=arm-arm-none-eabi"]
- }
- Properties {
- condition: qbs.toolchain.contains("gcc")
- && qbs.architecture.startsWith("arm")
- cpp.driverFlags: ["-specs=nosys.specs"]
- }
- Properties {
- condition: qbs.toolchain.contains("gcc")
- && qbs.architecture === "xtensa"
- cpp.driverFlags: ["-nostdlib"]
- }
- Properties {
- condition: qbs.toolchain.contains("gcc")
- && qbs.architecture === "msp430"
- cpp.driverFlags: ["-mmcu=msp430f5529"]
- }
- Properties {
- condition: qbs.toolchain.contains("gcc")
- && qbs.architecture === "m32r"
- cpp.driverFlags: ["-nostdlib"]
- }
+BareMetalProduct {
+ type: "application"
}
diff --git a/tests/auto/blackbox/testdata-baremetal/BareMetalProduct.qbs b/tests/auto/blackbox/testdata-baremetal/BareMetalProduct.qbs
new file mode 100644
index 000000000..5db988078
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/BareMetalProduct.qbs
@@ -0,0 +1,158 @@
+Product {
+ Depends { name: "cpp" }
+ cpp.positionIndependentCode: false
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "stm8"
+ cpp.driverLinkerFlags: [
+ "--config_def", "_CSTACK_SIZE=0x100",
+ "--config_def", "_HEAP_SIZE=0x100",
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "rl78"
+ cpp.driverLinkerFlags: [
+ "--config_def", "_NEAR_HEAP_SIZE=256",
+ "--config_def", "_FAR_HEAP_SIZE=4096",
+ "--config_def", "_HUGE_HEAP_SIZE=0",
+ "--config_def", "_STACK_SIZE=128",
+ "--config_def", "_NEAR_CONST_LOCATION_SIZE=0x6F00",
+ "--config_def", "_NEAR_CONST_LOCATION_START=0x3000",
+ "--define_symbol", "_NEAR_CONST_LOCATION=0",
+ "--config", cpp.toolchainInstallPath + "/../config/lnkrl78_s3.icf"
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "rh850"
+ cpp.driverLinkerFlags: [
+ "--config_def", "CSTACK_SIZE=0x1000",
+ "--config_def", "HEAP_SIZE=0x1000",
+ "--config", cpp.toolchainInstallPath + "/../config/lnkrh850_g3m.icf"
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "v850"
+ cpp.driverLinkerFlags: [
+ "-D_CSTACK_SIZE=1000",
+ "-D_HEAP_SIZE=1000",
+ "-f", cpp.toolchainInstallPath + "/../config/lnk85.xcl"
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "78k"
+ cpp.commonCompilerFlags: [
+ "--core", "78k0",
+ "--code_model", "standard"
+ ]
+ cpp.driverLinkerFlags: [
+ "-D_CSTACK_SIZE=80",
+ "-D_HEAP_SIZE=200",
+ "-D_CODEBANK_START=0",
+ "-D_CODEBANK_END=0",
+ "-D_CODEBANK_BANKS=0",
+ "-f", cpp.toolchainInstallPath + "/../config/lnk.xcl",
+ cpp.toolchainInstallPath + "/../lib/clib/cl78ks1.r26"
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "sh"
+ cpp.driverLinkerFlags: [
+ "--config_def", "_CSTACK_SIZE=0x800",
+ "--config_def", "_HEAP_SIZE=0x800",
+ "--config_def", "_INT_TABLE=0x10",
+ "--config", cpp.toolchainInstallPath + "/../config/generic.icf"
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "hcs8"
+ cpp.driverLinkerFlags: [
+ "-D_CSTACK_SIZE=200",
+ "-D_HEAP_SIZE=200",
+ "-f", cpp.toolchainInstallPath + "/../config/lnkunspecifieds08.xcl"
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "m32c"
+ cpp.driverLinkerFlags: [
+ "-D_CSTACK_SIZE=100",
+ "-D_NEAR_HEAP_SIZE=400",
+ "-D_FAR_HEAP_SIZE=400",
+ "-D_HUGE_HEAP_SIZE=400",
+ "-D_ISTACK_SIZE=40",
+ "-f", cpp.toolchainInstallPath + "/../config/lnkm32c.xcl",
+ cpp.toolchainInstallPath + (qbs.debugInformation ? "/../lib/dlib/dlm32cnf.r48" : "/../lib/clib/clm32cf.r48")
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "riscv"
+ cpp.driverLinkerFlags: [
+ "--config_def", "CSTACK_SIZE=0x1000",
+ "--config_def", "HEAP_SIZE=0x1000"
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ && qbs.architecture === "m68k"
+ cpp.cFlags: [
+ "--no_div"
+ ]
+ cpp.driverLinkerFlags: [
+ "-D__FLASHBEGIN=0",
+ "-D__FLASHEND=1FFFF",
+ "-D__RAMBEGIN=800000",
+ "-D__RAMEND=803FFF",
+ "-D_CSTACK_SIZE=200",
+ "-D_HEAP_SIZE=1000",
+ "-D_VBR_ADDRESS=0",
+ "-f", cpp.toolchainInstallPath + "/../config/lnkm51ac128.xcl",
+ cpp.toolchainInstallPath + "/../lib/dlcfcffdn.r68"
+ ]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("keil")
+ && qbs.architecture.startsWith("arm")
+ && cpp.compilerName.startsWith("armcc")
+ cpp.assemblerFlags: ["--cpu", "cortex-m0"]
+ cpp.driverFlags: ["--cpu", "cortex-m0"]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("keil")
+ && qbs.architecture.startsWith("arm")
+ && cpp.compilerName.startsWith("armclang")
+ cpp.assemblerFlags: ["--cpu", "cortex-m0"]
+ cpp.driverFlags: ["-mcpu=cortex-m0", "--target=arm-arm-none-eabi"]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ && qbs.architecture.startsWith("arm")
+ cpp.driverFlags: ["-specs=nosys.specs"]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ && qbs.architecture === "xtensa"
+ cpp.driverFlags: ["-nostdlib"]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ && qbs.architecture === "msp430"
+ cpp.driverFlags: ["-mmcu=msp430f5529", "-nostdlib"]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ && qbs.architecture === "m32r"
+ cpp.driverFlags: ["-nostdlib"]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ && qbs.architecture === "riscv"
+ cpp.driverFlags: ["-nostdlib"]
+ }
+}
diff --git a/tests/auto/blackbox/testdata-baremetal/BareMetalStaticLibrary.qbs b/tests/auto/blackbox/testdata-baremetal/BareMetalStaticLibrary.qbs
index 560455162..7259b1446 100644
--- a/tests/auto/blackbox/testdata-baremetal/BareMetalStaticLibrary.qbs
+++ b/tests/auto/blackbox/testdata-baremetal/BareMetalStaticLibrary.qbs
@@ -1,104 +1,3 @@
-StaticLibrary {
- cpp.positionIndependentCode: false
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "stm8"
- cpp.driverLinkerFlags: [
- "--config_def", "_CSTACK_SIZE=0x100",
- "--config_def", "_HEAP_SIZE=0x100",
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "rl78"
- cpp.driverLinkerFlags: [
- "--config_def", "_NEAR_HEAP_SIZE=256",
- "--config_def", "_FAR_HEAP_SIZE=4096",
- "--config_def", "_HUGE_HEAP_SIZE=0",
- "--config_def", "_STACK_SIZE=128",
- "--config_def", "_NEAR_CONST_LOCATION_SIZE=0x6F00",
- "--config_def", "_NEAR_CONST_LOCATION_START=0x3000",
- "--define_symbol", "_NEAR_CONST_LOCATION=0",
- "--config", cpp.toolchainInstallPath + "/../config/lnkrl78_s3.icf"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "rh850"
- cpp.driverLinkerFlags: [
- "--config_def", "CSTACK_SIZE=0x1000",
- "--config_def", "HEAP_SIZE=0x1000",
- "--config", cpp.toolchainInstallPath + "/../config/lnkrh850_g3m.icf"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "v850"
- cpp.driverLinkerFlags: [
- "-D_CSTACK_SIZE=1000",
- "-D_HEAP_SIZE=1000",
- "-f", cpp.toolchainInstallPath + "/../config/lnk85.xcl"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "78k"
- cpp.cFlags: [
- "--core", "78k0",
- "--code_model", "standard"
- ]
- cpp.driverLinkerFlags: [
- "-D_CSTACK_SIZE=80",
- "-D_HEAP_SIZE=200",
- "-D_CODEBANK_START=0",
- "-D_CODEBANK_END=0",
- "-D_CODEBANK_BANKS=0",
- "-f", cpp.toolchainInstallPath + "/../config/lnk.xcl",
- cpp.toolchainInstallPath + "/../lib/clib/cl78ks1.r26"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("iar")
- && qbs.architecture === "sh"
- cpp.driverLinkerFlags: [
- "--config_def", "_CSTACK_SIZE=0x800",
- "--config_def", "_HEAP_SIZE=0x800",
- "--config_def", "_INT_TABLE=0x10",
- "--config", cpp.toolchainInstallPath + "/../config/generic.icf"
- ]
- }
- Properties {
- condition: qbs.toolchain.contains("keil")
- && qbs.architecture.startsWith("arm")
- && cpp.compilerName.startsWith("armcc")
- cpp.assemblerFlags: ["--cpu", "cortex-m0"]
- cpp.driverFlags: ["--cpu", "cortex-m0"]
- }
- Properties {
- condition: qbs.toolchain.contains("keil")
- && qbs.architecture.startsWith("arm")
- && cpp.compilerName.startsWith("armclang")
- cpp.assemblerFlags: ["--cpu", "cortex-m0"]
- cpp.driverFlags: ["-mcpu=cortex-m0", "--target=arm-arm-none-eabi"]
- }
- Properties {
- condition: qbs.toolchain.contains("gcc")
- && qbs.architecture.startsWith("arm")
- cpp.driverFlags: ["-specs=nosys.specs"]
- }
- Properties {
- condition: qbs.toolchain.contains("gcc")
- && qbs.architecture === "xtensa"
- cpp.driverFlags: ["-nostdlib"]
- }
- Properties {
- condition: qbs.toolchain.contains("gcc")
- && qbs.architecture === "msp430"
- cpp.driverFlags: ["-mmcu=msp430f5529"]
- }
- Properties {
- condition: qbs.toolchain.contains("gcc")
- && qbs.architecture === "m32r"
- cpp.driverFlags: ["-nostdlib"]
- }
+BareMetalProduct {
+ type: "staticlibrary"
}
diff --git a/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/main.c b/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/app.c
index 58fe69254..58fe69254 100644
--- a/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/main.c
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/app.c
diff --git a/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/compiler-defines-by-language.qbs b/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/compiler-defines-by-language.qbs
new file mode 100644
index 000000000..5e8bbd62d
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/compiler-defines-by-language.qbs
@@ -0,0 +1,69 @@
+import "../BareMetalApplication.qbs" as BareMetalApplication
+
+Project {
+ property bool supportsCpp: {
+ if (qbs.toolchain.contains("sdcc"))
+ return false;
+ if (qbs.toolchain.contains("keil")) {
+ if (qbs.architecture === "mcs51"
+ || qbs.architecture === "mcs251"
+ || qbs.architecture === "c166") {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ BareMetalApplication {
+ name: "c_language"
+ files: ["app.c", "ctest.c"]
+ cpp.enableCompilerDefinesByLanguage: []
+ property var foo: {
+ if (!cpp.compilerDefinesByLanguage)
+ throw "ASSERT cpp.compilerDefinesByLanguage: "
+ + cpp.compilerDefinesByLanguage;
+ if (!cpp.compilerDefinesByLanguage["c"])
+ throw "ASSERT cpp.compilerDefinesByLanguage[\"c\"]: "
+ + cpp.compilerDefinesByLanguage["c"];
+ if (cpp.compilerDefinesByLanguage["cpp"])
+ throw "ASSERT !cpp.compilerDefinesByLanguage[\"cpp\"]: "
+ + cpp.compilerDefinesByLanguage["cpp"];
+ }
+ }
+
+ BareMetalApplication {
+ condition: supportsCpp
+ name: "cpp_language"
+ files: ["app.c", "cpptest.cpp"]
+ cpp.enableCompilerDefinesByLanguage: ["cpp"]
+ property var foo: {
+ if (!cpp.compilerDefinesByLanguage)
+ throw "ASSERT cpp.compilerDefinesByLanguage: "
+ + cpp.compilerDefinesByLanguage;
+ if (cpp.compilerDefinesByLanguage["c"])
+ throw "ASSERT !cpp.compilerDefinesByLanguage[\"c\"]: "
+ + cpp.compilerDefinesByLanguage["c"];
+ if (!cpp.compilerDefinesByLanguage["cpp"])
+ throw "ASSERT cpp.compilerDefinesByLanguage[\"cpp\"]: "
+ + cpp.compilerDefinesByLanguage["cpp"];
+ }
+ }
+
+ BareMetalApplication {
+ condition: supportsCpp
+ name: "c_and_cpp_language"
+ files: ["app.c", "ctest.c", "cpptest.cpp"]
+ cpp.enableCompilerDefinesByLanguage: ["c", "cpp"]
+ property var foo: {
+ if (!cpp.compilerDefinesByLanguage)
+ throw "ASSERT cpp.compilerDefinesByLanguage: "
+ + cpp.compilerDefinesByLanguage;
+ if (!cpp.compilerDefinesByLanguage["c"])
+ throw "ASSERT cpp.compilerDefinesByLanguage[\"c\"]: "
+ + cpp.compilerDefinesByLanguage["c"];
+ if (!cpp.compilerDefinesByLanguage["cpp"])
+ throw "ASSERT cpp.compilerDefinesByLanguage[\"cpp\"]: "
+ + cpp.compilerDefinesByLanguage["cpp"];
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/cpptest.cpp b/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/cpptest.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/cpptest.cpp
diff --git a/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/ctest.c b/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/ctest.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/ctest.c
diff --git a/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/compiler-include-paths.qbs b/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/compiler-include-paths.qbs
new file mode 100644
index 000000000..5c73302ad
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/compiler-include-paths.qbs
@@ -0,0 +1,9 @@
+import "../BareMetalApplication.qbs" as BareMetalApplication
+
+BareMetalApplication {
+ files: ["main.c"]
+ property bool dummy: {
+ console.info("compilerIncludePaths: %%" + cpp.compilerIncludePaths + "%%");
+ return true;
+ }
+}
diff --git a/tests/auto/blackbox/testdata-baremetal/generate-linker-map/main.c b/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/main.c
index 58fe69254..58fe69254 100644
--- a/tests/auto/blackbox/testdata-baremetal/generate-linker-map/main.c
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/main.c
diff --git a/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/generate-compiler-listing.qbs b/tests/auto/blackbox/testdata-baremetal/compiler-listing/compiler-listing.qbs
index a6731d224..bcf983c88 100644
--- a/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/generate-compiler-listing.qbs
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-listing/compiler-listing.qbs
@@ -3,14 +3,12 @@ import "../BareMetalApplication.qbs" as BareMetalApplication
BareMetalApplication {
condition: {
if (!qbs.toolchain.contains("gcc")) {
- if (cpp.compilerName.startsWith("armcc"))
- console.info("using short listing file names");
+ console.info("compiler listing suffix: %%" + cpp.compilerListingSuffix + "%%");
return true;
}
console.info("unsupported toolset: %%"
+ qbs.toolchainType + "%%, %%" + qbs.architecture + "%%");
return false;
}
- cpp.generateCompilerListingFiles: true
files: ["main.c", "fun.c"]
}
diff --git a/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/fun.c b/tests/auto/blackbox/testdata-baremetal/compiler-listing/fun.c
index 3b8c8f2f4..3b8c8f2f4 100644
--- a/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/fun.c
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-listing/fun.c
diff --git a/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/main.c b/tests/auto/blackbox/testdata-baremetal/compiler-listing/main.c
index 2c3d7726c..2c3d7726c 100644
--- a/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/main.c
+++ b/tests/auto/blackbox/testdata-baremetal/compiler-listing/main.c
diff --git a/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/do-not-generate-compiler-listing.qbs b/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/do-not-generate-compiler-listing.qbs
deleted file mode 100644
index 1bc4ba208..000000000
--- a/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/do-not-generate-compiler-listing.qbs
+++ /dev/null
@@ -1,16 +0,0 @@
-import "../BareMetalApplication.qbs" as BareMetalApplication
-
-BareMetalApplication {
- condition: {
- if (!qbs.toolchain.contains("gcc")) {
- if (cpp.compilerName.startsWith("armcc"))
- console.info("using short listing file names");
- return true;
- }
- console.info("unsupported toolset: %%"
- + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%");
- return false;
- }
- cpp.generateCompilerListingFiles: false
- files: ["main.c", "fun.c"]
-}
diff --git a/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/do-not-generate-linker-map.qbs b/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/do-not-generate-linker-map.qbs
deleted file mode 100644
index 0ff952b22..000000000
--- a/tests/auto/blackbox/testdata-baremetal/do-not-generate-linker-map/do-not-generate-linker-map.qbs
+++ /dev/null
@@ -1,11 +0,0 @@
-import "../BareMetalApplication.qbs" as BareMetalApplication
-
-BareMetalApplication {
- condition: {
- console.info("current toolset: %%"
- + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%");
- return true;
- }
- cpp.generateLinkerMapFile: false
- files: ["main.c"]
-}
diff --git a/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs b/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs
index 6fbbb8647..fffb6a03d 100644
--- a/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs
+++ b/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs
@@ -2,20 +2,6 @@ import "../BareMetalApplication.qbs" as BareMetalApplication
import "../BareMetalStaticLibrary.qbs" as BareMetalStaticLibrary
Project {
- condition: {
- // The KEIL C51/C251/C166 toolchains support only a
- // full paths to the external libraries.
- if (qbs.toolchainType === "keil") {
- if (qbs.architecture === "mcs51"
- || qbs.architecture === "mcs251"
- || qbs.architecture === "c166") {
- console.info("unsupported toolset: %%"
- + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%");
- return false;
- }
- }
- return true;
- }
property string outputLibrariesDirectory: sourceDirectory + "/libs"
BareMetalStaticLibrary {
name: "lib-a"
diff --git a/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/main.c b/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/main.c
deleted file mode 100644
index 2c3d7726c..000000000
--- a/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/main.c
+++ /dev/null
@@ -1,6 +0,0 @@
-extern int f(void);
-
-int main(void)
-{
- return f();
-}
diff --git a/tests/auto/blackbox/testdata-baremetal/generate-linker-map/generate-linker-map.qbs b/tests/auto/blackbox/testdata-baremetal/generate-linker-map/generate-linker-map.qbs
deleted file mode 100644
index a6ab5ba32..000000000
--- a/tests/auto/blackbox/testdata-baremetal/generate-linker-map/generate-linker-map.qbs
+++ /dev/null
@@ -1,11 +0,0 @@
-import "../BareMetalApplication.qbs" as BareMetalApplication
-
-BareMetalApplication {
- condition: {
- console.info("current toolset: %%"
- + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%");
- return true;
- }
- cpp.generateLinkerMapFile: true
- files: ["main.c"]
-}
diff --git a/tests/auto/blackbox/testdata-baremetal/linker-map/linker-map.qbs b/tests/auto/blackbox/testdata-baremetal/linker-map/linker-map.qbs
new file mode 100644
index 000000000..fe93ac144
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/linker-map/linker-map.qbs
@@ -0,0 +1,8 @@
+import "../BareMetalApplication.qbs" as BareMetalApplication
+
+BareMetalApplication {
+ property bool dummy: {
+ console.info("linker map suffix: %%" + cpp.linkerMapSuffix + "%%");
+ }
+ files: ["main.c"]
+}
diff --git a/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/fun.c b/tests/auto/blackbox/testdata-baremetal/linker-map/main.c
index 3b8c8f2f4..58fe69254 100644
--- a/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/fun.c
+++ b/tests/auto/blackbox/testdata-baremetal/linker-map/main.c
@@ -1,4 +1,4 @@
-int f(void)
+int main(void)
{
return 0;
}
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs12-iar.s b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs12-iar.s
new file mode 100644
index 000000000..4344e757f
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs12-iar.s
@@ -0,0 +1,7 @@
+ PUBLIC main
+ RSEG CODE:CODE:REORDER:NOROOT(0)
+main:
+ CLRB
+ CLRA
+ RTS
+ END
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-iar.s b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-iar.s
new file mode 100644
index 000000000..883dfdcad
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-iar.s
@@ -0,0 +1,6 @@
+ PUBLIC main
+ RSEG CODE:CODE:REORDER:NOROOT(0)
+main:
+ LDHX #0x0000
+ RTS
+ END
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-sdcc.s b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-sdcc.s
new file mode 100644
index 000000000..f47fed1be
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-sdcc.s
@@ -0,0 +1,6 @@
+ .globl main
+ .area DSEG (PAG)
+ .area HOME (CODE)
+main:
+ clra
+ tax
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m32c-iar.s b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m32c-iar.s
new file mode 100644
index 000000000..4153f290e
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m32c-iar.s
@@ -0,0 +1,6 @@
+ PUBLIC main
+ RSEG CODE:CODE:REORDER:NOROOT(0)
+main:
+ MOV.W #0x0, R0
+ RTS
+ END
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-iar.s b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-iar.s
new file mode 100644
index 000000000..9811be134
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-iar.s
@@ -0,0 +1,6 @@
+ PUBLIC main
+ RSEG FCODE:CODE:NOROOT(1)
+main:
+ CLR.L D0
+ RTS
+ END
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs
index 7650810a9..ed38f79b6 100644
--- a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs
@@ -40,11 +40,25 @@ BareMetalApplication {
return true;
if (qbs.architecture === "m16c")
return true;
+ if (qbs.architecture === "hcs8")
+ return true;
+ if (qbs.architecture === "hcs12")
+ return true;
+ if (qbs.architecture === "rx")
+ return true;
+ if (qbs.architecture === "m32c")
+ return true;
+ if (qbs.architecture === "riscv")
+ return true;
+ if (qbs.architecture === "m68k")
+ return true;
} else if (qbs.toolchainType === "sdcc") {
if (qbs.architecture === "mcs51")
return true;
if (qbs.architecture === "stm8")
return true;
+ if (qbs.architecture === "hcs8")
+ return true;
} else if (qbs.toolchainType === "gcc") {
if (qbs.architecture.startsWith("arm"))
return true;
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/riscv-iar.s b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/riscv-iar.s
new file mode 100644
index 000000000..e19fdfddb
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/riscv-iar.s
@@ -0,0 +1,7 @@
+ PUBLIC main
+ SECTION `.text`:CODE:REORDER:NOROOT(2)
+ CODE
+main:
+ MV A0, ZERO
+ RET
+ END
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rx-iar.s b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rx-iar.s
new file mode 100644
index 000000000..cc1573431
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rx-iar.s
@@ -0,0 +1,5 @@
+ PUBLIC _main
+ SECTION CODE:CODE:ROOT(2)
+_main:
+ BRA _main
+ END
diff --git a/tests/auto/blackbox/testdata/dynamicRuleOutputs/before/flexoptionsreader.js b/tests/auto/blackbox/testdata/dynamicRuleOutputs/before/flexoptionsreader.js
index bd596fbca..b925effcf 100644
--- a/tests/auto/blackbox/testdata/dynamicRuleOutputs/before/flexoptionsreader.js
+++ b/tests/auto/blackbox/testdata/dynamicRuleOutputs/before/flexoptionsreader.js
@@ -35,7 +35,7 @@
**
****************************************************************************/
-// needs import qbs.TextFile
+var TextFile = require("qbs.TextFile");
function readFlexOptions(filePath)
{
@@ -82,7 +82,7 @@ function readFlexOptions(filePath)
}
}
- var tf = new TextFile(input.filePath);
+ var tf = new TextFile(filePath);
var line;
var optrex = /^%option\s+(.*$)/;
var res;
diff --git a/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs b/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs
index acafdb52b..62871698e 100644
--- a/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs
+++ b/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs
@@ -61,7 +61,7 @@ Product {
if (lhs.length !== rhs.length)
return false;
for (var i = 0; i < lhs.length; ++i) {
- if (Array.isArray(lhs[i]) && Array.isArray(rhs[i])) {
+ if ((lhs[i] instanceof Array) && (rhs[i] instanceof Array)) {
if (!compareArrays(lhs[i], rhs[i]))
return false;
} else if (FileInfo.resolvePath(path, lhs[i]) !== FileInfo.resolvePath(path, rhs[i])) {
diff --git a/tests/auto/blackbox/testdata/undefined-target-platform/undefined-target-platform.qbs b/tests/auto/blackbox/testdata/undefined-target-platform/undefined-target-platform.qbs
index 2b3724c26..4a738afcc 100644
--- a/tests/auto/blackbox/testdata/undefined-target-platform/undefined-target-platform.qbs
+++ b/tests/auto/blackbox/testdata/undefined-target-platform/undefined-target-platform.qbs
@@ -6,7 +6,7 @@ Product {
qbs.targetPlatform: undefined
readonly property bool _validate: {
- if (Array.isArray(qbs.targetOS) && qbs.targetOS.length === 0)
+ if ((qbs.targetOS instanceof Array) && qbs.targetOS.length === 0)
return true;
throw "Invalid qbs.targetOS value: " + qbs.targetOS;
}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 20116ff56..1b9fa0b15 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -2173,7 +2173,7 @@ void TestBlackbox::trackExternalProductChanges()
const QStringList toolchainTypes = profileToolchain(profile);
if (!toolchainTypes.contains("gcc"))
QSKIP("Need GCC-like compiler to run this test");
- params.environment = QProcessEnvironment::systemEnvironment();
+ params.environment = QbsRunParameters::defaultEnvironment();
params.environment.insert("INCLUDE_PATH_TEST", "1");
params.expectFailure = true;
QVERIFY(runQbs(params) != 0);
@@ -3598,16 +3598,14 @@ void TestBlackbox::propertyEvaluationContext()
void TestBlackbox::qtBug51237()
{
- const QString profileName = "profile-qtBug51237";
- const QString propertyName = "mymodule.theProperty";
- {
- const SettingsPtr s = settings();
- Profile profile(profileName, s.get());
- profile.setValue(propertyName, QStringList());
- }
+ const SettingsPtr s = settings();
+ qbs::Internal::TemporaryProfile profile("qbs_autotests_qtBug51237", s.get());
+ profile.p.setValue("mymodule.theProperty", QStringList());
+ s->sync();
+
QDir::setCurrent(testDataDir + "/QTBUG-51237");
QbsRunParameters params;
- params.profile = profileName;
+ params.profile = profile.p.name();
QCOMPARE(runQbs(params), 0);
}
@@ -6054,7 +6052,7 @@ void TestBlackbox::qbsSession()
QJsonObject overriddenValues;
overriddenValues.insert("products.theLib.cpp.cxxLanguageVersion", "c++17");
resolveMessage.insert("overridden-properties", overriddenValues);
- resolveMessage.insert("environment", envToJson(QProcessEnvironment::systemEnvironment()));
+ resolveMessage.insert("environment", envToJson(QbsRunParameters::defaultEnvironment()));
resolveMessage.insert("data-mode", "only-if-changed");
resolveMessage.insert("log-time", true);
resolveMessage.insert("module-properties",
diff --git a/tests/auto/blackbox/tst_blackboxandroid.cpp b/tests/auto/blackbox/tst_blackboxandroid.cpp
index a03c9e318..f8ed8a0b9 100644
--- a/tests/auto/blackbox/tst_blackboxandroid.cpp
+++ b/tests/auto/blackbox/tst_blackboxandroid.cpp
@@ -268,14 +268,19 @@ void TestBlackboxAndroid::android_data()
return result;
};
- auto commonFiles = [](bool generateAab) {
+ auto commonFiles = [](bool generateAab, bool codeSign = true,
+ QString keyAlias="androiddebugkey") {
+ QByteArrayList files;
if (generateAab)
- return (QByteArrayList()
- << "base/manifest/AndroidManifest.xml" << "base/dex/classes.dex"
- << "BundleConfig.pb");
- return (QByteArrayList()
- << "AndroidManifest.xml" << "META-INF/ANDROIDD.RSA" << "META-INF/ANDROIDD.SF"
- << "META-INF/MANIFEST.MF" << "classes.dex");
+ files << "base/manifest/AndroidManifest.xml" << "base/dex/classes.dex"
+ << "BundleConfig.pb";
+ else
+ files << "AndroidManifest.xml" << "classes.dex";
+ if (codeSign)
+ files << QByteArray("META-INF/" + keyAlias.toUpper().left(8).toUtf8() + ".RSA")
+ << QByteArray("META-INF/" + keyAlias.toUpper().left(8).toUtf8() + ".SF")
+ << "META-INF/MANIFEST.MF";
+ return files;
};
QTest::addColumn<QString>("projectDir");
@@ -296,10 +301,11 @@ void TestBlackboxAndroid::android_data()
bool generateAab = false;
bool isIncrementalBuild = false;
- auto qtAppExpectedFiles = [&](bool generateAab, bool enableAapt2) {
+ auto qtAppExpectedFiles = [&](bool generateAab, bool enableAapt2, bool codeSign = true,
+ QString keyAlias="androiddebugkey") {
QByteArrayList expectedFile;
if (singleArchQt) {
- expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, {
+ expectedFile << commonFiles(generateAab, codeSign, keyAlias) + expandArchs(ndkArchsForQt, {
cxxLibPath("libgnustl_shared.so", true),
"assets/--Added-by-androiddeployqt--/qt_cache_pregenerated_file_list",
"lib/${ARCH}/libplugins_imageformats_libqgif.so",
@@ -317,7 +323,7 @@ void TestBlackboxAndroid::android_data()
"lib/${ARCH}/libQt5Widgets.so",
"lib/${ARCH}/libqt-app.so"}, generateAab);
} else {
- expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, {
+ expectedFile << commonFiles(generateAab, codeSign, keyAlias) + expandArchs(ndkArchsForQt, {
cxxLibPath("libgnustl_shared.so", true),
"lib/${ARCH}/libplugins_imageformats_qgif_${ARCH}.so",
"lib/${ARCH}/libplugins_imageformats_qico_${ARCH}.so",
@@ -329,7 +335,7 @@ void TestBlackboxAndroid::android_data()
"lib/${ARCH}/libqt-app_${ARCH}.so"}, generateAab);
}
if (generateAab)
- expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb";
+ expectedFile << "base/resources.pb" << "base/native.pb";
else
expectedFile << "resources.arsc";
if (version >= qbs::Version(5, 14))
@@ -346,11 +352,82 @@ void TestBlackboxAndroid::android_data()
expectedFile << "res/layout/splash.xml";
return expectedFile;
};
+ auto codeSignProperties = [&](bool codeSign, QString keyStorePath, QString keystorePassword,
+ QString keyPassword, QString keyAlias) {
+ if (!codeSign)
+ return QStringList{"modules.codesign.enableCodeSigning:false"};
+ return QStringList{
+ "modules.codesign.enableCodeSigning:true",
+ "modules.codesign.keystorePath:" + keyStorePath,
+ "modules.codesign.keystorePassword:" + keystorePassword,
+ "modules.codesign.keyPassword:" + keyPassword,
+ "modules.codesign.keyAlias:" + keyAlias,
+ };
+ };
+ bool codeSign = true;
+ QString keyStorePath(testDataDir + "/qt-app/test.keystore");
+ QString keystorePassword("qbsKeystoreTest");
+ QString keyPassword("qbsKeyTest");
+ QString keyAlias("qbsTest");
QTest::newRow("qt app")
<< "qt-app" << QStringList("qt-app")
<< (QList<QByteArrayList>() << (QByteArrayList() << qtAppExpectedFiles(generateAab,
- enableAapt2)))
- << QStringList{aaptVersion(enableAapt2), packageType(generateAab)}
+ enableAapt2,
+ codeSign,
+ keyAlias)))
+ << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword,
+ keyPassword, keyAlias)
+ << aaptVersion(enableAapt2)
+ << packageType(generateAab))
+ << enableAapt2 << generateAab << isIncrementalBuild;
+ codeSign = false;
+ QTest::newRow("qt app no signing")
+ << "qt-app" << QStringList("qt-app")
+ << (QList<QByteArrayList>() << (QByteArrayList() << qtAppExpectedFiles(generateAab,
+ enableAapt2,
+ codeSign,
+ keyAlias)))
+ << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword,
+ keyPassword, keyAlias)
+ << aaptVersion(enableAapt2)
+ << packageType(generateAab))
+ << enableAapt2 << generateAab << isIncrementalBuild;
+ enableAapt2 = true;
+ codeSign = true;
+ QTest::newRow("qt app aapt2")
+ << "qt-app" << QStringList("qt-app")
+ << (QList<QByteArrayList>() << (QByteArrayList() << qtAppExpectedFiles(generateAab,
+ enableAapt2,
+ codeSign,
+ keyAlias)))
+ << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword,
+ keyPassword, keyAlias)
+ << aaptVersion(enableAapt2)
+ << packageType(generateAab))
+ << enableAapt2 << generateAab << isIncrementalBuild;
+ generateAab = true;
+ QTest::newRow("qt app aab")
+ << "qt-app" << QStringList("qt-app")
+ << (QList<QByteArrayList>() << (QByteArrayList() << qtAppExpectedFiles(generateAab,
+ enableAapt2,
+ codeSign,
+ keyAlias)))
+ << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword,
+ keyPassword, keyAlias)
+ << aaptVersion(enableAapt2)
+ << packageType(generateAab))
+ << enableAapt2 << generateAab << isIncrementalBuild;
+ codeSign = false;
+ QTest::newRow("qt app aab no signing")
+ << "qt-app" << QStringList("qt-app")
+ << (QList<QByteArrayList>() << (QByteArrayList() << qtAppExpectedFiles(generateAab,
+ enableAapt2,
+ codeSign,
+ keyAlias)))
+ << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword,
+ keyPassword, keyAlias)
+ << aaptVersion(enableAapt2)
+ << packageType(generateAab))
<< enableAapt2 << generateAab << isIncrementalBuild;
const QByteArrayList ndkArchsForQtSave = ndkArchsForQt;
@@ -383,6 +460,8 @@ void TestBlackboxAndroid::android_data()
return expectedFile;
};
+ generateAab = false;
+ enableAapt2 = false;
QTest::newRow("teapot")
<< "teapot" << QStringList("TeapotNativeActivity")
<< (QList<QByteArrayList>() << teaPotAppExpectedFiles(archs, generateAab))
@@ -437,6 +516,7 @@ void TestBlackboxAndroid::android_data()
"modules.qbs.architecture:" + archsStringList.first(),
aaptVersion(enableAapt2), packageType(generateAab)}
<< enableAapt2 << generateAab << isIncrementalBuild;
+
auto qmlAppExpectedFiles = [&](bool generateAab, bool enableAapt2) {
QByteArrayList expectedFile;
if (singleArchQt) {
@@ -730,7 +810,6 @@ void TestBlackboxAndroid::android_data()
} else {
qmlAppCustomProperties = QStringList{"modules.Android.sdk.automaticSources:false"};
}
-
// aapt tool for the resources works with a directory option pointing to the parent directory
// of the resources (res).
// The Qt.android_support module adds res/values/libs.xml (from Qt install dir). So the res from
@@ -851,6 +930,7 @@ void TestBlackboxAndroid::android_data()
expectedFile << "resources.arsc";
return expectedFile;
};
+
QTest::newRow("no native")
<< "no-native"
<< QStringList("com.example.android.basicmediadecoder")
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index e62eb3391..884d2c077 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -140,6 +140,39 @@ static QString findFatLibrary(const QString &dir, const QString &libraryName)
return {};
}
+enum class CodeSignResult { Failed = 0, Signed, Unsigned };
+using CodeSignData = QMap<QByteArray, QByteArray>;
+static std::pair<CodeSignResult, CodeSignData> parseCodeSignOutput(const QByteArray &output)
+{
+ CodeSignData data;
+ if (output.contains("code object is not signed at all"))
+ return {CodeSignResult::Unsigned, data};
+ const auto lines = output.split('\n');
+ for (const auto &line: lines) {
+ if (line.isEmpty()
+ || line.startsWith("CodeDirectory")
+ || line.startsWith("Sealed Resources")
+ || line.startsWith("Internal requirements")) {
+ continue;
+ }
+ const int index = line.indexOf('=');
+ if (index == -1)
+ return {CodeSignResult::Failed, {}};
+ data[line.mid(0, index)] = line.mid(index + 1);
+ }
+ return {CodeSignResult::Signed, data};
+}
+
+static std::pair<CodeSignResult, CodeSignData> getCodeSignInfo(const QString &path)
+{
+ QProcess codesign;
+ codesign.start("codesign", { QStringLiteral("-dv"), path });
+ if (!codesign.waitForStarted() || !codesign.waitForFinished())
+ return {CodeSignResult::Failed, {}};
+ const auto output = codesign.readAllStandardError();
+ return parseCodeSignOutput(output);
+}
+
TestBlackboxApple::TestBlackboxApple()
: TestBlackboxBase (SRCDIR "/testdata-apple", "blackbox-apple")
{
@@ -273,7 +306,7 @@ void TestBlackboxApple::aggregateDependencyLinking()
const auto xcodeVersion = findXcodeVersion();
// XCode 11 produces warning about deprecation of 32-bit apps, but still works
const bool hasX86Mac = xcodeVersion < qbs::Version(12);
- const bool hasArmMac = false;
+ const bool hasArmMac = xcodeVersion >= qbs::Version(12, 2);
QDir::setCurrent(testDataDir + "/aggregateDependencyLinking");
QbsRunParameters params{QStringList{"-p", "multi_arch_lib"}};
@@ -680,6 +713,85 @@ void TestBlackboxApple::bundleStructure_data()
QTest::newRow("G") << "G" << "com.apple.product-type.in-app-purchase-content";
}
+void TestBlackboxApple::codesign()
+{
+ QFETCH(bool, isBundle);
+ QFETCH(bool, enableSigning);
+ QFETCH(bool, multiArch);
+
+ const auto xcodeVersion = findXcodeVersion();
+
+ QDir::setCurrent(testDataDir + "/codesign");
+ QbsRunParameters params(QStringList{"qbs.installPrefix:''"});
+ params.arguments
+ << QStringLiteral("project.isBundle:%1").arg(isBundle ? "true" : "false");
+ params.arguments
+ << QStringLiteral("project.enableSigning:%1").arg(enableSigning ? "true" : "false");
+ if (multiArch)
+ params.arguments << QStringLiteral("project.xcodeVersion:") + xcodeVersion.toString();
+
+ rmDirR(relativeBuildDir());
+ QCOMPARE(runQbs(params), 0);
+
+ const int codeSignCount =
+ QString::fromUtf8(m_qbsStdout).count(QStringLiteral("codesign"));
+ // We have 3 products, we have to sign each exactly once, even in the multiplexed case
+ QCOMPARE(codeSignCount, enableSigning ? 3 : 0);
+
+ const auto appName = isBundle ? QStringLiteral("A.app") : QStringLiteral("A");
+ const auto appPath = defaultInstallRoot + "/" + appName;
+ QVERIFY(QFileInfo(appPath).exists());
+ auto codeSignInfo = getCodeSignInfo(appPath);
+ QVERIFY(codeSignInfo.first != CodeSignResult::Failed);
+ QCOMPARE(codeSignInfo.first == CodeSignResult::Signed, enableSigning);
+ QCOMPARE(codeSignInfo.second.isEmpty(), !enableSigning);
+ if (!codeSignInfo.second.isEmpty()) {
+ QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Executable")));
+ QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Identifier")));
+ QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc");
+ }
+
+ const auto libName = isBundle ? QStringLiteral("B.framework") : QStringLiteral("libB.dylib");
+ const auto libPath = defaultInstallRoot + "/" + libName;
+ QVERIFY(QFileInfo(libPath).exists());
+ codeSignInfo = getCodeSignInfo(libPath);
+ QVERIFY(codeSignInfo.first != CodeSignResult::Failed);
+ QCOMPARE(codeSignInfo.first == CodeSignResult::Signed, enableSigning);
+ QCOMPARE(codeSignInfo.second.isEmpty(), !enableSigning);
+ if (!codeSignInfo.second.isEmpty()) {
+ QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Executable")));
+ QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Identifier")));
+ QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc");
+ }
+
+ const auto pluginPath = defaultInstallRoot + "/" + QStringLiteral("C.bundle");
+ QVERIFY(QFileInfo(pluginPath).exists());
+ QVERIFY(QFileInfo(pluginPath).isDir() == isBundle);
+ codeSignInfo = getCodeSignInfo(pluginPath);
+ QVERIFY(codeSignInfo.first != CodeSignResult::Failed);
+ QCOMPARE(codeSignInfo.first == CodeSignResult::Signed, enableSigning);
+ QCOMPARE(codeSignInfo.second.isEmpty(), !enableSigning);
+ if (!codeSignInfo.second.isEmpty()) {
+ QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Executable")));
+ QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Identifier")));
+ QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc");
+ }
+}
+
+void TestBlackboxApple::codesign_data()
+{
+ QTest::addColumn<bool>("isBundle");
+ QTest::addColumn<bool>("enableSigning");
+ QTest::addColumn<bool>("multiArch");
+
+ QTest::newRow("bundle, unsigned") << true << false << false;
+ QTest::newRow("standalone, unsigned") << false << false << false;
+ QTest::newRow("bundle, signed") << true << true << false;
+ QTest::newRow("standalone, signed") << false << true << false;
+ QTest::newRow("bundle, signed, multiarch") << true << true << true;
+ QTest::newRow("standalone, signed, multiarch") << false << true << true;
+}
+
void TestBlackboxApple::deploymentTarget()
{
QFETCH(QString, sdk);
diff --git a/tests/auto/blackbox/tst_blackboxapple.h b/tests/auto/blackbox/tst_blackboxapple.h
index eeaa28d2f..32eee2432 100644
--- a/tests/auto/blackbox/tst_blackboxapple.h
+++ b/tests/auto/blackbox/tst_blackboxapple.h
@@ -55,6 +55,8 @@ private slots:
void assetCatalogsMultiple();
void bundleStructure();
void bundleStructure_data();
+ void codesign();
+ void codesign_data();
void deploymentTarget();
void deploymentTarget_data();
void dmg();
diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
index 41f50a0ed..e0a068bc6 100644
--- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp
+++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
@@ -32,6 +32,7 @@
#include "../shared.h"
+#include <QtCore/qdir.h>
#include <QtCore/qregularexpression.h>
static bool extractToolset(const QByteArray &output,
@@ -47,6 +48,27 @@ static bool extractToolset(const QByteArray &output,
return true;
}
+static bool extractCompilerIncludePaths(const QByteArray &output, QStringList &compilerIncludePaths)
+{
+ const QRegularExpression re("%%([^%%]+)%%");
+ QRegularExpressionMatchIterator it = re.globalMatch(output);
+ if (!it.hasNext())
+ return false;
+ const QRegularExpressionMatch match = it.next();
+ compilerIncludePaths = match.captured(1).split(",");
+ return true;
+}
+
+static bool extractQuitedValue(const QByteArray &output, QString &pattern)
+{
+ const QRegularExpression re("%%(.+)%%");
+ const QRegularExpressionMatch match = re.match(output);
+ if (!match.hasMatch())
+ return false;
+ pattern = match.captured(1);
+ return true;
+}
+
static QByteArray unsupportedToolsetMessage(const QByteArray &output)
{
QByteArray toolchain;
@@ -56,17 +78,6 @@ static QByteArray unsupportedToolsetMessage(const QByteArray &output)
+ "' for architecture '" + architecture + "'";
}
-static QString linkerMapFileExtension(const QByteArray &toolchain, const QByteArray &architecture)
-{
- if (toolchain == "keil") {
- if (architecture == "mcs51")
- return QStringLiteral(".m51");
- if (architecture == "c166")
- return QStringLiteral(".m66");
- }
- return QStringLiteral(".map");
-}
-
TestBlackboxBareMetal::TestBlackboxBareMetal()
: TestBlackboxBase (SRCDIR "/testdata-baremetal", "blackbox-baremetal")
{
@@ -142,6 +153,22 @@ void TestBlackboxBareMetal::distributionIncludePaths()
QCOMPARE(runQbs(), 0);
}
+void TestBlackboxBareMetal::compilerIncludePaths()
+{
+ QDir::setCurrent(testDataDir + "/compiler-include-paths");
+ QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
+ if (!m_qbsStdout.contains("compilerIncludePaths:"))
+ QFAIL("No compiler include paths exists");
+
+ QStringList includePaths;
+ QVERIFY(extractCompilerIncludePaths(m_qbsStdout, includePaths));
+ QVERIFY(includePaths.count() > 0);
+ for (const auto &includePath : includePaths) {
+ const QDir dir(includePath);
+ QVERIFY(dir.exists());
+ }
+}
+
void TestBlackboxBareMetal::preincludeHeaders()
{
QDir::setCurrent(testDataDir + "/preinclude-headers");
@@ -159,61 +186,92 @@ void TestBlackboxBareMetal::defines()
void TestBlackboxBareMetal::compilerListingFiles_data()
{
- QTest::addColumn<QString>("testPath");
QTest::addColumn<bool>("generateListing");
- QTest::newRow("do-not-generate-compiler-listing") << "/do-not-generate-compiler-listing" << false;
- QTest::newRow("generate-compiler-listing") << "/generate-compiler-listing" << true;
+ QTest::addColumn<QString>("customListingSuffix");
+ QTest::newRow("do-not-generate-compiler-listing") << false << "";
+ QTest::newRow("generate-default-compiler-listing") << true << "";
+ QTest::newRow("generate-custom-compiler-listing") << true << ".lll";
}
void TestBlackboxBareMetal::compilerListingFiles()
{
- QFETCH(QString, testPath);
QFETCH(bool, generateListing);
- QDir::setCurrent(testDataDir + testPath);
- QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
+ QFETCH(QString, customListingSuffix);
+ QDir::setCurrent(testDataDir + "/compiler-listing");
+
+ rmDirR(relativeBuildDir());
+ QStringList args = {QStringLiteral("modules.cpp.generateCompilerListingFiles:%1")
+ .arg(generateListing ? "true" : "false")};
+ if (!customListingSuffix.isEmpty())
+ args << QStringLiteral("modules.cpp.compilerListingSuffix:%1").arg(customListingSuffix);
+
+ QCOMPARE(runQbs(QbsRunParameters("resolve", args)), 0);
if (m_qbsStdout.contains("unsupported toolset:"))
QSKIP(unsupportedToolsetMessage(m_qbsStdout));
- QCOMPARE(runQbs(), 0);
- const bool isShortListingNames = m_qbsStdout.contains("using short listing file names");
- const QString productName = testPath.mid(1);
- const QString productBuildDir = relativeProductBuildDir(productName);
+ if (!m_qbsStdout.contains("compiler listing suffix:"))
+ QFAIL("No current compiler listing suffix pattern exists");
+
+ QString compilerListingSuffix;
+ if (!extractQuitedValue(m_qbsStdout, compilerListingSuffix))
+ QFAIL("Unable to extract current compiler listing suffix");
+
+ if (!customListingSuffix.isEmpty())
+ QCOMPARE(compilerListingSuffix, customListingSuffix);
+
+ QCOMPARE(runQbs(QbsRunParameters(args)), 0);
+ const QString productBuildDir = relativeProductBuildDir("compiler-listing");
const QString hash = inputDirHash(".");
- const QString mainListing = productBuildDir + "/" + hash + (isShortListingNames ? "/main.lst" : "/main.c.lst");
+ const QString mainListing = productBuildDir + "/" + hash
+ + "/main.c" + compilerListingSuffix;
QCOMPARE(regularFileExists(mainListing), generateListing);
- const QString funListing = productBuildDir + "/" + hash + (isShortListingNames ? "/fun.lst" : "/fun.c.lst");
+ const QString funListing = productBuildDir + "/" + hash
+ + "/fun.c" + compilerListingSuffix;
QCOMPARE(regularFileExists(funListing), generateListing);
}
void TestBlackboxBareMetal::linkerMapFile_data()
{
- QTest::addColumn<QString>("testPath");
QTest::addColumn<bool>("generateMap");
- QTest::newRow("do-not-generate-linker-map") << "/do-not-generate-linker-map" << false;
- QTest::newRow("generate-linker-map") << "/generate-linker-map" << true;
+ QTest::addColumn<QString>("customMapSuffix");
+ QTest::newRow("do-not-generate-linker-map") << false << "";
+ QTest::newRow("generate-default-linker-map") << true << "";
+ QTest::newRow("generate-custom-linker-map") << true << ".mmm";
}
void TestBlackboxBareMetal::linkerMapFile()
{
- QFETCH(QString, testPath);
QFETCH(bool, generateMap);
- QDir::setCurrent(testDataDir + testPath);
- QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
- if (m_qbsStdout.contains("unsupported toolset:"))
- QSKIP(unsupportedToolsetMessage(m_qbsStdout));
- if (!m_qbsStdout.contains("current toolset:"))
- QFAIL("No current toolset pattern exists");
+ QFETCH(QString, customMapSuffix);
+ QDir::setCurrent(testDataDir + "/linker-map");
- QByteArray toolchain;
- QByteArray architecture;
- if (!extractToolset(m_qbsStdout, toolchain, architecture))
- QFAIL("Unable to extract current toolset");
+ rmDirR(relativeBuildDir());
+ QStringList args = {QStringLiteral("modules.cpp.generateLinkerMapFile:%1")
+ .arg(generateMap ? "true" : "false")};
+ if (!customMapSuffix.isEmpty())
+ args << QStringLiteral("modules.cpp.linkerMapSuffix:%1").arg(customMapSuffix);
- QCOMPARE(runQbs(), 0);
- const QString productName = testPath.mid(1);
- const QString productBuildDir = relativeProductBuildDir(productName);
- const auto extension = linkerMapFileExtension(toolchain, architecture);
- const QString linkerMap = productBuildDir + "/" + productName + extension;
+ QCOMPARE(runQbs(QbsRunParameters("resolve", args)), 0);
+ if (!m_qbsStdout.contains("linker map suffix:"))
+ QFAIL("No current linker map suffix pattern exists");
+
+ QString linkerMapSuffix;
+ if (!extractQuitedValue(m_qbsStdout, linkerMapSuffix))
+ QFAIL("Unable to extract current linker map suffix");
+
+ if (!customMapSuffix.isEmpty())
+ QCOMPARE(linkerMapSuffix, customMapSuffix);
+
+ QCOMPARE(runQbs(QbsRunParameters(args)), 0);
+ const QString productBuildDir = relativeProductBuildDir("linker-map");
+ const QString linkerMap = productBuildDir + "/linker-map" + linkerMapSuffix;
QCOMPARE(regularFileExists(linkerMap), generateMap);
}
+void TestBlackboxBareMetal::compilerDefinesByLanguage()
+{
+ QDir::setCurrent(testDataDir + "/compiler-defines-by-language");
+ QbsRunParameters params(QStringList{ "-f", "compiler-defines-by-language.qbs" });
+ QCOMPARE(runQbs(params), 0);
+}
+
QTEST_MAIN(TestBlackboxBareMetal)
diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.h b/tests/auto/blackbox/tst_blackboxbaremetal.h
index 3695cb1c3..39d2f36c9 100644
--- a/tests/auto/blackbox/tst_blackboxbaremetal.h
+++ b/tests/auto/blackbox/tst_blackboxbaremetal.h
@@ -52,6 +52,7 @@ private slots:
void userIncludePaths();
void systemIncludePaths();
void distributionIncludePaths();
+ void compilerIncludePaths();
void preincludeHeaders();
@@ -63,6 +64,8 @@ private slots:
void linkerMapFile_data();
void linkerMapFile();
+ void compilerDefinesByLanguage();
+
private:
};
diff --git a/tests/auto/blackbox/tst_blackboxbase.h b/tests/auto/blackbox/tst_blackboxbase.h
index ed9a233de..d020b7cd9 100644
--- a/tests/auto/blackbox/tst_blackboxbase.h
+++ b/tests/auto/blackbox/tst_blackboxbase.h
@@ -60,7 +60,14 @@ public:
expectCrash = false;
profile = profileName();
settingsDir = settings()->baseDirectory();
- environment = QProcessEnvironment::systemEnvironment();
+ environment = defaultEnvironment();
+ }
+
+ static QProcessEnvironment defaultEnvironment()
+ {
+ auto result = QProcessEnvironment::systemEnvironment();
+ result.insert(QStringLiteral("QBS_AUTOTEST_CODE_SIGNING_REQUIRED"), QStringLiteral("0"));
+ return result;
}
QString command;
diff --git a/tests/auto/buildgraph/buildgraph.qbs b/tests/auto/buildgraph/buildgraph.qbs
index 3fbb57575..c6414b688 100644
--- a/tests/auto/buildgraph/buildgraph.qbs
+++ b/tests/auto/buildgraph/buildgraph.qbs
@@ -1,6 +1,6 @@
import qbs
-QbsAutotest {
+QbsUnittest {
Depends { name: "qbsconsolelogger" }
testName: "buildgraph"
condition: qbsbuildconfig.enableUnitTests
diff --git a/tests/auto/language/language.qbs b/tests/auto/language/language.qbs
index 22fef1618..d3619a243 100644
--- a/tests/auto/language/language.qbs
+++ b/tests/auto/language/language.qbs
@@ -1,14 +1,9 @@
import qbs
import qbs.Utilities
-QbsAutotest {
+QbsUnittest {
Depends { name: "qbsversion" }
Depends { name: "qbsconsolelogger" }
- Depends {
- name: "Qt.script"
- condition: !qbsbuildconfig.useBundledQtScript
- required: false
- }
testName: "language"
condition: qbsbuildconfig.enableUnitTests
diff --git a/tests/auto/shared.h b/tests/auto/shared.h
index 8dced2062..e97fa9166 100644
--- a/tests/auto/shared.h
+++ b/tests/auto/shared.h
@@ -159,7 +159,10 @@ inline QByteArray diffText(const QByteArray &actual, const QByteArray &expected)
}
auto addLines = [&result, &n] (const QList<QByteArray> &lines) {
for (const QByteArray &line : qAsConst(lines)) {
- result += QStringLiteral("%1: %2\n").arg(n).arg(QString::fromUtf8(line));
+ result += QStringLiteral("%1: %2\n")
+ .arg(n)
+ .arg(QString::fromUtf8(line))
+ .toUtf8();
n++;
}
};
diff --git a/tests/auto/tools/tools.qbs b/tests/auto/tools/tools.qbs
index 64cced80e..384ba74eb 100644
--- a/tests/auto/tools/tools.qbs
+++ b/tests/auto/tools/tools.qbs
@@ -1,7 +1,7 @@
import qbs
import qbs.Utilities
-QbsAutotest {
+QbsUnittest {
Depends { name: "qbsversion" }
testName: "tools"
diff --git a/tests/auto/tools/tst_tools.cpp b/tests/auto/tools/tst_tools.cpp
index edf5a1308..92e0978b5 100644
--- a/tests/auto/tools/tst_tools.cpp
+++ b/tests/auto/tools/tst_tools.cpp
@@ -673,6 +673,30 @@ void TestTools::set_containsSet()
QVERIFY(set3.contains(set4));
}
+void TestTools::set_find()
+{
+ Set<QString> set1;
+
+ for (int i = 0; i < 500; ++i) {
+ QVERIFY(set1.find(QString::number(i)) == set1.end());
+ set1.insert(QString::number(i));
+ const auto it = set1.find(QString::number(i));
+ QVERIFY(it != set1.end());
+ QVERIFY(*it == QString::number(i));
+ }
+
+ QCOMPARE(set1.size(), size_t { 500 });
+
+ for (int j = 0; j < 500; ++j) {
+ int i = (j * 17) % 500;
+ const auto it = set1.find(QString::number(i));
+ QVERIFY(it != set1.end());
+ QVERIFY(*it == QString::number(i));
+ set1.remove(QString::number(i));
+ QVERIFY(set1.find(QString::number(i)) == set1.end());
+ }
+}
+
void TestTools::set_begin()
{
Set<int> set1;
diff --git a/tests/auto/tools/tst_tools.h b/tests/auto/tools/tst_tools.h
index bd8538be2..d1ba0a57b 100644
--- a/tests/auto/tools/tst_tools.h
+++ b/tests/auto/tools/tst_tools.h
@@ -79,6 +79,7 @@ private slots:
void set_remove();
void set_contains();
void set_containsSet();
+ void set_find();
void set_begin();
void set_end();
void set_insert();
diff --git a/tests/benchmarker/benchmarker.cpp b/tests/benchmarker/benchmarker.cpp
index 2cc442a72..3c5fcde4e 100644
--- a/tests/benchmarker/benchmarker.cpp
+++ b/tests/benchmarker/benchmarker.cpp
@@ -77,8 +77,8 @@ void Benchmarker::benchmark()
m_baseOutputDir.path() + "/benchmark-data." + m_oldCommit);
ValgrindRunner newDataRetriever(m_activities, m_testProject, newQbsBuildDir,
m_baseOutputDir.path() + "/benchmark-data." + m_newCommit);
- QFuture<void> oldFuture = QtConcurrent::run(&oldDataRetriever, &ValgrindRunner::run);
- QFuture<void> newFuture = QtConcurrent::run(&newDataRetriever, &ValgrindRunner::run);
+ QFuture<void> oldFuture = QtConcurrent::run([&oldDataRetriever]{ oldDataRetriever.run(); });
+ QFuture<void> newFuture = QtConcurrent::run([&newDataRetriever]{ newDataRetriever.run(); });
oldFuture.waitForFinished();
const auto oldValgrindResults = oldDataRetriever.results();
for (const ValgrindResult &valgrindResult : oldValgrindResults) {
diff --git a/tests/benchmarker/benchmarker.h b/tests/benchmarker/benchmarker.h
index 6313e8094..8c94e7f74 100644
--- a/tests/benchmarker/benchmarker.h
+++ b/tests/benchmarker/benchmarker.h
@@ -32,12 +32,9 @@
#include <QtCore/qhash.h>
#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
#include <QtCore/qtemporarydir.h>
-QT_BEGIN_NAMESPACE
-class QStringList;
-QT_END_NAMESPACE
-
namespace qbsBenchmarker {
class BenchmarkResult
diff --git a/tests/benchmarker/runsupport.h b/tests/benchmarker/runsupport.h
index 6ee831007..39f485a02 100644
--- a/tests/benchmarker/runsupport.h
+++ b/tests/benchmarker/runsupport.h
@@ -30,10 +30,10 @@
#include <QtCore/qglobal.h>
#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
class QByteArray;
-class QStringList;
QT_END_NAMESPACE
namespace qbsBenchmarker {
diff --git a/tests/benchmarker/valgrindrunner.cpp b/tests/benchmarker/valgrindrunner.cpp
index 174781318..72745dc16 100644
--- a/tests/benchmarker/valgrindrunner.cpp
+++ b/tests/benchmarker/valgrindrunner.cpp
@@ -59,11 +59,11 @@ void ValgrindRunner::run()
{
std::deque<QFuture<void>> futures;
if (m_activities & ActivityResolving)
- futures.push_back(QtConcurrent::run(this, &ValgrindRunner::traceResolving));
+ futures.push_back(QtConcurrent::run([this]{ traceResolving(); }));
if (m_activities & ActivityRuleExecution)
- futures.push_back(QtConcurrent::run(this, &ValgrindRunner::traceRuleExecution));
+ futures.push_back(QtConcurrent::run([this]{ traceRuleExecution(); }));
if (m_activities & ActivityNullBuild)
- futures.push_back(QtConcurrent::run(this, &ValgrindRunner::traceNullBuild));
+ futures.push_back(QtConcurrent::run([this]{ traceNullBuild(); }));
while (!futures.empty()) {
futures.front().waitForFinished();
futures.pop_front();
@@ -100,12 +100,11 @@ void ValgrindRunner::traceActivity(Activity activity, const QString &buildDirCal
{
QString activityString;
QString qbsCommand;
- bool dryRun;
+ bool dryRun = false;
switch (activity) {
case ActivityResolving:
activityString = "resolving";
qbsCommand = "resolve";
- dryRun = false;
break;
case ActivityRuleExecution:
activityString = "rule-execution";
@@ -115,16 +114,21 @@ void ValgrindRunner::traceActivity(Activity activity, const QString &buildDirCal
case ActivityNullBuild:
activityString = "null-build";
qbsCommand = "build";
- dryRun = false;
break;
}
const QString outFileCallgrind = m_baseOutputDir + "/outfile." + activityString + ".callgrind";
const QString outFileMassif = m_baseOutputDir + "/outfile." + activityString + ".massif";
- QFuture<qint64> callGrindFuture = QtConcurrent::run(this, &ValgrindRunner::runCallgrind,
- qbsCommand, buildDirCallgrind, dryRun, outFileCallgrind);
- QFuture<qint64> massifFuture = QtConcurrent::run(this, &ValgrindRunner::runMassif, qbsCommand,
- buildDirMassif, dryRun, outFileMassif);
+ QFuture<qint64> callGrindFuture = QtConcurrent::run(
+ [this, qbsCommand, buildDirCallgrind, dryRun, outFileCallgrind]
+ {
+ return runCallgrind(qbsCommand, buildDirCallgrind, dryRun, outFileCallgrind);
+ });
+ QFuture<qint64> massifFuture = QtConcurrent::run(
+ [this, qbsCommand, buildDirMassif, dryRun, outFileMassif]
+ {
+ return runMassif(qbsCommand, buildDirMassif, dryRun, outFileMassif);
+ });
callGrindFuture.waitForFinished();
massifFuture.waitForFinished();
addToResults(ValgrindResult(activity, callGrindFuture.result(), massifFuture.result()));
diff --git a/tests/benchmarker/valgrindrunner.h b/tests/benchmarker/valgrindrunner.h
index 378723868..c83fea468 100644
--- a/tests/benchmarker/valgrindrunner.h
+++ b/tests/benchmarker/valgrindrunner.h
@@ -30,15 +30,10 @@
#include "activities.h"
-#include <QtCore/qlist.h>
-#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
#include <mutex>
-QT_BEGIN_NAMESPACE
-class QStringList;
-QT_END_NAMESPACE
-
namespace qbsBenchmarker {
class ValgrindResult
diff --git a/tests/fuzzy-test/fuzzytester.cpp b/tests/fuzzy-test/fuzzytester.cpp
index 2af8c6898..f38ad4736 100644
--- a/tests/fuzzy-test/fuzzytester.cpp
+++ b/tests/fuzzy-test/fuzzytester.cpp
@@ -67,7 +67,7 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit,
qDebug("Found buildable start commit %s.", qPrintable(workingStartCommit));
QStringList allCommits = findAllCommits(workingStartCommit);
qDebug("The test set comprises all %d commits between the start commit and HEAD.",
- allCommits.size());
+ int(allCommits.size()));
// Shuffle the initial sequence. Otherwise all invocations of the tool with the same start
// commit would try the same sequence of commits.
@@ -94,7 +94,7 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit,
m_currentCommit = currentCommit;
buildSequence << currentCommit;
checkoutCommit(currentCommit);
- qDebug("Testing incremental build #%d (%s)", buildSequence.size() - 1,
+ qDebug("Testing incremental build #%d (%s)", int(buildSequence.size()) - 1,
qPrintable(currentCommit));
// Doing "resolve" and "build" separately introduces additional possibilities