mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-28 20:03:39 +00:00
8033105: Make sure Nashorn test harness can run zlib benchmark
Reviewed-by: attila, hannesw
This commit is contained in:
parent
af27b4200d
commit
6163a42a8e
@ -36,6 +36,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import jdk.nashorn.internal.runtime.ConsString;
|
||||
import jdk.nashorn.internal.runtime.Debug;
|
||||
import jdk.nashorn.internal.runtime.DebugLogger;
|
||||
|
||||
@ -157,7 +157,7 @@ public final class ScriptingFunctions {
|
||||
// Set up ENV variables.
|
||||
final Map<String, String> environment = processBuilder.environment();
|
||||
environment.clear();
|
||||
for (Map.Entry<Object, Object> entry : envProperties.entrySet()) {
|
||||
for (final Map.Entry<Object, Object> entry : envProperties.entrySet()) {
|
||||
environment.put(JSType.toString(entry.getKey()), JSType.toString(entry.getValue()));
|
||||
}
|
||||
}
|
||||
@ -168,15 +168,15 @@ public final class ScriptingFunctions {
|
||||
|
||||
// Collect output.
|
||||
final StringBuilder outBuffer = new StringBuilder();
|
||||
Thread outThread = new Thread(new Runnable() {
|
||||
final Thread outThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
char buffer[] = new char[1024];
|
||||
final char buffer[] = new char[1024];
|
||||
try (final InputStreamReader inputStream = new InputStreamReader(process.getInputStream())) {
|
||||
for (int length; (length = inputStream.read(buffer, 0, buffer.length)) != -1; ) {
|
||||
outBuffer.append(buffer, 0, length);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
exception[0] = ex;
|
||||
}
|
||||
}
|
||||
@ -184,15 +184,15 @@ public final class ScriptingFunctions {
|
||||
|
||||
// Collect errors.
|
||||
final StringBuilder errBuffer = new StringBuilder();
|
||||
Thread errThread = new Thread(new Runnable() {
|
||||
final Thread errThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
char buffer[] = new char[1024];
|
||||
final char buffer[] = new char[1024];
|
||||
try (final InputStreamReader inputStream = new InputStreamReader(process.getErrorStream())) {
|
||||
for (int length; (length = inputStream.read(buffer, 0, buffer.length)) != -1; ) {
|
||||
errBuffer.append(buffer, 0, length);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
exception[1] = ex;
|
||||
}
|
||||
}
|
||||
@ -205,10 +205,10 @@ public final class ScriptingFunctions {
|
||||
// If input is present, pass on to process.
|
||||
try (OutputStreamWriter outputStream = new OutputStreamWriter(process.getOutputStream())) {
|
||||
if (input != UNDEFINED) {
|
||||
String in = JSType.toString(input);
|
||||
final String in = JSType.toString(input);
|
||||
outputStream.write(in, 0, in.length());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
// Process was not expecting input. May be normal state of affairs.
|
||||
}
|
||||
|
||||
@ -226,9 +226,9 @@ public final class ScriptingFunctions {
|
||||
global.set(EXIT_NAME, exit, false);
|
||||
|
||||
// Propagate exception if present.
|
||||
for (int i = 0; i < exception.length; i++) {
|
||||
if (exception[i] != null) {
|
||||
throw exception[i];
|
||||
for (final IOException element : exception) {
|
||||
if (element != null) {
|
||||
throw element;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
* @option -Dnashorn.compiler.splitter.threshold=1000
|
||||
* @fork
|
||||
* @runif external.octane
|
||||
* @option -scripting
|
||||
*/
|
||||
|
||||
compile_only = true;
|
||||
|
||||
@ -12,3 +12,4 @@
|
||||
[richards] Compiled OK
|
||||
[splay] Compiled OK
|
||||
[typescript] Compiled OK
|
||||
[zlib] Compiled OK
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @runif external.octane
|
||||
* @option -scripting
|
||||
*/
|
||||
|
||||
compile_only = true;
|
||||
|
||||
@ -12,3 +12,4 @@
|
||||
[richards] Compiled OK
|
||||
[splay] Compiled OK
|
||||
[typescript] Compiled OK
|
||||
[zlib] Compiled OK
|
||||
|
||||
@ -25,6 +25,14 @@
|
||||
* @subtest
|
||||
*/
|
||||
|
||||
var read = readFully;
|
||||
|
||||
function initZlib() {
|
||||
zlib = new BenchmarkSuite('zlib', [152815148], [
|
||||
new Benchmark('zlib', false, true, 10,
|
||||
runZlib, undefined, tearDownZlib, null, 3)]);
|
||||
}
|
||||
|
||||
var tests = [
|
||||
{name:"box2d", files:["box2d.js"], suite:"Box2DBenchmark"},
|
||||
{name:"code-load", files:["code-load.js"], suite:"CodeLoad"},
|
||||
@ -39,9 +47,9 @@ var tests = [
|
||||
{name:"regexp", files:["regexp.js"], suite:"RegExpSuite"},
|
||||
{name:"richards", files:["richards.js"], suite:"Richards"},
|
||||
{name:"splay", files:["splay.js"], suite:"Splay"},
|
||||
{name:"typescript", files:["typescript.js", "typescript-input.js", "typescript-compiler.js"], suite:"typescript"}
|
||||
{name:"typescript", files:["typescript.js", "typescript-input.js", "typescript-compiler.js"], suite:"typescript"},
|
||||
//zlib currently disabled - requires read
|
||||
// {name:"zlib", files:["zlib.js", "zlib-data.js"], suite:"zlib"},
|
||||
{name:"zlib", files:["zlib.js", "zlib-data.js"], suite:"zlib", before:initZlib}
|
||||
];
|
||||
var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__;
|
||||
|
||||
@ -78,6 +86,10 @@ function load_bench(arg) {
|
||||
print_verbose(arg, "loading '" + arg.name + "' [" + f + "]...");
|
||||
load(file_name);
|
||||
}
|
||||
|
||||
if (typeof arg.before !== 'undefined') {
|
||||
arg.before();
|
||||
}
|
||||
|
||||
if (compile_and_return) {
|
||||
print_always(arg, "Compiled OK");
|
||||
@ -86,6 +98,7 @@ function load_bench(arg) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function run_one_benchmark(arg, iters) {
|
||||
|
||||
if (!load_bench(arg)) {
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* runsunspider : runs the sunspider tests and checks for compliance
|
||||
*
|
||||
* @test
|
||||
* @option -timezone=PST
|
||||
* @runif external.sunspider
|
||||
*/
|
||||
|
||||
load(__DIR__ + "runsunspider.js");
|
||||
|
||||
@ -24,7 +24,9 @@
|
||||
/**
|
||||
* runsunspider : runs the sunspider tests and checks for compliance
|
||||
*
|
||||
* @subtest
|
||||
* @test
|
||||
* @option -timezone=PST
|
||||
* @runif external.sunspider
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
1
nashorn/test/script/basic/runsunspider.js.EXPECTED
Normal file
1
nashorn/test/script/basic/runsunspider.js.EXPECTED
Normal file
@ -0,0 +1 @@
|
||||
Sunspider finished!
|
||||
Loading…
x
Reference in New Issue
Block a user