From f4b523542bb6eec490e812238b22cca4f46edc03 Mon Sep 17 00:00:00 2001 From: Zach Bray Date: Mon, 13 Nov 2023 12:45:25 +0000 Subject: [PATCH] [C#] Provide path to SBE.dll for C# property tests in CI. --- build.gradle | 3 +++ .../co/real_logic/sbe/properties/DtosPropertyTest.java | 10 +++++++--- .../CSharpDtosPropertyTest/SbePropertyTest.csproj | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 17d7a27af..bb9c737a9 100644 --- a/build.gradle +++ b/build.gradle @@ -311,6 +311,7 @@ project(':sbe-tool') { implementation "org.json:json:${jsonVersion}" } + targets { all { testTask.configure { @@ -318,6 +319,8 @@ project(':sbe-tool') { maxHeapSize = '2g' javaLauncher.set(toolchainLauncher) + + systemProperty 'sbe.dll', "${rootProject.projectDir}/csharp/sbe-dll/bin/Release/netstandard2.0/SBE.dll" } } } diff --git a/sbe-tool/src/propertyTest/java/uk/co/real_logic/sbe/properties/DtosPropertyTest.java b/sbe-tool/src/propertyTest/java/uk/co/real_logic/sbe/properties/DtosPropertyTest.java index d68a1c327..8adc57679 100644 --- a/sbe-tool/src/propertyTest/java/uk/co/real_logic/sbe/properties/DtosPropertyTest.java +++ b/sbe-tool/src/propertyTest/java/uk/co/real_logic/sbe/properties/DtosPropertyTest.java @@ -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")); @@ -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); @@ -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()) { diff --git a/sbe-tool/src/propertyTest/resources/CSharpDtosPropertyTest/SbePropertyTest.csproj b/sbe-tool/src/propertyTest/resources/CSharpDtosPropertyTest/SbePropertyTest.csproj index 8b0b167d2..5da3f7609 100644 --- a/sbe-tool/src/propertyTest/resources/CSharpDtosPropertyTest/SbePropertyTest.csproj +++ b/sbe-tool/src/propertyTest/resources/CSharpDtosPropertyTest/SbePropertyTest.csproj @@ -7,7 +7,7 @@ - /home/zach/src/real-logic/simple-binary-encoding/csharp/sbe-dll/bin/Release/netstandard2.0/SBE.dll + $(SBE_DLL)