From 3d3c334ae3dc467014e775f2a3eb4474d4792ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 16 Apr 2021 18:25:35 +0200 Subject: [PATCH] Skip forwarding entrypoint library name to Android application Main() Some of the Android runtime tests were recently broken because they got an "entryPointLibName=" argument in their Main args. This argument is normally used to run a specific test: https://github.com/dotnet/runtime/blob/dd63ea2e6a9cc6f2661b817d15e558fc6605fa17/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Program.cs#L24 After https://github.com/dotnet/runtime/commit/1a98ba0ec20550c9e1ece5fff555d683dec3252b we were passing the `entryPointLibName` down to the managed app args even though it's only supposed to be used to tell the runtime which assembly to run. --- src/tasks/AndroidAppBuilder/Templates/MonoRunner.java | 9 +++------ src/tests/Common/CLRTest.Execute.Bash.targets | 2 +- src/tests/Common/CLRTest.Execute.Batch.targets | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java b/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java index 111ebc21dbe770..a25fdba280dc8a 100644 --- a/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java +++ b/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java @@ -43,11 +43,6 @@ public class MonoRunner extends Instrumentation @Override public void onCreate(Bundle arguments) { if (arguments != null) { - String lib = arguments.getString("entryPointLibName"); - if (lib != null) { - entryPointLibName = lib; - } - ArrayList argsList = new ArrayList(); for (String key : arguments.keySet()) { if (key.startsWith("env:")) { @@ -55,6 +50,8 @@ public void onCreate(Bundle arguments) { String envValue = arguments.getString(key); setEnv(envName, envValue); Log.i("DOTNET", "env:" + envName + "=" + envValue); + } else if (key.equals("entrypoint:libname")) { + entryPointLibName = arguments.getString(key); } else { String val = arguments.getString(key); if (val != null) { @@ -96,7 +93,7 @@ public void onStart() { Looper.prepare(); if (entryPointLibName == "") { - Log.e("DOTNET", "Missing entryPointLibName argument, pass '-e entryPointLibName ' to adb to specify which program to run."); + Log.e("DOTNET", "Missing entrypoint argument, pass '-e entrypoint:libname ' to adb to specify which program to run."); finish(1, null); return; } diff --git a/src/tests/Common/CLRTest.Execute.Bash.targets b/src/tests/Common/CLRTest.Execute.Bash.targets index e11e838261c68c..1814a296feee81 100644 --- a/src/tests/Common/CLRTest.Execute.Bash.targets +++ b/src/tests/Common/CLRTest.Execute.Bash.targets @@ -362,7 +362,7 @@ else HARNESS_RUNNER="xharness" fi -$__Command $HARNESS_RUNNER android test --instrumentation="net.dot.MonoRunner" --package-name="net.dot.$__Category" --app="$__TestBinaryBase/$__Category.apk" --output-directory=`pwd` --arg=entryPointLibName=$(MsBuildProjectName).dll --expected-exit-code=100 -v +$__Command $HARNESS_RUNNER android test --instrumentation="net.dot.MonoRunner" --package-name="net.dot.$__Category" --app="$__TestBinaryBase/$__Category.apk" --output-directory=`pwd` --arg=entrypoint:libname=$(MsBuildProjectName).dll --expected-exit-code=100 -v CLRTestExitCode=$? # Exist code of xharness is zero when tests finished successfully diff --git a/src/tests/Common/CLRTest.Execute.Batch.targets b/src/tests/Common/CLRTest.Execute.Batch.targets index 79df0834322ed9..f1c643f60decb1 100644 --- a/src/tests/Common/CLRTest.Execute.Batch.targets +++ b/src/tests/Common/CLRTest.Execute.Batch.targets @@ -328,7 +328,7 @@ IF NOT "%XHARNESS_CLI_PATH%"=="" ( set HARNESS_RUNNER=xharness ) -%__Command% %HARNESS_RUNNER% android test --instrumentation="net.dot.MonoRunner" --package-name="net.dot.%__Category%" --app="%__TestBinaryBase%\%__Category%.apk" --output-directory="%25cd%25" --arg=entryPointLibName=$(MsBuildProjectName).dll --expected-exit-code=100 -v +%__Command% %HARNESS_RUNNER% android test --instrumentation="net.dot.MonoRunner" --package-name="net.dot.%__Category%" --app="%__TestBinaryBase%\%__Category%.apk" --output-directory="%25cd%25" --arg=entrypoint:libname=$(MsBuildProjectName).dll --expected-exit-code=100 -v set CLRTestExitCode=!ERRORLEVEL! set CLRTestExpectedExitCode=0 ]]>