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

Added debug in Testrunner

parent bc898ea8
Pipeline #10961 passed with stage
Showing with 41 additions and 22 deletions
+41 -22
...@@ -33,12 +33,11 @@ services: ...@@ -33,12 +33,11 @@ services:
- mariadb-dtt - mariadb-dtt
backend: backend:
container_name: backend container_name: backend
image: cota-backend:latest image: cota-backend:volumes
user: "${UID}:${GID}" user: "${UID}:${GID}"
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- 'backend_dta_data: /dta-tests-assignments' - 'backend_dta_data:/dta-tests-assignments'
- '/tmp/dta-tests:/tmp/dta-tests'
volumes: volumes:
mariadb_data_dtt: mariadb_data_dtt:
driver: local driver: local
......
...@@ -63,25 +63,45 @@ public class Testrunner ...@@ -63,25 +63,45 @@ public class Testrunner
public static String[] classPathItems; // items for the classpath public static String[] classPathItems; // items for the classpath
public static String resultFolder; // folder the result file gets serialized to public static String resultFolder; // folder the result file gets serialized to
public static void main(String[] args) throws Exception public static void main(String[] args) throws Exception {
{ LOG.info("OpenJDK21 JUnit5/Jupiter Testrunner started");
LOG.info("OpenJDK21 JUnit5/Jupiter Testrunner started");
if (args.length < 3) {
LOG.info("initializing fields..."); LOG.severe("Insufficient arguments provided. Expected: <sourceFolders>:<libraryFolders>:<resultFolder>");
sourceFolders = args[0].split(":"); throw new IllegalArgumentException("Missing required arguments.");
libraryFolders = args[1].split(":"); }
resultFolder = args[2];
classFolder = Files.createTempDirectory("testrunner").toAbsolutePath().toString(); LOG.info("Initializing fields...");
sourceFolders = args[0].split(":");
// finding all source files libraryFolders = args[1].split(":");
Set<File> sourceFiles = new HashSet<>(); resultFolder = args[2];
for (String folder : sourceFolders)
{ LOG.info(String.format("Source folders: %s", Arrays.toString(sourceFolders)));
sourceFiles.addAll(getAllJavaFilesInFolder(Paths.get(folder).toFile())); LOG.info(String.format("Library folders: %s", Arrays.toString(libraryFolders)));
} LOG.info(String.format("Result folder: %s", resultFolder));
// call compilation and generate Results for failed compiles classFolder = Files.createTempDirectory("testrunner").toAbsolutePath().toString();
Set<Result> compilationErrors = generateCompileResults(compile(sourceFiles, new File(classFolder))); 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 // run unit tests found in the compiled class files
ResultSummary resultSummary = runTests(); 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