forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves dotnet#73931. This checks that the result of parallel build is the same as the result of single-threaded build. I'd like to add some more code to this so that there's more junk to compile but don't have a good idea of what to add. `XmlSerializer`? Suggestions welcome.
- Loading branch information
1 parent
e68a4cd
commit 54ef3eb
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.IO; | ||
|
||
using var baseline = File.OpenRead("baseline.object"); | ||
using var compare = File.OpenRead("compare.object"); | ||
|
||
Console.WriteLine($"Baseline size: {baseline.Length}"); | ||
Console.WriteLine($"Compare size: {compare.Length}"); | ||
|
||
if (baseline.Length != compare.Length) | ||
throw new Exception("Different sizes"); | ||
|
||
for (int i = 0; i < baseline.Length; i++) | ||
{ | ||
if (baseline.ReadByte() != compare.ReadByte()) | ||
throw new Exception($"Different at byte {i}"); | ||
} | ||
|
||
return 100; |
37 changes: 37 additions & 0 deletions
37
src/tests/nativeaot/SmokeTests/Determinism/Determinism.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Determinism.cs" /> | ||
</ItemGroup> | ||
|
||
<Target Name="IlcCompileSingleThreaded" | ||
Inputs="$(NativeIntermediateOutputPath)%(ManagedBinary.Filename)$(IlcOutputFileExt)" | ||
Outputs="$(NativeIntermediateOutputPath)%(ManagedBinary.Filename)$(IlcOutputFileExt)-singlethreaded" | ||
AfterTargets="IlcCompile"> | ||
|
||
<PropertyGroup> | ||
<OldObjectFileName>$(NativeIntermediateOutputPath)%(ManagedBinary.Filename)$(IlcOutputFileExt)</OldObjectFileName> | ||
<NewObjectFileName>$(NativeIntermediateOutputPath)%(ManagedBinary.Filename)$(IlcOutputFileExt)-singlethreaded</NewObjectFileName> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<IlcArg Remove="-o:$(OldObjectFileName)" /> | ||
<IlcArg Include="-o:$(NewObjectFileName)" /> | ||
<IlcArg Include="--parallelism:1" /> | ||
</ItemGroup> | ||
|
||
<WriteLinesToFile File="%(ManagedBinary.IlcRspFile)-singlethreaded" Lines="@(IlcArg)" Overwrite="true" WriteOnlyWhenDifferent="true" /> | ||
|
||
<Message Text="Compiling single-threaded baseline" Importance="High" /> | ||
|
||
<Exec Command=""$(IlcToolsPath)\ilc" @"%(ManagedBinary.IlcRspFile)-singlethreaded"" | ||
EnvironmentVariables="$(_IlcEnvironmentVariables)" /> | ||
|
||
<Copy SourceFiles="$(OldObjectFileName)" DestinationFiles="$(OutDir)\baseline.object" /> | ||
<Copy SourceFiles="$(NewObjectFileName)" DestinationFiles="$(OutDir)\compare.object" /> | ||
</Target> | ||
</Project> |