Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeAOT the XUnitLogChecker #103795

Merged
merged 17 commits into from
Aug 30, 2024
Merged

NativeAOT the XUnitLogChecker #103795

merged 17 commits into from
Aug 30, 2024

Conversation

agocke
Copy link
Member

@agocke agocke commented Jun 21, 2024

This breaks the dependency on having dotnet installed.

This breaks the dependency on having dotnet installed.
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 21, 2024
@am11 am11 added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jun 22, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this change, it's looking good so far. Left some questions.

Don't forget to run the nativeaot azp run if the regular run looks good.

@@ -762,7 +762,8 @@
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(IsXUnitLogCheckerSupported)' == 'true'">
<ProjectReference
Include="$(RepoRoot)src\tests\Common\XUnitLogChecker\XUnitLogChecker.csproj"
AdditionalProperties="%(AdditionalProperties);Configuration=Release;OutDir=$(XUnitLogCheckerLibrariesOutDir)" />
Targets="Publish"
AdditionalProperties="%(AdditionalProperties);_IsPublishing=true;Configuration=Release;PublishDir=$(XUnitLogCheckerLibrariesOutDir)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own education, why is _IsPublishing being passed? Why isn't int sufficient to specify Targets="Publish" here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricky. In short, _IsPublishing is required for publishing, but not set when you're using msbuild /t:publish, only when you're doing dotnet publish.

Copy link
Contributor

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@agocke
Copy link
Member Author

agocke commented Aug 24, 2024

I think this is ready for review.

@agocke
Copy link
Member Author

agocke commented Aug 26, 2024

@carlossanlop Would appreciate another review when you get a chance.

Also @dotnet/runtime-infrastructure

@agocke
Copy link
Member Author

agocke commented Aug 29, 2024

ping @carlossanlop

Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple minor suggestions, but otherwise it LGTM. Before merging, could you execute a few more /azp runs? There were many failures that never showed up in the default CI legs. Is there any you could think of that could potentially show an edge-case behavior?

eng/testing/RunnerTemplate.cmd Outdated Show resolved Hide resolved
eng/testing/RunnerTemplate.sh Outdated Show resolved Hide resolved
Comment on lines +432 to +433
var crashReport = JsonNode.Parse(contents)!;
var threads = (JsonArray)crashReport["payload"]!["threads"]!;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully we will not see null objects where the ! was added.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. And if we do, we would throw an exception anyway, so I figure any further checking is a waste.

int timeout = environmentVar != null ? int.Parse(environmentVar) : DEFAULT_TIMEOUT_MS;
bool collectCrashDumps = Environment.GetEnvironmentVariable(COLLECT_DUMPS_ENVIRONMENT_VAR) != null;
string crashDumpFolder = Environment.GetEnvironmentVariable(CRASH_DUMP_FOLDER_ENVIRONMENT_VAR);
string? crashDumpFolder = Environment.GetEnvironmentVariable(CRASH_DUMP_FOLDER_ENVIRONMENT_VAR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these two env vars and the ones in the other files, should we throw if they're not found?

@@ -401,7 +400,7 @@
<XUnitLogCheckerArgs Condition="'$(TestWrapperTargetsWindows)' != 'true'">$(XUnitLogCheckerArgs) %24HELIX_DUMP_FOLDER</XUnitLogCheckerArgs>
<XUnitLogCheckerArgs Condition="'$(TestWrapperTargetsWindows)' == 'true'">$(XUnitLogCheckerArgs) %25HELIX_DUMP_FOLDER%25</XUnitLogCheckerArgs>

<XUnitLogCheckerCommand>dotnet $(XUnitLogCheckerHelixPath)XUnitLogChecker.dll $(XUnitLogCheckerArgs)</XUnitLogCheckerCommand>
<XUnitLogCheckerCommand>$(XUnitLogCheckerHelixPath)XUnitLogChecker$(ExeSuffix) $(XUnitLogCheckerArgs)</XUnitLogCheckerCommand>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you're now putting XUnitLogChecker.exe in the root helix path. Nice.

@@ -767,7 +767,8 @@
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(IsXUnitLogCheckerSupported)' == 'true'">
<ProjectReference
Include="$(RepoRoot)src\tests\Common\XUnitLogChecker\XUnitLogChecker.csproj"
AdditionalProperties="%(AdditionalProperties);Configuration=Release;OutDir=$(XUnitLogCheckerLibrariesOutDir)" />
Targets="Publish"
AdditionalProperties="%(AdditionalProperties);_IsPublishing=true;Configuration=Release;PublishDir=$(XUnitLogCheckerLibrariesOutDir);ROOTFS_DIR=$(ROOTFS_DIR);RuntimeIdentifier=$(OutputRID)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong: the 'Runtime Identifier' additional property here is the equivalent of using the CLI command argument -r <rid>?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, that's correct

Targets="Build" />
Targets="Publish"
Properties="_IsPublishing=true;Configuration=Release;PublishDir=$(XunitTestBinBase)/XUnitLogChecker;RuntimeIdentifier=$(RuntimeIdentifier)"
Condition="$(IsXUnitLogCheckerSupported)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not on you obviously, but I wish we had standardized names for arguments like the RID. In tests.proj, it's OutputRID, and here it is RuntimeIdentifier.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not sure what the reasoning is here. I would have to do some archeology to figure out our naming convention on this.

agocke and others added 2 commits August 29, 2024 13:47
Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
@agocke agocke merged commit 2297f60 into dotnet:main Aug 30, 2024
151 checks passed
@agocke agocke deleted the aot-logchecker branch August 30, 2024 19:14
@jakobbotsch
Copy link
Member

@agocke The Fuzzlyn pipeline run is failing on Linux after this PR (not 100% sure it's because of this PR, but seems related?): https://dev.azure.com/dnceng-public/public/_build/results?buildId=794868&view=results

2024-08-31T14:38:39.3302256Z   XUnitLogChecker -> /__w/1/s/artifacts/tests/coreclr/linux.x64.Release/Common/XUnitLogChecker/XUnitLogChecker/XUnitLogChecker.dll
2024-08-31T14:38:39.3696459Z   Generating native code
2024-08-31T14:38:52.0982028Z clang : error : invalid linker name in argument '-fuse-ld=bfd' [/__w/1/s/src/tests/Common/XUnitLogChecker/XUnitLogChecker.csproj]
2024-08-31T14:38:52.2613950Z /home/cloudtest_azpcontainer/.nuget/packages/microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/build/Microsoft.NETCore.Native.targets(368,5): error MSB3073: The command ""clang" "/__w/1/s/artifacts/tests/coreclr/obj/linux.x64.Release/Managed/Common/XUnitLogChecker/XUnitLogChecker/native/XUnitLogChecker.o" -o "/__w/1/s/artifacts/tests/coreclr/linux.x64.Release/Common/XUnitLogChecker/XUnitLogChecker/native/XUnitLogChecker" -Wl,--version-script=/__w/1/s/artifacts/tests/coreclr/obj/linux.x64.Release/Managed/Common/XUnitLogChecker/XUnitLogChecker/native/XUnitLogChecker.exports -Wl,--export-dynamic -gz=zlib -fuse-ld=bfd /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/sdk/libbootstrapper.o /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/sdk/libRuntime.WorkstationGC.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/sdk/libeventpipe-disabled.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/sdk/libRuntime.VxsortEnabled.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/sdk/libstandalonegc-disabled.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/sdk/libstdc++compat.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/framework/libSystem.Native.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/framework/libSystem.Globalization.Native.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/framework/libSystem.IO.Compression.Native.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/framework/libSystem.Net.Security.Native.a /home/cloudtest_azpcontainer/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.7.24405.7/framework/libSystem.Security.Cryptography.Native.OpenSsl.a -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -pthread -ldl -lz -lrt -lm -pie -Wl,-pie -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--gc-sections" exited with code 1. [/__w/1/s/src/tests/Common/XUnitLogChecker/XUnitLogChecker.csproj]

Any idea what needs to be done?

@agocke
Copy link
Member Author

agocke commented Aug 31, 2024

Looks like the bfd linker isn’t installed on that machine. We can use lld instead by setting linker flavor. We just need to find the conditions in which it needs to be set. Local builds often have bfd so that’s the default. Maybe we can condition on running in ci.

@jakobbotsch
Copy link
Member

I think perhaps the problem is that we should be passing -cross to src/tests/build.sh in the pipeline. Let me try that out.

@am11
Copy link
Member

am11 commented Sep 3, 2024

Looks like the bfd linker isn’t installed on that machine.

bfd is installed, which is for per-arch and it is installed for the host arch, and lld is not installed (which is multi arch). That's the problem. We added UsePublishedCrossgen2=false bailout property for similar reasons in running running test infra. Or we could just install lld by running eng/install-native-dependencies.sh script in the pipeline (with sudo if $USER is not root).

@agocke
Copy link
Member Author

agocke commented Sep 3, 2024

lld is not installed

Yes, sorry, that’s what I meant.

Actually, this is using the cross build image now so lld should be installed, no?

@am11
Copy link
Member

am11 commented Sep 3, 2024

Actually I came here from Jan’s PR, which indicates superpmi test leg isn’t using the container https://dev.azure.com/dnceng-public/public/_build/results?buildId=795908&view=logs&jobId=b65b05e1-c985-593c-6ffc-1fb9e008884e&j=b65b05e1-c985-593c-6ffc-1fb9e008884e&t=a3a60a19-d0c2-5a1d-1fde-5ca19d3821ea

not sure if lld is installed on that host VM.

jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
This breaks the dependency on having dotnet installed when running tests.
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants