AndroidTestRunner: make build command program deduction more robust

Currently, if the cmake program path passed to androidtestrunner
contains space, QProcess will get an invalid program path. To fix
that, quote the cmake command passed to androidtestrunner and use
QProcess::splitCommand() to get the program and args list.

Task-number: QTBUG-105524
Pick-to: 6.7
Change-Id: Icb665033884127972bff205157ff22aa469c135c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Assam Boudjelthia 2023-12-18 15:01:56 +02:00
parent a5ce49cbeb
commit a1b1759abf
2 changed files with 2 additions and 2 deletions

View File

@ -201,7 +201,7 @@ function(qt_internal_android_test_arguments target timeout out_test_runner out_t
"--path" "${apk_dir}"
"--adb" "${ANDROID_SDK_ROOT}/platform-tools/adb"
"--skip-install-root"
"--make" "${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${target}_make_apk"
"--make" "\"${CMAKE_COMMAND}\" --build ${CMAKE_BINARY_DIR} --target ${target}_make_apk"
"--apk" "${apk_dir}/${target}.apk"
"--ndk-stack" "${ANDROID_NDK_ROOT}/ndk-stack"
"--timeout" "${timeout}"

View File

@ -191,7 +191,7 @@ static bool execAdbCommand(const QStringList &args, QByteArray *output = nullptr
static bool execCommand(const QString &command, QByteArray *output = nullptr, bool verbose = true)
{
auto args = command.split(u' ');
auto args = QProcess::splitCommand(command);
const auto program = args.first();
args.removeOne(program);
return execCommand(program, args, output, verbose);