Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CoTA
examples
cota-runner-jdk21-junit5
Commits
1f909b70
Commit
1f909b70
authored
2 months ago
by
mamunozgil
Browse files
Options
Download
Email Patches
Plain Diff
Added debug in Testrunner
parent
bc898ea8
amg-dev-volumes
No related merge requests found
Pipeline
#10961
passed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docker-compose.yaml
+2
-3
docker-compose.yaml
src/main/java/de/hftstuttgart/dta/Testrunner.java
+39
-19
src/main/java/de/hftstuttgart/dta/Testrunner.java
with
41 additions
and
22 deletions
+41
-22
docker-compose.yaml
+
2
-
3
View file @
1f909b70
...
...
@@ -33,12 +33,11 @@ services:
-
mariadb-dtt
backend
:
container_name
:
backend
image
:
cota-backend:
lat
es
t
image
:
cota-backend:
volum
es
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
...
...
This diff is collapsed.
Click to expand it.
src/main/java/de/hftstuttgart/dta/Testrunner.java
+
39
-
19
View file @
1f909b70
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets