Skip to content

Commit 7ea3269

Browse files
sormurasedvbld
authored andcommitted
Fine-tune testing on Windows
Reviewed-by: ehelin, jvernee
1 parent 25a8f8f commit 7ea3269

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/WebrevStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ URI createAndArchive(PullRequestInstance prInstance, Path scratchPath, Hash base
114114
if (!localStorage.isClean()) {
115115
push(localStorage, outputFolder, baseFolder.resolve(prInstance.id()).toString());
116116
}
117-
return URIBuilder.base(baseUri).appendPath(relativeFolder.toString()).build();
117+
return URIBuilder.base(baseUri).appendPath(relativeFolder.toString().replace('\\', '/')).build();
118118
} catch (IOException e) {
119119
throw new UncheckedIOException(e);
120120
}

buildSrc/module/src/main/java/org/openjdk/skara/gradle/module/ModulePlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public void apply(Project project) {
103103

104104
var jvmArgs = new ArrayList<String>(testTask.getJvmArgs());
105105
jvmArgs.addAll(List.of(
106+
"-Djunit.jupiter.extensions.autodetection.enabled=true",
106107
"--module-path", classpath,
107108
"--add-modules", "ALL-MODULE-PATH",
108109
"--patch-module", moduleName + "=" + outputDir,

test/src/main/java/module-info.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@
3636
requires org.junit.jupiter.api;
3737

3838
exports org.openjdk.skara.test;
39+
40+
provides org.junit.jupiter.api.extension.Extension
41+
with org.openjdk.skara.test.DisableAllBotsTestsOnWindows;
3942
}
4043

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
package org.openjdk.skara.test;
24+
25+
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled;
26+
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
27+
28+
import org.junit.jupiter.api.condition.OS;
29+
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
30+
import org.junit.jupiter.api.extension.ExecutionCondition;
31+
import org.junit.jupiter.api.extension.ExtensionContext;
32+
33+
public class DisableAllBotsTestsOnWindows implements ExecutionCondition {
34+
@Override
35+
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
36+
if (!OS.WINDOWS.isCurrentOs()) {
37+
return enabled("Non-Windows OS");
38+
}
39+
var test = context.getRequiredTestClass();
40+
var bots = test.getPackageName().startsWith("org.openjdk.skara.bots.");
41+
return bots ? disabled("All bots tests are disabled on Windows") : enabled("Non-bots test");
42+
}
43+
}

0 commit comments

Comments
 (0)