From 3aaf48231567adcbab4cc15d64bdcd34a9ddea97 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Fri, 22 Oct 2021 17:03:33 -0400 Subject: [PATCH 1/6] [build/ci] Run native code analyzer tests nightly Context: https://github.com/xamarin/xamarin-android/commit/aaa37c3df94490ee9befb8381f4dd7aa18226355 Updates the build to conditionally run `` and build extra native libraries with the ASAN and UBSAN runtime sanitizers when `'$(EnableNativeAnalyzers)' == 'true'`. We will only enable this behavior in our nightly builds, and the `*-checked+asan` and `*-checked+ubsa` native libraries have been removed from our regular installers. Nightly tests have been updated to run against these `*-checked+*` native libraries. --- .../automation/azure-pipelines-nightly.yaml | 26 ++++++++++- .../yaml-templates/commercial-build.yaml | 2 +- .../installers/create-installers.targets | 16 +++---- .../GeneratedMonodroidCmakeFiles.cs | 8 +++- src/monodroid/monodroid.targets | 45 ++++++++++++------- 5 files changed, 67 insertions(+), 30 deletions(-) diff --git a/build-tools/automation/azure-pipelines-nightly.yaml b/build-tools/automation/azure-pipelines-nightly.yaml index e76ce32e5d8..76e4199d307 100644 --- a/build-tools/automation/azure-pipelines-nightly.yaml +++ b/build-tools/automation/azure-pipelines-nightly.yaml @@ -60,7 +60,7 @@ stages: - template: yaml-templates/commercial-build.yaml parameters: - makeMSBuildArgs: /p:EnableRoslynAnalyzers=true + makeMSBuildArgs: /p:EnableRoslynAnalyzers=true /p:EnableNativeAnalyzers=true - template: yaml-templates/upload-results.yaml parameters: @@ -130,10 +130,32 @@ stages: testName: Mono.Android_Tests-$(avdApiLevel)-$(avdAbi) project: tests/Mono.Android-Tests/Mono.Android-Tests.csproj testResultsFiles: TestResult-Mono.Android_Tests-$(XA.Build.Configuration).xml - extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) + extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseASAN=true artifactName: Mono.Android_Tests-Signed.apk artifactFolder: Default + # On API 28 emulator, run forms integration test with ASAN and UBSAN runtime sanitizers + - ${{ if eq(variables['avdApiLevel'], '28') }}: + - template: yaml-templates/apk-instrumentation.yaml + parameters: + configuration: $(XA.Build.Configuration) + testName: Xamarin.Forms-Performance-Integration + project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj + testResultsFiles: TestResult-UseASAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml + extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseASAN=true + artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk + artifactFolder: Default + + - template: yaml-templates/apk-instrumentation.yaml + parameters: + configuration: $(XA.Build.Configuration) + testName: Xamarin.Forms-Performance-Integration + project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj + testResultsFiles: TestResult-UseUBSAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml + extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseUBSAN=true + artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk + artifactFolder: Default + - task: MSBuild@1 displayName: shut down emulator inputs: diff --git a/build-tools/automation/yaml-templates/commercial-build.yaml b/build-tools/automation/yaml-templates/commercial-build.yaml index b545a3aa72c..65feab53822 100644 --- a/build-tools/automation/yaml-templates/commercial-build.yaml +++ b/build-tools/automation/yaml-templates/commercial-build.yaml @@ -81,7 +81,7 @@ steps: /p:MicroBuildOverridePluginDirectory=$(Build.StagingDirectory)/MicroBuild/Plugins /bl:${{ parameters.xaSourcePath }}/bin/Build$(XA.Build.Configuration)/restore-sign-pkg-content.binlog -- script: make create-installers CONFIGURATION=$(XA.Build.Configuration) +- script: make create-installers CONFIGURATION=$(XA.Build.Configuration) _MSBUILD_ARGS='${{ parameters.makeMSBuildArgs }}' workingDirectory: ${{ parameters.xaSourcePath }} displayName: make create-installers diff --git a/build-tools/installers/create-installers.targets b/build-tools/installers/create-installers.targets index c74d6387bfc..93b3c6d2d70 100644 --- a/build-tools/installers/create-installers.targets +++ b/build-tools/installers/create-installers.targets @@ -159,14 +159,14 @@ <_MSBuildFiles Include="$(MSBuildSrcDir)\jnimarshalmethod-gen.pdb" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="$(MSBuildSrcDir)\LayoutBinding.cs" /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android.debug.so')" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android-checked+asan.debug.so')" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android-checked+ubsan.debug.so')" ExcludeFromAndroidNETSdk="true" /> + <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android-checked+asan.debug.so')" ExcludeFromAndroidNETSdk="true" Condition=" '$(EnableNativeAnalyzers)' == 'true' " /> + <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android-checked+ubsan.debug.so')" ExcludeFromAndroidNETSdk="true" Condition=" '$(EnableNativeAnalyzers)' == 'true' " /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android.release.so')" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android-checked+asan.release.so')" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android-checked+ubsan.release.so')" ExcludeFromAndroidNETSdk="true" /> + <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android-checked+asan.release.so')" ExcludeFromAndroidNETSdk="true" Condition=" '$(EnableNativeAnalyzers)' == 'true' " /> + <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-android-checked+ubsan.release.so')" ExcludeFromAndroidNETSdk="true" Condition=" '$(EnableNativeAnalyzers)' == 'true' " /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxa-internal-api.so')" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxa-internal-api-checked+asan.so')" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxa-internal-api-checked+ubsan.so')" ExcludeFromAndroidNETSdk="true" /> + <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxa-internal-api-checked+asan.so')" ExcludeFromAndroidNETSdk="true" Condition=" '$(EnableNativeAnalyzers)' == 'true' " /> + <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxa-internal-api-checked+ubsan.so')" ExcludeFromAndroidNETSdk="true" Condition=" '$(EnableNativeAnalyzers)' == 'true' " /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-btls-shared.so')" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-btls-shared.d.so')" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmono-profiler-aot.so')" ExcludeFromAndroidNETSdk="true" /> @@ -179,8 +179,8 @@ <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libmonosgen-2.0.d.so')" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libsqlite3_xamarin.so')" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxamarin-debug-app-helper.so')" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxamarin-debug-app-helper-checked+asan.so')" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxamarin-debug-app-helper-checked+ubsan.so')" ExcludeFromAndroidNETSdk="true" /> + <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxamarin-debug-app-helper-checked+asan.so')" ExcludeFromAndroidNETSdk="true" Condition=" '$(EnableNativeAnalyzers)' == 'true' " /> + <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\libxamarin-debug-app-helper-checked+ubsan.so')" ExcludeFromAndroidNETSdk="true" Condition=" '$(EnableNativeAnalyzers)' == 'true' " /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\interpreter-%(Identity)\libmono-btls-shared.so')" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\interpreter-%(Identity)\libmono-profiler-aot.so')" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\interpreter-%(Identity)\libmono-profiler-log.so')" ExcludeFromAndroidNETSdk="true" /> diff --git a/build-tools/xaprepare/xaprepare/Application/GeneratedMonodroidCmakeFiles.cs b/build-tools/xaprepare/xaprepare/Application/GeneratedMonodroidCmakeFiles.cs index fa1b0647f6b..0da964b0145 100644 --- a/build-tools/xaprepare/xaprepare/Application/GeneratedMonodroidCmakeFiles.cs +++ b/build-tools/xaprepare/xaprepare/Application/GeneratedMonodroidCmakeFiles.cs @@ -403,8 +403,12 @@ void WriteMSBuildConfigureRuntimeCommands (StreamWriter sw, string indent, strin flags.Append (String.Join (" ", command.ExtraOptions)); } - sw.WriteLine ($"{indent}"); - sw.WriteLine ($"{indent}"); + var conditionString = (workingDirectory.IndexOf ("-asan", StringComparison.OrdinalIgnoreCase) >= 0 + || workingDirectory.IndexOf ("-ubsan", StringComparison.OrdinalIgnoreCase) >= 0) + ? " Condition=\"'$(EnableNativeAnalyzers)' == 'true'\" " : string.Empty; + + sw.WriteLine ($"{indent}"); + sw.WriteLine ($"{indent}"); sw.WriteLine ($"{indent} <_ConfigureRuntimeCommands Include=\"{itemName}\">"); sw.WriteLine ($"{indent} $(CmakePath)"); WriteProperty (sw, $"{indent} ", "Arguments", flags, replacements); diff --git a/src/monodroid/monodroid.targets b/src/monodroid/monodroid.targets index 8e8b7802f1e..80da11f4cf0 100644 --- a/src/monodroid/monodroid.targets +++ b/src/monodroid/monodroid.targets @@ -20,7 +20,7 @@ + DependsOnTargets="_GenerateIncludeFiles;_ConfigureRuntimes;_BuildAndroidRuntimes;_BuildAndroidAnalyzerRuntimes;_BuildHostRuntimes;ClangTidyCheck"> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.debug.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android.debug.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+ubsan.debug.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android-checked+ubsan.debug.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+asan.debug.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android-checked+asan.debug.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.release.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android.release.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+asan.release.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android-checked+asan.release.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+ubsan.release.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android-checked+ubsan.release.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\Debug\libxamarin-app.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\Debug\libxamarin-app.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\Release\libxamarin-app.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\Release\libxamarin-app.so')" /> + + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+ubsan.debug.so')" /> + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android-checked+ubsan.debug.so')" /> + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+asan.debug.so')" /> + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android-checked+asan.debug.so')" /> + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+asan.release.so')" /> + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android-checked+asan.release.so')" /> + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+ubsan.release.so')" /> + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)-net6\libmono-android-checked+ubsan.release.so')" /> + + + + + - + + Condition=" '$(EnableNativeAnalyzers)' == 'true' " + DependsOnTargets="_GetCompileCommandsDirs"> $(AndroidNdkDirectory)\toolchains\llvm\prebuilt\$(NdkLlvmTag)\bin\clang-tidy From 5a87f8592906bf1888fd3b00e38532fc30e6d6b8 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Mon, 25 Oct 2021 11:06:24 -0400 Subject: [PATCH 2/6] Disable failing ClangTidyCheck --- src/monodroid/monodroid.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monodroid/monodroid.targets b/src/monodroid/monodroid.targets index 80da11f4cf0..8c5059afa63 100644 --- a/src/monodroid/monodroid.targets +++ b/src/monodroid/monodroid.targets @@ -20,7 +20,7 @@ + DependsOnTargets="_GenerateIncludeFiles;_ConfigureRuntimes;_BuildAndroidRuntimes;_BuildAndroidAnalyzerRuntimes;_BuildHostRuntimes"> Date: Mon, 25 Oct 2021 18:18:39 -0400 Subject: [PATCH 3/6] Use the correct msbuild args make var --- build-tools/automation/yaml-templates/commercial-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/automation/yaml-templates/commercial-build.yaml b/build-tools/automation/yaml-templates/commercial-build.yaml index 65feab53822..cd97ba7d1b9 100644 --- a/build-tools/automation/yaml-templates/commercial-build.yaml +++ b/build-tools/automation/yaml-templates/commercial-build.yaml @@ -81,7 +81,7 @@ steps: /p:MicroBuildOverridePluginDirectory=$(Build.StagingDirectory)/MicroBuild/Plugins /bl:${{ parameters.xaSourcePath }}/bin/Build$(XA.Build.Configuration)/restore-sign-pkg-content.binlog -- script: make create-installers CONFIGURATION=$(XA.Build.Configuration) _MSBUILD_ARGS='${{ parameters.makeMSBuildArgs }}' +- script: make create-installers CONFIGURATION=$(XA.Build.Configuration) MSBUILD_ARGS='${{ parameters.makeMSBuildArgs }}' workingDirectory: ${{ parameters.xaSourcePath }} displayName: make create-installers From 13ed931fe8666061647154e050408511885eedc6 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Mon, 25 Oct 2021 18:34:18 -0400 Subject: [PATCH 4/6] Fix matrix variable condition, it can't be used at compile time --- .../automation/azure-pipelines-nightly.yaml | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/build-tools/automation/azure-pipelines-nightly.yaml b/build-tools/automation/azure-pipelines-nightly.yaml index 76e4199d307..46bf5c74ad9 100644 --- a/build-tools/automation/azure-pipelines-nightly.yaml +++ b/build-tools/automation/azure-pipelines-nightly.yaml @@ -135,26 +135,27 @@ stages: artifactFolder: Default # On API 28 emulator, run forms integration test with ASAN and UBSAN runtime sanitizers - - ${{ if eq(variables['avdApiLevel'], '28') }}: - - template: yaml-templates/apk-instrumentation.yaml - parameters: - configuration: $(XA.Build.Configuration) - testName: Xamarin.Forms-Performance-Integration - project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj - testResultsFiles: TestResult-UseASAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml - extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseASAN=true - artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk - artifactFolder: Default - - - template: yaml-templates/apk-instrumentation.yaml - parameters: - configuration: $(XA.Build.Configuration) - testName: Xamarin.Forms-Performance-Integration - project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj - testResultsFiles: TestResult-UseUBSAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml - extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseUBSAN=true - artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk - artifactFolder: Default + - template: yaml-templates/apk-instrumentation.yaml + parameters: + configuration: $(XA.Build.Configuration) + testName: Xamarin.Forms-Performance-Integration + project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj + testResultsFiles: TestResult-UseASAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml + extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseASAN=true + artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk + artifactFolder: Default + condition: and(succeeded(), eq(variables.avdApiLevel, '28')) + + - template: yaml-templates/apk-instrumentation.yaml + parameters: + configuration: $(XA.Build.Configuration) + testName: Xamarin.Forms-Performance-Integration + project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj + testResultsFiles: TestResult-UseUBSAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml + extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseUBSAN=true + artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk + artifactFolder: Default + condition: and(succeeded(), eq(variables.avdApiLevel, '28')) - task: MSBuild@1 displayName: shut down emulator From e5e2649e942ae228dc0b2022e7294d0e91ecc43c Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Tue, 26 Oct 2021 10:25:28 -0400 Subject: [PATCH 5/6] Fix nightly .apk uploads, include debug symbols in sanitized libs --- build-tools/automation/azure-pipelines-nightly.yaml | 8 ++++---- src/monodroid/CMakeLists.txt | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build-tools/automation/azure-pipelines-nightly.yaml b/build-tools/automation/azure-pipelines-nightly.yaml index 46bf5c74ad9..04e48fd089d 100644 --- a/build-tools/automation/azure-pipelines-nightly.yaml +++ b/build-tools/automation/azure-pipelines-nightly.yaml @@ -131,8 +131,8 @@ stages: project: tests/Mono.Android-Tests/Mono.Android-Tests.csproj testResultsFiles: TestResult-Mono.Android_Tests-$(XA.Build.Configuration).xml extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseASAN=true - artifactName: Mono.Android_Tests-Signed.apk - artifactFolder: Default + artifactSource: bin/Test$(XA.Build.Configuration)/Mono.Android_Tests-Signed.apk + artifactFolder: UseASAN # On API 28 emulator, run forms integration test with ASAN and UBSAN runtime sanitizers - template: yaml-templates/apk-instrumentation.yaml @@ -143,7 +143,7 @@ stages: testResultsFiles: TestResult-UseASAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseASAN=true artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk - artifactFolder: Default + artifactFolder: UseASAN condition: and(succeeded(), eq(variables.avdApiLevel, '28')) - template: yaml-templates/apk-instrumentation.yaml @@ -154,7 +154,7 @@ stages: testResultsFiles: TestResult-UseUBSAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseUBSAN=true artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk - artifactFolder: Default + artifactFolder: UseUBSAN condition: and(succeeded(), eq(variables.avdApiLevel, '28')) - task: MSBuild@1 diff --git a/src/monodroid/CMakeLists.txt b/src/monodroid/CMakeLists.txt index f1aa3fc9187..bf7aabf4a98 100644 --- a/src/monodroid/CMakeLists.txt +++ b/src/monodroid/CMakeLists.txt @@ -35,9 +35,16 @@ endif() option(ENABLE_CLANG_ASAN "Enable the clang AddressSanitizer support" OFF) option(ENABLE_CLANG_UBSAN "Enable the clang UndefinedBehaviorSanitizer support" OFF) + +if(ENABLE_CLANG_ASAN OR ENABLE_CLANG_UBSAN) + set(STRIP_DEBUG_DEFAULT OFF) +else() + set(STRIP_DEBUG_DEFAULT ON) +endif() + option(ENABLE_NET6 "Enable compilation for .NET6" OFF) option(ENABLE_TIMING "Build with timing support" OFF) -option(STRIP_DEBUG "Strip debugging information when linking" ON) +option(STRIP_DEBUG "Strip debugging information when linking" ${STRIP_DEBUG_DEFAULT}) option(DISABLE_DEBUG "Disable the built-in debugging code" OFF) option(USE_CCACHE "Use ccache, if found, to speed up recompilation" ${CCACHE_OPTION_DEFAULT}) From 9c4bdf0c53a32eb24e32de8829d82da11881dbe3 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Tue, 26 Oct 2021 13:01:34 -0400 Subject: [PATCH 6/6] Disable UseASAN and UseUBSAN tests --- .../automation/azure-pipelines-nightly.yaml | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/build-tools/automation/azure-pipelines-nightly.yaml b/build-tools/automation/azure-pipelines-nightly.yaml index 04e48fd089d..e1c6f119118 100644 --- a/build-tools/automation/azure-pipelines-nightly.yaml +++ b/build-tools/automation/azure-pipelines-nightly.yaml @@ -130,32 +130,9 @@ stages: testName: Mono.Android_Tests-$(avdApiLevel)-$(avdAbi) project: tests/Mono.Android-Tests/Mono.Android-Tests.csproj testResultsFiles: TestResult-Mono.Android_Tests-$(XA.Build.Configuration).xml - extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseASAN=true + extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) artifactSource: bin/Test$(XA.Build.Configuration)/Mono.Android_Tests-Signed.apk - artifactFolder: UseASAN - - # On API 28 emulator, run forms integration test with ASAN and UBSAN runtime sanitizers - - template: yaml-templates/apk-instrumentation.yaml - parameters: - configuration: $(XA.Build.Configuration) - testName: Xamarin.Forms-Performance-Integration - project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj - testResultsFiles: TestResult-UseASAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml - extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseASAN=true - artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk - artifactFolder: UseASAN - condition: and(succeeded(), eq(variables.avdApiLevel, '28')) - - - template: yaml-templates/apk-instrumentation.yaml - parameters: - configuration: $(XA.Build.Configuration) - testName: Xamarin.Forms-Performance-Integration - project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj - testResultsFiles: TestResult-UseUBSAN-Xamarin.Forms_Performance_Integration-Signed-$(XA.Build.Configuration).xml - extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:UseUBSAN=true - artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Forms_Performance_Integration-Signed.apk - artifactFolder: UseUBSAN - condition: and(succeeded(), eq(variables.avdApiLevel, '28')) + artifactFolder: Default - task: MSBuild@1 displayName: shut down emulator