diff --git a/build-tools/automation/azure-pipelines-nightly.yaml b/build-tools/automation/azure-pipelines-nightly.yaml index 4f5ce4c33ac..92601bd3351 100644 --- a/build-tools/automation/azure-pipelines-nightly.yaml +++ b/build-tools/automation/azure-pipelines-nightly.yaml @@ -106,15 +106,15 @@ stages: Android30-x86_64: avdApiLevel: 30 avdAbi: x86_64 - avdType: default + avdType: aosp_atd Android31-x86_64: avdApiLevel: 31 avdAbi: x86_64 - avdType: default + avdType: aosp_atd Android33-x86_64: avdApiLevel: 33 avdAbi: x86_64 - avdType: google_apis + avdType: aosp_atd pool: vmImage: $(HostedMacImage) workspace: diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index cf06e9233a2..1b6c5eec484 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -105,6 +105,136 @@ extends: - template: /build-tools/automation/yaml-templates/build-linux.yaml@self + - stage: TestContainer + displayName: Test Container + jobs: + - job: Test + pool: + name: MAUI-1ESPT + image: $(LinuxPoolImage1ESPT) + os: linux + timeoutInMinutes: 180 + workspace: + clean: all + steps: + - script: | + printenv + whoami + curl -h + sudo -h + grep -c -w "vmx\|svm" /proc/cpuinfo + find /dev -name kvm + displayName: Display Environment + - script: | + $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "platform-tools" + displayName: Install platfom-tools + - template: /build-tools/automation/yaml-templates/setup-test-environment.yaml@self + + - script: | + sudo apt-get install curl ca-certificates -y + curl https://repo.waydro.id | sudo bash + sudo apt-get install waydroid -y + displayName: Install WayDroid + - script: | + sudo apt install linux-generic -y + sudo apt install --reinstall linux-image-$(uname -r) -y + sudo apt install --reinstall linux-modules-$(uname -r) -y + sudo apt install --reinstall linux-modules-extra-$(uname -r) -y + sudo apt install -y dbus-x11 + sudo apt install weston + sudo apt install xvfb + displayName: Install Kernel Stuff + - script: | + export $(dbus-launch) + export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir + mkdir "${XDG_RUNTIME_DIR}" + chmod 0700 "${XDG_RUNTIME_DIR}" + sudo waydroid init -f + displayName: waydroid init -f + - script: | + export $(dbus-launch) + export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir + sudo waydroid init + displayName: waydroid init + - script: | + export $(dbus-launch) + export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir + xvfb-run weston -B headless-backend.so --width=1024 --height=768 --xwayland & + sleep 10 + displayName: Start Weston + - script: | + export $(dbus-launch) + export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir + sudo waydroid container start & + sleep 10 + displayName: Start Container + - script: | + export $(dbus-launch) + export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir + waydroid session start & + sleep 10 + displayName: Start waydroid + - bash: | + ipAddress=$(sudo waydroid shell ip addr show eth0 | grep "inet " | awk '{print $2}' | cut -d/ -f1) + done=0 + while [ -z "$ipAddress" ]; do + if [ $done == '180' ]; then + break + fi + echo "Waiting for waydroid to start" + sleep 1 + ipAddress=$(sudo waydroid shell ip addr show eth0 | grep "inet " | awk '{print $2}' | cut -d/ -f1) + ((done++)) + done + echo "Waydroid started with ip address: $ipAddress" + $ANDROID_HOME/platform-tools/adb connect $ipAddress:5555 + displayName: Wait for waydroid + - script: | + $ANDROID_HOME/platform-tools/adb devices + # $ANDROID_HOME/platform-tools/adb shell getprop + # $ANDROID_HOME/platform-tools/adb shell screencap /data/local/tmp/screenshot.png + # $ANDROID_HOME/platform-tools/adb pull /data/local/tmp/screenshot.png $(Build.StagingDirectory)/screenshot.png + # $ANDROID_HOME/platform-tools/adb exec-out uiautomator dump /dev/tty > $(Build.StagingDirectory)/ui.xml + displayName: Logging + #- script: | + # $ANDROID_HOME/platform-tools/adb shell settings put global development_settings_enabled 1 + # displayName: adb developer mode + - template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self + parameters: + project: samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj + arguments: >- + -t:Install -c Release -tl:off -v:diag + -p:DotNetPreviewTool=$(System.DefaultWorkingDirectory)/bin/$(XA.Build.Configuration)/dotnet/dotnet + displayName: Test Install + continueOnError: true + - template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self + parameters: + project: samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj + arguments: >- + -t:Run -c Release -tl:off -v:diag + -p:DotNetPreviewTool=$(System.DefaultWorkingDirectory)/bin/$(XA.Build.Configuration)/dotnet/dotnet + displayName: Test Run + continueOnError: true + - script: | + $ANDROID_HOME/platform-tools/adb devices + displayName: Capture Output + - script: | + $ANDROID_HOME/platform-tools/adb shell screencap /data/local/tmp/screenshot.png + displayName: Capture Screenshot + - script: | + $ANDROID_HOME/platform-tools/adb pull /data/local/tmp/screenshot.png $(Build.StagingDirectory)/screenshot1.png + displayName: copy screen shot + - script: | + waydroid session stop + sudo waydroid container stop + displayName: Stop WayDroid + - template: /build-tools/automation/yaml-templates/publish-artifact.yaml@self + parameters: + displayName: upload container tests + artifactName: Test Results - Container + targetPath: $(Build.StagingDirectory) + #condition: or(ne(variables['Agent.JobStatus'], 'Succeeded'), eq(variables['XA.PublishAllLogs'], 'true')) + - stage: smoke_tests displayName: Package Tests dependsOn: mac_build diff --git a/build-tools/scripts/DockerFile b/build-tools/scripts/DockerFile new file mode 100644 index 00000000000..9dafe38f523 --- /dev/null +++ b/build-tools/scripts/DockerFile @@ -0,0 +1 @@ +RUN apk add bash sudo shadow \ No newline at end of file diff --git a/build-tools/scripts/TestApks.targets b/build-tools/scripts/TestApks.targets index 8629e00274d..013670e0058 100644 --- a/build-tools/scripts/TestApks.targets +++ b/build-tools/scripts/TestApks.targets @@ -19,10 +19,10 @@ android-arm64;android-x86;android-x64; - 29 + 33 arm64-v8a x86_64 - default + aosp_atd true false -no-window -no-boot-anim $(TestAvdExtraBootArgs) diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs index 72a9498277c..73828cec89d 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs @@ -47,6 +47,7 @@ public AndroidToolchain () // // https://dl-ssl.google.com/android/repository/sys-img/android/sys-img2-1.xml // https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img2-1.xml + // https://dl-ssl.google.com/android/repository/sys-img/aosp_atd/sys-img2-1.xml // * system images // Components = new List { @@ -97,6 +98,12 @@ public AndroidToolchain () pkgRevision: "8", dependencyType: AndroidToolchainComponentType.EmulatorDependency ), + new AndroidToolchainComponent (isArm64Apple ? $"{systemImageArch}-33_r02" : $"{systemImageArch}-33_r02", + destDir: Path.Combine ("system-images", "android-33", "aosp_atd", systemImageArch), + relativeUrl: new Uri ("sys-img/aosp_atd/", UriKind.Relative), + pkgRevision: "2", + dependencyType: AndroidToolchainComponentType.EmulatorDependency + ), new AndroidToolchainComponent ($"android-ndk-r{AndroidNdkVersion}-{osTag}", destDir: AndroidNdkDirectory, pkgRevision: AndroidPkgRevision, diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs b/build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs index 5879fcbc703..6b42ee0b514 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs @@ -269,7 +269,7 @@ void Check (Context context, string packageCacheDir, string sdkRoot, AndroidTool Component = component, PackageName = packageName, Url = GetPackageUrl (component, packageName), - LocalPackagePath = Path.Combine (packageCacheDir, packageName), + LocalPackagePath = Path.Combine (packageCacheDir, component.RelativeUrl?.ToString () ?? string.Empty, packageName), DestinationDir = GetDestinationDir (component, sdkRoot), }; diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/DeviceTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/DeviceTest.cs index a6dec7fe137..77270c74029 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/DeviceTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/DeviceTest.cs @@ -56,9 +56,14 @@ public void AssertHasDevices (bool fail = true) [OneTimeSetUp] public void DeviceSetup () { + TestContext.Out.WriteLine ($"LOG DeviceSetup: Enter!!!"); + Console.WriteLine ($"LOG DeviceSetup: Enter Console!!!"); + if (!string.IsNullOrEmpty (DeviceAbi)) + return; if (IsDeviceAttached ()) { try { DeviceSdkVersion = GetSdkVersion (); + TestContext.Out.WriteLine ($"LOG DeviceSetup: {DeviceSdkVersion}"); if (DeviceSdkVersion != -1) { if (DeviceSdkVersion >= 21) DeviceAbi = RunAdbCommand ("shell getprop ro.product.cpu.abilist64").Trim ();