junit: fix compiling tests for platforms which don't participate in testing

This commit is contained in:
Alexey Andreev 2023-11-26 22:05:23 +01:00
parent 9757213379
commit b3e889fa11

View File

@ -110,7 +110,7 @@ public class TeaVMTestRunner extends Runner implements Filterable {
platforms.add(new CPlatformSupport(classSource, referenceCache)); platforms.add(new CPlatformSupport(classSource, referenceCache));
for (var platform : platforms) { for (var platform : platforms) {
if (platform.isEnabled()) { if (platform.isEnabled() && !platform.getConfigurations().isEmpty()) {
var runStrategy = platform.createRunStrategy(outputDir); var runStrategy = platform.createRunStrategy(outputDir);
if (runStrategy != null) { if (runStrategy != null) {
runners.put(platform.getPlatform(), runStrategy); runners.put(platform.getPlatform(), runStrategy);
@ -148,7 +148,7 @@ public class TeaVMTestRunner extends Runner implements Filterable {
@Override @Override
public void run(RunNotifier notifier) { public void run(RunNotifier notifier) {
for (var platform : platforms) { for (var platform : platforms) {
if (!platform.getConfigurations().isEmpty()) { if (platform.isEnabled() && !platform.getConfigurations().isEmpty()) {
participatingPlatforms.add(platform); participatingPlatforms.add(platform);
} }
} }
@ -228,7 +228,7 @@ public class TeaVMTestRunner extends Runner implements Filterable {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private boolean compileClassForPlatform(TestPlatformSupport<?> platform, List<Method> children, private boolean compileClassForPlatform(TestPlatformSupport<?> platform, List<Method> children,
Description description, RunNotifier notifier) { Description description, RunNotifier notifier) {
if (hasChildrenToRun(children, platform.getPlatform())) { if (platform.isEnabled() && hasChildrenToRun(children, platform.getPlatform())) {
for (var configuration : platform.getConfigurations()) { for (var configuration : platform.getConfigurations()) {
var path = getOutputPathForClass(platform); var path = getOutputPathForClass(platform);
var castPlatform = (TestPlatformSupport<TeaVMTarget>) platform; var castPlatform = (TestPlatformSupport<TeaVMTarget>) platform;
@ -337,7 +337,7 @@ public class TeaVMTestRunner extends Runner implements Filterable {
MethodReference reference = new MethodReference(child.getDeclaringClass().getName(), descriptor); MethodReference reference = new MethodReference(child.getDeclaringClass().getName(), descriptor);
for (var platform : participatingPlatforms) { for (var platform : participatingPlatforms) {
if (shouldRunChild(child, platform.getPlatform())) { if (platform.isEnabled() && shouldRunChild(child, platform.getPlatform())) {
var outputPath = getOutputPathForClass(platform); var outputPath = getOutputPathForClass(platform);
var outputPathForMethod = getOutputPath(child, platform); var outputPathForMethod = getOutputPath(child, platform);
for (var configuration : platform.getConfigurations()) { for (var configuration : platform.getConfigurations()) {
@ -357,7 +357,7 @@ public class TeaVMTestRunner extends Runner implements Filterable {
try { try {
for (var platform : participatingPlatforms) { for (var platform : participatingPlatforms) {
if (shouldRunChild(child, platform.getPlatform())) { if (platform.isEnabled() && shouldRunChild(child, platform.getPlatform())) {
File outputPath = getOutputPath(child, platform); File outputPath = getOutputPath(child, platform);
for (var configuration : platform.getConfigurations()) { for (var configuration : platform.getConfigurations()) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")