Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Android instrumentation runner to be closer to upstream #43775

Merged
merged 1 commit into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libraries/Native/Unix/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ check_c_source_compiles(
HAVE_MKSTEMP)

if (NOT HAVE_MKSTEMPS AND NOT HAVE_MKSTEMP)
message(FATAL_ERROR "Cannot find mkstemp nor mkstemp on this platform.")
message(FATAL_ERROR "Cannot find mkstemps nor mkstemp on this platform.")
endif()

check_c_source_compiles(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import android.view.View;
import android.app.Activity;
Expand All @@ -32,6 +33,7 @@ public class MonoRunner extends Instrumentation
}

static String entryPointLibName = "%EntryPointLibName%";
static Bundle result = new Bundle();

@Override
public void onCreate(Bundle arguments) {
Expand Down Expand Up @@ -62,33 +64,32 @@ public static int initialize(String entryPointLibName, Context context) {
// unzip libs and test files to filesDir
unzipAssets(context, filesDir, "assets.zip");

Log.i("DOTNET", "initRuntime, entryPointLibName=" + entryPointLibName);
Log.i("DOTNET", "MonoRunner initialize, entryPointLibName=" + entryPointLibName);
return initRuntime(filesDir, cacheDir, docsDir, entryPointLibName);
}

@Override
public void onStart() {
super.onStart();
Looper.prepare();

if (entryPointLibName == "") {
Log.e("DOTNET", "Missing entryPointLibName argument, pass '-e entryPointLibName <name.dll>' to adb to specify which program to run.");
finish(1, null);
return;
}
int retcode = initialize(entryPointLibName, getContext());
runOnMainSync(new Runnable() {
public void run() {
Bundle result = new Bundle();
result.putInt("return-code", retcode);

// Xharness cli expects "test-results-path" with test results
File testResults = new File(getDocsDir(getContext()) + "/testResults.xml");
if (testResults.exists()) {
result.putString("test-results-path", testResults.getAbsolutePath());
}
finish(retcode, result);
}
});

Log.i("DOTNET", "MonoRunner finished, return-code=" + retcode);
result.putInt("return-code", retcode);

// Xharness cli expects "test-results-path" with test results
File testResults = new File(getDocsDir(getContext()) + "/testResults.xml");
if (testResults.exists()) {
Log.i("DOTNET", "MonoRunner finished, test-results-path=" + testResults.getAbsolutePath());
result.putString("test-results-path", testResults.getAbsolutePath());
}

finish(retcode, result);
}

static void unzipAssets(Context context, String toPath, String zipName) {
Expand Down