Skip to content

Commit

Permalink
Disable all bots tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sormuras committed Aug 27, 2019
1 parent 3197f9a commit 20b2683
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.openjdk.skara.vcs.openjdk.convert.*;

import org.junit.jupiter.api.*;
import org.junit.jupiter.api.condition.*;

import java.io.*;
import java.net.URI;
Expand All @@ -44,7 +43,6 @@

import static org.junit.jupiter.api.Assertions.*;

@DisabledOnOs(OS.WINDOWS)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class BridgeBotTests {
private List<String> runHgCommand(Repository repository, String... params) throws IOException {
Expand Down Expand Up @@ -130,7 +128,6 @@ private Set<String> getCommitHashes(Repository repo) throws IOException {
void setup() throws IOException {
// Export the beginning of the jtreg repository
sourceFolder = new TemporaryDirectory();
Assumptions.assumeFalse(OS.WINDOWS.isCurrentOs(), "Running on Windows -- skipping tests");
try {
var localRepo = Repository.materialize(sourceFolder.path(), URIBuilder.base("http://hg.openjdk.java.net/code-tools/jtreg").build(), "default");
runHgCommand(localRepo, "strip", "-r", "b2511c725d81");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void apply(Project project) {

var jvmArgs = new ArrayList<String>(testTask.getJvmArgs());
jvmArgs.addAll(List.of(
"-Djunit.jupiter.extensions.autodetection.enabled=true",
"--module-path", classpath,
"--add-modules", "ALL-MODULE-PATH",
"--patch-module", moduleName + "=" + outputDir,
Expand Down
3 changes: 3 additions & 0 deletions test/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
requires org.junit.jupiter.api;

exports org.openjdk.skara.test;

provides org.junit.jupiter.api.extension.Extension
with org.openjdk.skara.test.DisableAllBotsTestsOnWindows;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.skara.test;

import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled;
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;

import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext;

public class DisableAllBotsTestsOnWindows implements ExecutionCondition {
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
if (!OS.WINDOWS.isCurrentOs()) {
return enabled("Non-Windows OS");
}
var test = context.getRequiredTestClass();
var bots = test.getPackageName().startsWith("org.openjdk.skara.bots.");
return bots ? disabled("All bots tests are disabled on Windows") : enabled("Non-bots test");
}
}

0 comments on commit 20b2683

Please sign in to comment.