Skip to content

Commit

Permalink
[C#] Provide path to SBE.dll for C# property tests in CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachBray committed Nov 13, 2023
1 parent 306d35f commit 5eba82c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Expand Up @@ -308,13 +308,16 @@ project(':sbe-tool') {
implementation "org.json:json:${jsonVersion}"
}


targets {
all {
testTask.configure {
minHeapSize = '2g'
maxHeapSize = '2g'

javaLauncher.set(toolchainLauncher)

systemProperty 'sbe.dll', "${rootProject.projectDir}/csharp/sbe-dll/bin/Release/netstandard2.0/SBE.dll"
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions csharp/sbe-dll/sbe-dll.csproj
Expand Up @@ -37,10 +37,6 @@
</None>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System.Runtime" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2" PrivateAssets="All" />
<PackageReference Include="System.Memory" Version="4.5.3" />
Expand Down
Expand Up @@ -39,6 +39,8 @@
public class DtosPropertyTest
{
private static final String DOTNET_EXECUTABLE = System.getProperty("sbe.tests.dotnet.executable", "dotnet");
private static final String SBE_DLL =
System.getProperty("sbe.dll", "csharp/sbe-dll/bin/Release/netstandard2.0/SBE.dll");
private static final String CPP_EXECUTABLE = System.getProperty("sbe.tests.cpp.executable", "g++");
private static final boolean KEEP_DIR_ON_FAILURE = Boolean.parseBoolean(
System.getProperty("sbe.tests.keep.dir.on.failure", "true"));
Expand Down Expand Up @@ -80,7 +82,9 @@ void csharpDtoEncodeShouldBeTheInverseOfDtoDecode(
writeInputFile(encodedMessage, tempDir);

execute(encodedMessage.schema(), tempDir, "test",
DOTNET_EXECUTABLE, "run", "--", "input.dat");
DOTNET_EXECUTABLE, "run",
"--property:SBE_DLL=" + SBE_DLL,
"--", "input.dat");

final byte[] inputBytes = new byte[encodedMessage.length()];
encodedMessage.buffer().getBytes(0, inputBytes);
Expand Down Expand Up @@ -211,12 +215,12 @@ private static void execute(
{
final Path stdout = tempDir.resolve(name + "_stdout.txt");
final Path stderr = tempDir.resolve(name + "_stderr.txt");
final ProcessBuilder compileProcessBuilder = new ProcessBuilder(args)
final ProcessBuilder processBuilder = new ProcessBuilder(args)
.directory(tempDir.toFile())
.redirectOutput(stdout.toFile())
.redirectError(stderr.toFile());

final Process process = compileProcessBuilder.start();
final Process process = processBuilder.start();

if (0 != process.waitFor())
{
Expand Down
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<Reference Include="SBE">
<HintPath>/home/zach/src/real-logic/simple-binary-encoding/csharp/sbe-dll/bin/Release/netstandard2.0/SBE.dll</HintPath>
<HintPath>$(SBE_DLL)</HintPath>
</Reference>
</ItemGroup>

Expand Down

0 comments on commit 5eba82c

Please sign in to comment.