aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weickelt <richard@weickelt.de>2020-03-24 20:13:11 +0100
committerRichard Weickelt <richard@weickelt.de>2020-03-31 11:44:22 +0000
commit8f94acaf72b9659a376211377a0ef446ed391a30 (patch)
treec63487a2a9f9c2d4ba12b2d5f6398017cc66c4ab
parent5d3c76df23a5a9857803217ec4e0407bc8958b75 (diff)
Export framework search path in qtscxml blackbox test on macOS
The qtscxml testcase builds a Qt binary and runs it. This relies on library search paths being correctly exported so that the Qt libraries and framework files are found by the binary. The testcase exports LD_LIBRARY_PATH, but does neither export DYLD_LIBRARY_PATH nor DYLD_FRAMEWORK_PATH which is needed on macOS as well. Therefore the binary cannot be loaded. This error is only visible when running tst_blackbox-qt stand-alone. It is usually hidden because the QbsAutoTestRunner exports both DYLD variables. But if the user builds the autotests against Qt installation A while testing installation B, then the binary in the qtscxml testcase uses the wrong DYLD_LIBRARY_PATH. This patch exports both DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH on macOS. Change-Id: I348d50ec0417e35ff379aad2f93cf80b5ed50c95 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs22
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs b/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs
index 991e4ddcb..208305c1f 100644
--- a/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs
+++ b/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs
@@ -33,18 +33,22 @@ Project {
prepare: {
var cmd = new Command(input.filePath);
cmd.description = "running " + input.filePath;
- var pathVar;
- var pathValue;
+
+ var envVars = {};
if (product.qbs.hostOS.contains("windows")) {
- pathVar = "PATH";
- pathValue = FileInfo.toWindowsSeparators(input["Qt.core"].binPath);
+ envVars["PATH"] = FileInfo.toWindowsSeparators(input["Qt.core"].binPath);
+ } else if (product.qbs.hostOS.contains("macos")) {
+ envVars["DYLD_LIBRARY_PATH"] = input["Qt.core"].libPath;
+ envVars["DYLD_FRAMEWORK_PATH"] = input["Qt.core"].libPath;
} else {
- pathVar = "LD_LIBRARY_PATH";
- pathValue = input["Qt.core"].libPath;
+ envVars["LD_LIBRARY_PATH"] = input["Qt.core"].libPath;
+ }
+ for (var varName in envVars) {
+ var oldValue = Environment.getEnv(varName) || "";
+ var newValue = envVars[varName] + product.qbs.pathListSeparator + oldValue;
+ cmd.environment.push(varName + '=' + newValue);
}
- var oldValue = Environment.getEnv(pathVar) || "";
- var newValue = pathValue + product.qbs.pathListSeparator + oldValue;
- cmd.environment = [pathVar + '=' + newValue];
+
return [cmd];
}
}