Skip to content

Commit

Permalink
[mono] Enable XHarness CLI for Android tests (#35786)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored May 6, 2020
1 parent e717472 commit 3fb3d01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"microsoft.dotnet.xharness.cli": {
"version": "1.0.0-prerelease.20230.1",
"version": "1.0.0-prerelease.20254.3",
"commands": [
"xharness"
]
Expand Down
16 changes: 3 additions & 13 deletions eng/testing/AndroidRunnerTemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ while true; do
fi
done


## XHarness doesn't support macOS/Linux yet (in progress) so we'll use a hand-made adb script
# dotnet xharness android test -i="net.dot.MonoRunner" \
# --package-name="net.dot.$TEST_NAME" \
# --app=$APK -o=$EXECUTION_DIR/Bundle/TestResults -v

ADB=$ANDROID_SDK_ROOT/platform-tools/adb
echo "Installing net.dot.$TEST_NAME on an active device/emulator..."
$ADB uninstall net.dot.$TEST_NAME > /dev/null 2>&1 || true
$ADB install "$APK"
echo "Running tests for $TEST_NAME (see live logs via logcat)..."
$ADB shell am instrument -w net.dot.$TEST_NAME/net.dot.MonoRunner
echo "Finished. See logcat for details, e.g. '$ADB logcat DOTNET:V -s'"
dotnet xharness android test -i="net.dot.MonoRunner" \
--package-name="net.dot.$TEST_NAME" \
--app=$APK -o=$EXECUTION_DIR/Bundle/TestResults -v
8 changes: 7 additions & 1 deletion src/mono/msbuild/AndroidAppBuilder/ApkBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,19 @@ public class ApkBuilder
// Copy AppDir to OutputDir/assets (ignore native files)
Utils.DirectoryCopy(sourceDir, Path.Combine(OutputDir, "assets"), file =>
{
var extension = Path.GetExtension(file);
string fileName = Path.GetFileName(file);
string extension = Path.GetExtension(file);
// ignore native files, those go to lib/%abi%
if (extension == ".so" || extension == ".a")
{
// ignore ".pdb" and ".dbg" to make APK smaller
return false;
}
if (fileName.StartsWith("."))
{
// aapt complains on such files
return false;
}
return true;
});

Expand Down

0 comments on commit 3fb3d01

Please sign in to comment.