Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8242652: Throw SkippedException if no JS engine availabe in TestSearc…
…hScript

Reviewed-by: prappo
  • Loading branch information
hns committed Nov 27, 2020
1 parent ee99686 commit f2f3ba9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 4 additions & 0 deletions test/langtools/TEST.ROOT
Expand Up @@ -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 = ../../
@@ -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
Expand All @@ -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
*/

Expand All @@ -45,6 +47,8 @@
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.
Expand All @@ -61,7 +65,7 @@ private Invocable getEngine() throws ScriptException, IOException, NoSuchMethodE
// 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
Expand All @@ -85,11 +89,6 @@ public void testModuleSearch() throws ScriptException, IOException, NoSuchMethod

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"));
Expand Down Expand Up @@ -186,11 +185,6 @@ public void testPackageSource() throws ScriptException, IOException, NoSuchMetho

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()",
Expand Down

1 comment on commit f2f3ba9

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.