Commit 1f909b70 authored by mamunozgil's avatar mamunozgil
Browse files

Added debug in Testrunner

No related merge requests found
Pipeline #10961 passed with stage
Showing with 41 additions and 22 deletions
+41 -22
......@@ -33,12 +33,11 @@ services:
- mariadb-dtt
backend:
container_name: backend
image: cota-backend:latest
image: cota-backend:volumes
user: "${UID}:${GID}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- 'backend_dta_data: /dta-tests-assignments'
- '/tmp/dta-tests:/tmp/dta-tests'
- 'backend_dta_data:/dta-tests-assignments'
volumes:
mariadb_data_dtt:
driver: local
......
......@@ -63,25 +63,45 @@ public class Testrunner
public static String[] classPathItems; // items for the classpath
public static String resultFolder; // folder the result file gets serialized to
public static void main(String[] args) throws Exception
{
LOG.info("OpenJDK21 JUnit5/Jupiter Testrunner started");
LOG.info("initializing fields...");
sourceFolders = args[0].split(":");
libraryFolders = args[1].split(":");
resultFolder = args[2];
classFolder = Files.createTempDirectory("testrunner").toAbsolutePath().toString();
// finding all source files
Set<File> sourceFiles = new HashSet<>();
for (String folder : sourceFolders)
{
sourceFiles.addAll(getAllJavaFilesInFolder(Paths.get(folder).toFile()));
}
// call compilation and generate Results for failed compiles
Set<Result> compilationErrors = generateCompileResults(compile(sourceFiles, new File(classFolder)));
public static void main(String[] args) throws Exception {
LOG.info("OpenJDK21 JUnit5/Jupiter Testrunner started");
if (args.length < 3) {
LOG.severe("Insufficient arguments provided. Expected: <sourceFolders>:<libraryFolders>:<resultFolder>");
throw new IllegalArgumentException("Missing required arguments.");
}
LOG.info("Initializing fields...");
sourceFolders = args[0].split(":");
libraryFolders = args[1].split(":");
resultFolder = args[2];
LOG.info(String.format("Source folders: %s", Arrays.toString(sourceFolders)));
LOG.info(String.format("Library folders: %s", Arrays.toString(libraryFolders)));
LOG.info(String.format("Result folder: %s", resultFolder));
classFolder = Files.createTempDirectory("testrunner").toAbsolutePath().toString();
LOG.info(String.format("Temporary class folder: %s", classFolder));
// Discover source files
Set<File> sourceFiles = new HashSet<>();
for (String folder : sourceFolders) {
File dir = Paths.get(folder).toFile();
if (!dir.exists() || !dir.isDirectory()) {
LOG.warning(String.format("Source folder does not exist or is not a directory: %s", folder));
continue;
}
sourceFiles.addAll(getAllJavaFilesInFolder(dir));
}
LOG.info(String.format("Discovered %d source files.", sourceFiles.size()));
if (sourceFiles.isEmpty()) {
LOG.severe("No source files found. Compilation cannot proceed.");
throw new IllegalStateException("No source files found.");
}
// Compilation
Set<Result> compilationErrors = generateCompileResults(compile(sourceFiles, new File(classFolder)));
// run unit tests found in the compiled class files
ResultSummary resultSummary = runTests();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment