[mono] Enable XHarness CLI for Android tests (#35786)
authorEgor Bogatov <egorbo@gmail.com>
Wed, 6 May 2020 12:43:57 +0000 (15:43 +0300)
committerGitHub <noreply@github.com>
Wed, 6 May 2020 12:43:57 +0000 (15:43 +0300)
.config/dotnet-tools.json
eng/testing/AndroidRunnerTemplate.sh
src/mono/msbuild/AndroidAppBuilder/ApkBuilder.cs

index 0626e6d..fd4f16b 100644 (file)
@@ -9,7 +9,7 @@
       ]
     },
     "microsoft.dotnet.xharness.cli": {
-      "version": "1.0.0-prerelease.20230.1",
+      "version": "1.0.0-prerelease.20254.3",
       "commands": [
         "xharness"
       ]
index ceb5d53..dfb90ec 100644 (file)
@@ -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
index a7da309..715d4e7 100644 (file)
@@ -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;
         });