Skip to content

Commit 3fb3d01

Browse files
authored
[mono] Enable XHarness CLI for Android tests (#35786)
1 parent e717472 commit 3fb3d01

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
]
1010
},
1111
"microsoft.dotnet.xharness.cli": {
12-
"version": "1.0.0-prerelease.20230.1",
12+
"version": "1.0.0-prerelease.20254.3",
1313
"commands": [
1414
"xharness"
1515
]

eng/testing/AndroidRunnerTemplate.sh

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ while true; do
1818
fi
1919
done
2020

21-
22-
## XHarness doesn't support macOS/Linux yet (in progress) so we'll use a hand-made adb script
23-
# dotnet xharness android test -i="net.dot.MonoRunner" \
24-
# --package-name="net.dot.$TEST_NAME" \
25-
# --app=$APK -o=$EXECUTION_DIR/Bundle/TestResults -v
26-
27-
ADB=$ANDROID_SDK_ROOT/platform-tools/adb
28-
echo "Installing net.dot.$TEST_NAME on an active device/emulator..."
29-
$ADB uninstall net.dot.$TEST_NAME > /dev/null 2>&1 || true
30-
$ADB install "$APK"
31-
echo "Running tests for $TEST_NAME (see live logs via logcat)..."
32-
$ADB shell am instrument -w net.dot.$TEST_NAME/net.dot.MonoRunner
33-
echo "Finished. See logcat for details, e.g. '$ADB logcat DOTNET:V -s'"
21+
dotnet xharness android test -i="net.dot.MonoRunner" \
22+
--package-name="net.dot.$TEST_NAME" \
23+
--app=$APK -o=$EXECUTION_DIR/Bundle/TestResults -v

src/mono/msbuild/AndroidAppBuilder/ApkBuilder.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,19 @@ public class ApkBuilder
8484
// Copy AppDir to OutputDir/assets (ignore native files)
8585
Utils.DirectoryCopy(sourceDir, Path.Combine(OutputDir, "assets"), file =>
8686
{
87-
var extension = Path.GetExtension(file);
87+
string fileName = Path.GetFileName(file);
88+
string extension = Path.GetExtension(file);
8889
// ignore native files, those go to lib/%abi%
8990
if (extension == ".so" || extension == ".a")
9091
{
9192
// ignore ".pdb" and ".dbg" to make APK smaller
9293
return false;
9394
}
95+
if (fileName.StartsWith("."))
96+
{
97+
// aapt complains on such files
98+
return false;
99+
}
94100
return true;
95101
});
96102

0 commit comments

Comments
 (0)