8242652: Throw SkippedException if no JS engine availabe in TestSearchScript

Reviewed-by: prappo
This commit is contained in:
Hannes Wallnöfer 2020-11-27 09:43:01 +00:00
parent ee99686b28
commit f2f3ba92d7
2 changed files with 10 additions and 12 deletions

View File

@ -22,3 +22,7 @@ useNewOptions=true
# Use --patch-module instead of -Xmodule:
useNewPatchModule=true
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
external.lib.roots = ../../

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, 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
@ -26,8 +26,10 @@
* @bug 8178982 8220497 8210683 8241982
* @summary Test the search feature of javadoc.
* @library ../../lib
* @library /test/lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build javadoc.tester.*
* @build jtreg.SkippedException
* @run main TestSearchScript
*/
@ -45,6 +47,8 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import jtreg.SkippedException;
/*
* Tests for the search feature using any available javax.script JavaScript engine.
* The test is skipped if no JavaScript engine is available.
@ -61,7 +65,7 @@ public class TestSearchScript extends JavadocTester {
// Use "js" engine name to use any available JavaScript engine.
ScriptEngine engine = engineManager.getEngineByName("js");
if (engine == null) {
return null;
throw new SkippedException("JavaScript engine is not available.");
}
// For GraalJS set Nashorn compatibility mode via Bindings,
// see https://github.com/graalvm/graaljs/blob/master/docs/user/ScriptEngine.md
@ -85,11 +89,6 @@ public class TestSearchScript extends JavadocTester {
Invocable inv = getEngine();
if (inv == null) {
out.println("No JavaScript engine available. Test skipped.");
return;
}
// exact match, case sensitivity
checkSearch(inv, "mapmodule", List.of("mapmodule"));
checkSearch(inv, "mappkg", List.of("mapmodule/mappkg", "mapmodule/mappkg.impl", "mappkg.system.property"));
@ -186,11 +185,6 @@ public class TestSearchScript extends JavadocTester {
Invocable inv = getEngine();
if (inv == null) {
out.println("No JavaScript engine available. Test skipped.");
return;
}
// exact match, case sensitvity, left boundaries
checkSearch(inv, "list", List.of("listpkg", "listpkg.List", "listpkg.ListProvider", "listpkg.MyList",
"listpkg.MyListFactory", "listpkg.ListProvider.ListProvider()",