Skip to content

Commit

Permalink
Include net9.0 in x86 install hack; add LUCENENET comments to ReadExa…
Browse files Browse the repository at this point in the history
…ctly use
  • Loading branch information
paulirwin committed Nov 28, 2024
1 parent ab0e441 commit e8f1f4d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .build/azure-templates/run-tests-on-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ steps:
sdkVersion: '${{ parameters.dotNetSdkVersion }}'
performMultiLevelLookup: '${{ variables.PerformMultiLevelLookup }}'

# Hack: .NET 8 no longer installs the x86 bits and they must be installed separately. However, it is not
# Hack: .NET 8+ no longer installs the x86 bits and they must be installed separately. However, it is not
# trivial to get it into the path and to get it to pass the minimum SDK version check in runbuild.ps1.
# So, we install it afterward and set the environment variable so the above SDK can delegate to it.
# This code only works on Windows.
Expand All @@ -105,7 +105,7 @@ steps:
& $installScriptPath -Version $sdkVersion -Architecture $architecture -InstallDir $installPath
Write-Host "##vso[task.setvariable variable=DOTNET_ROOT_X86;]$installPath"
displayName: 'Use .NET SDK ${{ parameters.dotNetSdkVersion }} (x86)'
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net8.'), eq('${{ parameters.vsTestPlatform }}', 'x86'))
condition: and(succeeded(), or(contains('${{ parameters.framework }}', 'net8.'), contains('${{ parameters.framework }}', 'net9.')), eq('${{ parameters.vsTestPlatform }}', 'x86'))

- task: UseDotNet@2
displayName: 'Use .NET SDK 6.0.421'
Expand All @@ -115,7 +115,7 @@ steps:
performMultiLevelLookup: '${{ variables.PerformMultiLevelLookup }}'
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net6.'))

# Hack: .NET 8 no longer installs the x86 bits and they must be installed separately. However, it is not
# Hack: .NET 8+ no longer installs the x86 bits and they must be installed separately. However, it is not
# trivial to get it into the path and to get it to pass the minimum SDK version check in runbuild.ps1.
# So, we install it afterward and set the environment variable so the above SDK can delegate to it.
# This code only works on Windows.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void TestGetImageAsObject()
// Get the expected bytes
using var expectedStream = GetType().Assembly.GetManifestResourceStream("Lucene.Net.QueryParsers.Support.Flexible.Core.Messages.lucene-net-icon-32x32.png");
byte[] expectedBytes = new byte[expectedStream.Length];
expectedStream.ReadExactly(expectedBytes, 0, (int)expectedStream.Length);
expectedStream.ReadExactly(expectedBytes, 0, (int)expectedStream.Length); // LUCENENET specific - calling ReadExactly to ensure we read the exact number of bytes

// Check the wrapper to ensure we can read the bytes
Assert.AreEqual(expectedBytes, MessagesTest.LUCENE_NET_ICON_32x32);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void TestOpen()
offset = skip;
}
src.ReadBytes(srcBytes, offset, srcBytes.Length - offset);
@in.ReadExactly(inBytes, offset, inBytes.Length - offset);
@in.ReadExactly(inBytes, offset, inBytes.Length - offset); // LUCENENET specific - calling ReadExactly to ensure we read the exact number of bytes
assertArrayEquals(srcBytes, inBytes);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Tests.Replicator/IndexInputStreamTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void Read_RemainingIndexInputLargerThanReadCount_ReturnsExpectedSection([
byte[] readBuffer = new byte[readBytes];
for (int i = section; i > 0; i--)
{
stream.ReadExactly(readBuffer, 0, readBytes);
stream.ReadExactly(readBuffer, 0, readBytes); // LUCENENET specific - calling ReadExactly to ensure we read the exact number of bytes
}

Assert.AreEqual(readBuffer, buffer.Skip((section - 1) * readBytes).Take(readBytes).ToArray());
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Tests.Replicator/IndexRevisionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void TestOpen()
offset = skip;
}
src.ReadBytes(srcBytes, offset, srcBytes.Length - offset);
@in.ReadExactly(inBytes, offset, inBytes.Length - offset);
@in.ReadExactly(inBytes, offset, inBytes.Length - offset); // LUCENENET specific - calling ReadExactly to ensure we read the exact number of bytes
assertArrayEquals(srcBytes, inBytes);
IOUtils.Dispose(src, @in);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Lucene.Net.Tests/Util/TestOfflineSorter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private void AssertFilesIdentical(FileInfo golden, FileInfo sorted)
using Stream is2 = sorted.Open(FileMode.Open, FileAccess.Read, FileShare.Delete);
while ((len = is1.Read(buf1, 0, buf1.Length)) > 0)
{
is2.ReadExactly(buf2, 0, len);
is2.ReadExactly(buf2, 0, len); // LUCENENET specific - calling ReadExactly to ensure we read the exact number of bytes

for (int i = 0; i < len; i++)
{
Expand All @@ -258,7 +258,7 @@ private void AssertFilesIdentical(FileStream golden, FileStream sorted)
Stream is2 = sorted;
while ((len = is1.Read(buf1, 0, buf1.Length)) > 0)
{
is2.ReadExactly(buf2, 0, len);
is2.ReadExactly(buf2, 0, len); // LUCENENET specific - calling ReadExactly to ensure we read the exact number of bytes

for (int i = 0; i < len; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<RootNamespace>Lucene.Net.CodeAnalysis</RootNamespace>

<IsPublishable>false</IsPublishable>
<IsPublishable Condition=" '$(TargetFramework)' == 'net8.0' ">true</IsPublishable>
<IsPublishable Condition=" '$(TargetFramework)' == 'net8.0' Or '$(TargetFramework)' == 'net9.0' ">true</IsPublishable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<Import Project="$(SolutionDir).build/TestReferences.Common.targets" />

<ItemGroup>
Expand Down

0 comments on commit e8f1f4d

Please sign in to comment.