From 073b55a628a91e8628a4ab39a212c3a6958aca4f Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 3 Apr 2026 08:48:25 +0100 Subject: Clarify test name --- .../cranelift/PatioToCraneliftAmd64Tests.java | 73 ++++++++++++++++++++++ .../backends/cranelift/PatioToCraneliftTests.java | 73 ---------------------- 2 files changed, 73 insertions(+), 73 deletions(-) create mode 100644 src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftAmd64Tests.java delete mode 100644 src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java (limited to 'src/test/java') diff --git a/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftAmd64Tests.java b/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftAmd64Tests.java new file mode 100644 index 00000000..3d258e0f --- /dev/null +++ b/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftAmd64Tests.java @@ -0,0 +1,73 @@ +package org.shedlang.compiler.backends.cranelift; + +import org.junit.jupiter.api.Disabled; +import org.shedlang.compiler.backends.llvm.LlvmTarget; +import org.shedlang.compiler.backends.paths.PartialTargetPath; +import org.shedlang.compiler.patio.PatioCompilationUnit; +import org.shedlang.compiler.patio.PatioExampleTests; +import org.shedlang.compiler.patio.PatioFunctionDefinition; +import org.shedlang.compiler.patio.PatioVisibility; +import org.shedlang.compiler.patio.instructions.Patio; +import org.shedlang.compiler.patio.types.PatioTypes; +import org.shedlang.compiler.runtime.ShedRuntime; +import org.shedlang.compiler.sources.Sources; +import org.shedlang.compiler.testing.ExecutionResult; +import org.shedlang.compiler.testing.TestProcessRunner; +import org.shedlang.compiler.util.Lists; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Optional; + +@Disabled +public class PatioToCraneliftAmd64Tests extends PatioExampleTests { + @Override + protected ExecutionResult executeCompilationUnit(PatioCompilationUnit patio) throws IOException, InterruptedException { + var main = new PatioFunctionDefinition( + "main", + PatioVisibility.PUBLIC, + List.of(), + PatioTypes.INT32, + List.of( + Patio.call( + Optional.empty(), + FUNCTION_NAME, + List.of() + ), + Patio.return_(Patio.int32Const(0)) + ), + Sources.NULL + ); + + patio = new PatioCompilationUnit( + Lists.concat(patio.elements(), List.of(main)), + patio.source() + ); + + Files.createDirectories(Path.of("tests-tmp")); + var workingDirectory = Files.createTempDirectory(Path.of("tests-tmp"), "PatioToCraneliftTests"); + + var backend = CraneliftBackend.AMD64; + var objectFilePath = backend.compileCompilationUnit( + patio, + new PartialTargetPath(workingDirectory.resolve("main")) + ); + + var executablePath = workingDirectory.resolve("main"); + + var runtime = ShedRuntime.defaultRuntime(LlvmTarget.AMD64.targetName()); + backend.link( + List.of( + objectFilePath, + runtime.dir().resolve("libpatio_test.a") + ), + executablePath, + runtime + ); + + return TestProcessRunner.runCaptureOutput(List.of(executablePath.toString())); + + } +} diff --git a/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java b/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java deleted file mode 100644 index 78efb888..00000000 --- a/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.shedlang.compiler.backends.cranelift; - -import org.junit.jupiter.api.Disabled; -import org.shedlang.compiler.backends.llvm.LlvmTarget; -import org.shedlang.compiler.backends.paths.PartialTargetPath; -import org.shedlang.compiler.patio.PatioCompilationUnit; -import org.shedlang.compiler.patio.PatioExampleTests; -import org.shedlang.compiler.patio.PatioFunctionDefinition; -import org.shedlang.compiler.patio.PatioVisibility; -import org.shedlang.compiler.patio.instructions.Patio; -import org.shedlang.compiler.patio.types.PatioTypes; -import org.shedlang.compiler.runtime.ShedRuntime; -import org.shedlang.compiler.sources.Sources; -import org.shedlang.compiler.testing.ExecutionResult; -import org.shedlang.compiler.testing.TestProcessRunner; -import org.shedlang.compiler.util.Lists; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.Optional; - -@Disabled -public class PatioToCraneliftTests extends PatioExampleTests { - @Override - protected ExecutionResult executeCompilationUnit(PatioCompilationUnit patio) throws IOException, InterruptedException { - var main = new PatioFunctionDefinition( - "main", - PatioVisibility.PUBLIC, - List.of(), - PatioTypes.INT32, - List.of( - Patio.call( - Optional.empty(), - FUNCTION_NAME, - List.of() - ), - Patio.return_(Patio.int32Const(0)) - ), - Sources.NULL - ); - - patio = new PatioCompilationUnit( - Lists.concat(patio.elements(), List.of(main)), - patio.source() - ); - - Files.createDirectories(Path.of("tests-tmp")); - var workingDirectory = Files.createTempDirectory(Path.of("tests-tmp"), "PatioToCraneliftTests"); - - var backend = CraneliftBackend.AMD64; - var objectFilePath = backend.compileCompilationUnit( - patio, - new PartialTargetPath(workingDirectory.resolve("main")) - ); - - var executablePath = workingDirectory.resolve("main"); - - var runtime = ShedRuntime.defaultRuntime(LlvmTarget.AMD64.targetName()); - backend.link( - List.of( - objectFilePath, - runtime.dir().resolve("libpatio_test.a") - ), - executablePath, - runtime - ); - - return TestProcessRunner.runCaptureOutput(List.of(executablePath.toString())); - - } -} -- cgit v1.2.3