From fc4d352683afe681037268955a58e233cffe24eb Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Wed, 30 Oct 2024 17:00:20 +0200 Subject: [PATCH] AndroidTestRunner: warn if exit code retrieval fails This helps in debugging instead of returning -1 silently. Pick-to: 6.8 Change-Id: I7d145e86af04a6cc0cd0e4a6c2dbe6c4d2fd714c Reviewed-by: Ville Voutilainen Reviewed-by: Fabian Kosmale --- src/tools/androidtestrunner/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp index e5a5b0acc28..2db412a3c5c 100644 --- a/src/tools/androidtestrunner/main.cpp +++ b/src/tools/androidtestrunner/main.cpp @@ -694,8 +694,10 @@ static int testExitCode() { QByteArray exitCodeOutput; const QString exitCodeCmd = "cat files/qtest_last_exit_code 2> /dev/null"_L1; - if (!execAdbCommand({ "shell"_L1, runCommandAsUserArgs(exitCodeCmd) }, &exitCodeOutput, false)) + if (!execAdbCommand({ "shell"_L1, runCommandAsUserArgs(exitCodeCmd) }, &exitCodeOutput, false)) { + qCritical() << "Failed to retrieve the test exit code."; return EXIT_ERROR; + } bool ok; int exitCode = exitCodeOutput.toInt(&ok);