mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-14 23:04:57 +00:00
Added KickAss assembly to Test
This commit is contained in:
parent
5986b1d879
commit
0d6ce93e93
@ -2,5 +2,5 @@ image: maven:3-jdk-8
|
|||||||
|
|
||||||
maven_build:
|
maven_build:
|
||||||
script:
|
script:
|
||||||
-"mvn verify"
|
- "mvn verify"
|
||||||
-"cat target/site/jacoco/index.html"
|
- "cat target/site/jacoco/index.html"
|
||||||
|
2
pom.xml
2
pom.xml
@ -7,6 +7,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<argLine> -Xmx2048m</argLine>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -68,7 +69,6 @@
|
|||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.19</version>
|
<version>2.19</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>@{argLine} -Xmx2048m</argLine>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -30,6 +30,10 @@ public class ReferenceHelper {
|
|||||||
this.refPath = refPath;
|
this.refPath = refPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Path getTempDir() {
|
||||||
|
return tempDir;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean testOutput(
|
public boolean testOutput(
|
||||||
String fileName,
|
String fileName,
|
||||||
String extension,
|
String extension,
|
||||||
@ -89,16 +93,20 @@ public class ReferenceHelper {
|
|||||||
return Files.readAllLines(Paths.get(refURI), Charset.defaultCharset());
|
return Files.readAllLines(Paths.get(refURI), Charset.defaultCharset());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeOutputFile(String fileName, String extension, String outputString) throws IOException {
|
public File writeOutputFile(String fileName, String extension, String outputString) throws IOException {
|
||||||
// Write output file
|
// Write output file
|
||||||
File file = new File(tempDir.toFile(), fileName + extension);
|
File file = getTmpFile(fileName, extension);
|
||||||
FileOutputStream outputStream = new FileOutputStream(file);
|
FileOutputStream outputStream = new FileOutputStream(file);
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream);
|
OutputStreamWriter writer = new OutputStreamWriter(outputStream);
|
||||||
writer.write(outputString);
|
writer.write(outputString);
|
||||||
writer.close();
|
writer.close();
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
System.out.println("Output written to " + file.getAbsolutePath());
|
System.out.println("Output written to " + file.getAbsolutePath());
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File getTmpFile(String fileName, String extension) {
|
||||||
|
return new File(tempDir.toFile(), fileName + extension);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,12 @@ import dk.camelot64.kickc.fragment.AsmFragmentTemplateSynthesizer;
|
|||||||
import dk.camelot64.kickc.fragment.AsmFragmentTemplateUsages;
|
import dk.camelot64.kickc.fragment.AsmFragmentTemplateUsages;
|
||||||
import dk.camelot64.kickc.model.CompileError;
|
import dk.camelot64.kickc.model.CompileError;
|
||||||
import dk.camelot64.kickc.model.Program;
|
import dk.camelot64.kickc.model.Program;
|
||||||
|
import kickass.KickAssembler;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
@ -551,6 +553,17 @@ public class TestPrograms {
|
|||||||
Compiler compiler = new Compiler();
|
Compiler compiler = new Compiler();
|
||||||
compiler.addImportPath(testPath);
|
compiler.addImportPath(testPath);
|
||||||
Program program = compiler.compile(fileName);
|
Program program = compiler.compile(fileName);
|
||||||
|
|
||||||
|
helper.writeOutputFile(fileName, ".asm", program.getAsm().toString(false));
|
||||||
|
File asmFile = helper.getTmpFile(fileName, ".asm");
|
||||||
|
File asmPrgFile = helper.getTmpFile(fileName, ".prg");
|
||||||
|
File asmLogFile = helper.getTmpFile(fileName, ".klog");
|
||||||
|
|
||||||
|
int asmRes = KickAssembler.main2(new String[]{asmFile.getAbsolutePath(), "-log", asmLogFile.getAbsolutePath(), "-o", asmPrgFile.getAbsolutePath(), "-vicesymbols", "-showmem"});
|
||||||
|
if(asmRes!=0) {
|
||||||
|
fail("KickAssembling file failed!");
|
||||||
|
}
|
||||||
|
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
success &= helper.testOutput(fileName, ".asm", program.getAsm().toString(false));
|
success &= helper.testOutput(fileName, ".asm", program.getAsm().toString(false));
|
||||||
success &= helper.testOutput(fileName, ".sym", program.getScope().getSymbolTableContents(program));
|
success &= helper.testOutput(fileName, ".sym", program.getScope().getSymbolTableContents(program));
|
||||||
|
Loading…
Reference in New Issue
Block a user