From df743c2164e0526c741f8c0d638f1371602f0074 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Mon, 21 Oct 2024 00:28:32 +0300 Subject: [PATCH] AndroidTestRunner: allow using adb's ANDROID_SERIAL env var androidtestrunner should've used ANDROID_SERIAL adb env var, instead of introuducing the new one ANDROID_DEVICE_SERIAL, but for now support both. Change-Id: Id0fc75fc64d7d3dd033c60e6ba9c6c3350ddd899 Reviewed-by: Ville Voutilainen (cherry picked from commit 252550877dff358b02a5be773d32fe606bff51f4) Reviewed-by: Qt Cherry-pick Bot --- src/tools/androidtestrunner/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp index b6f44996a0b..628d1704da6 100644 --- a/src/tools/androidtestrunner/main.cpp +++ b/src/tools/androidtestrunner/main.cpp @@ -266,7 +266,9 @@ static bool parseOptions() if (g_options.helpRequested || g_options.buildPath.isEmpty() || g_options.apkPath.isEmpty()) return false; - g_options.serial = qEnvironmentVariable("ANDROID_DEVICE_SERIAL"); + g_options.serial = qEnvironmentVariable("ANDROID_SERIAL"); + if (g_options.serial.isEmpty()) + g_options.serial = qEnvironmentVariable("ANDROID_DEVICE_SERIAL"); if (g_options.ndkStackPath.isEmpty()) { const QString ndkPath = qEnvironmentVariable("ANDROID_NDK_ROOT"); @@ -282,8 +284,8 @@ static void printHelp() { qWarning( "Syntax: %s -- [TESTARGS] \n" "\n" - " Runs an Android test on the default emulator/device or on the one\n" - " specified by \"ANDROID_DEVICE_SERIAL\" environment variable.\n" + " Runs a Qt for Android test on an emulator or a device. Specify a device\n" + " using the environment variables ANDROID_SERIAL or ANDROID_DEVICE_SERIAL.\n" "\n" " Mandatory arguments:\n" " --path : The path where androiddeployqt builds the android package.\n"