parent 00110039e2
author Sasha Koshka <sashakoshka@tebibyte.media> 1711851967 -0400 committer Sasha Koshka <sashakoshka@tebibyte.media> 1711862974 -0400 Compiler tests now run on Windows Compiler tests show linker log Compiler tests show linker log
This commit is contained in:
parent
00110039e2
commit
b6b0a1e592
|
@ -80,7 +80,6 @@ func testUnit (
|
|||
}
|
||||
comp.Writer = compOutputBuilder
|
||||
comp.Output = filepath.Join(temp, "output.o")
|
||||
|
||||
|
||||
// compile to object file
|
||||
err := comp.CompileUnit(address)
|
||||
|
@ -91,22 +90,25 @@ func testUnit (
|
|||
outputCompilerLog()
|
||||
|
||||
// link the object file into an executable
|
||||
executablePath := filepath.Join(temp, "output")
|
||||
linkOutputBuilder := new(strings.Builder)
|
||||
executablePath := FiletypeExecutable.Extend(*comp.Target, filepath.Join(temp, "output"))
|
||||
linkCommand := exec.Command("clang", append (
|
||||
clangArgs,
|
||||
comp.Output,
|
||||
"-v",
|
||||
"-o",
|
||||
executablePath)...)
|
||||
linkCommand.Stdout = compOutputBuilder
|
||||
linkCommand.Stderr = compOutputBuilder
|
||||
linkCommand.Stdout = linkOutputBuilder
|
||||
linkCommand.Stderr = linkOutputBuilder
|
||||
test.Log("running link command: ", linkCommand)
|
||||
err = linkCommand.Run()
|
||||
test.Log("LINKER LOG (main unit):\n" + linkOutputBuilder.String())
|
||||
if err != nil {
|
||||
test.Fatal("error linking executable:", err)
|
||||
}
|
||||
|
||||
// run the executable file (with timeout) and check its output
|
||||
timeoutDuration := 10 * time.Millisecond
|
||||
timeoutDuration := 1000 * time.Millisecond
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeoutDuration)
|
||||
defer cancel()
|
||||
executableCommand := exec.CommandContext(ctx, executablePath, args...)
|
||||
|
|
|
@ -72,15 +72,15 @@ func (filetype Filetype) Extend (target generator.Target, path string) string {
|
|||
func targetSoExt (target generator.Target) string {
|
||||
// TODO: more research is required here
|
||||
switch target.OS {
|
||||
case "windows": return ".dll"
|
||||
default: return ".so"
|
||||
case "win32": return ".dll"
|
||||
default: return ".so"
|
||||
}
|
||||
}
|
||||
|
||||
func targetExeExt (target generator.Target) string {
|
||||
// TODO: more research is required here
|
||||
switch target.OS {
|
||||
case "windows": return ".exe"
|
||||
default: return ""
|
||||
case "win32": return ".exe"
|
||||
default: return ""
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue