8021571: @fork tests should use VM options passed from project.properties

Reviewed-by: lagergren, hannesw, jlaskey
This commit is contained in:
Athijegannathan Sundararajan 2013-07-26 20:10:47 +05:30
parent 716045c405
commit 010a7705a4
28 changed files with 48 additions and 34 deletions

@ -152,14 +152,14 @@ public class ClassGenerator {
}
static MethodGenerator makeStaticInitializer(final ClassVisitor cv, final String name) {
final int access = ACC_PUBLIC | ACC_STATIC;
final int access = ACC_PUBLIC | ACC_STATIC;
final String desc = DEFAULT_INIT_DESC;
final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
return new MethodGenerator(mv, access, name, desc);
}
static MethodGenerator makeConstructor(final ClassVisitor cv) {
final int access = ACC_PUBLIC;
final int access = 0;
final String name = INIT;
final String desc = DEFAULT_INIT_DESC;
final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);

@ -25,6 +25,7 @@
package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
@ -80,7 +81,7 @@ public class ConstructorGenerator extends ClassGenerator {
byte[] getClassBytes() {
// new class extensing from ScriptObject
final String superClass = (constructor != null)? SCRIPTFUNCTIONIMPL_TYPE : SCRIPTOBJECT_TYPE;
cw.visit(V1_7, ACC_PUBLIC | ACC_SUPER, className, null, superClass, null);
cw.visit(V1_7, ACC_FINAL, className, null, superClass, null);
if (memberCount > 0) {
// add fields
emitFields();

@ -25,6 +25,7 @@
package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
@ -60,7 +61,7 @@ public class PrototypeGenerator extends ClassGenerator {
byte[] getClassBytes() {
// new class extensing from ScriptObject
cw.visit(V1_7, ACC_PUBLIC | ACC_SUPER, className, null, PROTOTYPEOBJECT_TYPE, null);
cw.visit(V1_7, ACC_FINAL | ACC_SUPER, className, null, PROTOTYPEOBJECT_TYPE, null);
if (memberCount > 0) {
// add fields
emitFields();

@ -230,6 +230,9 @@ run.test.jvmargs.octane.main=-Xms${run.test.xms} ${run.test.jvmargs.main}
run.test.jvmsecurityargs=-Xverify:all -Djava.security.properties=${basedir}/make/java.security.override -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy
# VM options for script tests with @fork option
test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} ${run.test.jvmsecurityargs}
# path of rhino.jar for benchmarks
rhino.jar=

@ -35,7 +35,7 @@ import jdk.nashorn.internal.runtime.ScriptRuntime;
* must track their {@code [[TargetFunction]]} property for purposes of correctly implementing {@code [[HasInstance]]};
* see {@link ScriptFunction#isInstance(ScriptObject)}.
*/
class BoundScriptFunctionImpl extends ScriptFunctionImpl {
final class BoundScriptFunctionImpl extends ScriptFunctionImpl {
private final ScriptFunction targetFunction;
BoundScriptFunctionImpl(ScriptFunctionData data, ScriptFunction targetFunction) {

@ -75,7 +75,7 @@ public class PrototypeObject extends ScriptObject {
*
* @param map property map
*/
public PrototypeObject(final PropertyMap map) {
PrototypeObject(final PropertyMap map) {
this(Global.instance(), map);
}
@ -89,7 +89,7 @@ public class PrototypeObject extends ScriptObject {
* @param self self reference
* @return constructor, probably, but not necessarily, a {@link ScriptFunction}
*/
public static Object getConstructor(final Object self) {
static Object getConstructor(final Object self) {
return (self instanceof PrototypeObject) ?
((PrototypeObject)self).getConstructor() :
UNDEFINED;
@ -100,7 +100,7 @@ public class PrototypeObject extends ScriptObject {
* @param self self reference
* @param constructor constructor, probably, but not necessarily, a {@link ScriptFunction}
*/
public static void setConstructor(final Object self, final Object constructor) {
static void setConstructor(final Object self, final Object constructor) {
if (self instanceof PrototypeObject) {
((PrototypeObject)self).setConstructor(constructor);
}

@ -51,7 +51,7 @@ import jdk.nashorn.internal.lookup.MethodHandleFactory;
* An AccessorProperty is the most generic property type. An AccessorProperty is
* represented as fields in a ScriptObject class.
*/
public class AccessorProperty extends Property {
public final class AccessorProperty extends Property {
private static final MethodHandles.Lookup lookup = MethodHandles.lookup();
private static final MethodHandle REPLACE_MAP = findOwnMH("replaceMap", Object.class, Object.class, PropertyMap.class, String.class, Class.class, Class.class);
@ -149,7 +149,7 @@ public class AccessorProperty extends Property {
* @param property accessor property to rebind
* @param delegate delegate object to rebind receiver to
*/
public AccessorProperty(final AccessorProperty property, final Object delegate) {
AccessorProperty(final AccessorProperty property, final Object delegate) {
super(property);
this.primitiveGetter = bindTo(property.primitiveGetter, delegate);
@ -185,7 +185,7 @@ public class AccessorProperty extends Property {
* @param getter the property getter
* @param setter the property setter or null if non writable, non configurable
*/
public AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) {
AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) {
super(key, flags, slot);
// we don't need to prep the setters these will never be invalidated as this is a nasgen

@ -33,7 +33,7 @@ import java.lang.invoke.MethodHandle;
* This is a subclass that represents a script function that may not be regenerated.
* This is used for example for bound functions and builtins.
*/
public final class FinalScriptFunctionData extends ScriptFunctionData {
final class FinalScriptFunctionData extends ScriptFunctionData {
/**
* Constructor - used for bind

@ -47,7 +47,7 @@ import jdk.nashorn.internal.runtime.linker.InvokeByName;
* operations respectively, while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and
* {@code pop}.
*/
public class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
public final class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
// These add to the back and front of the list
private static final InvokeByName PUSH = new InvokeByName("push", ScriptObject.class, void.class, Object.class);
private static final InvokeByName UNSHIFT = new InvokeByName("unshift", ScriptObject.class, void.class, Object.class);

@ -100,7 +100,7 @@ public abstract class Property {
* @param flags property flags
* @param slot property field number or spill slot
*/
public Property(final String key, final int flags, final int slot) {
Property(final String key, final int flags, final int slot) {
assert key != null;
this.key = key;
this.flags = flags;
@ -112,7 +112,7 @@ public abstract class Property {
*
* @param property source property
*/
protected Property(final Property property) {
Property(final Property property) {
this.key = property.key;
this.flags = property.flags;
this.slot = property.slot;
@ -123,7 +123,7 @@ public abstract class Property {
*
* @return cloned property
*/
protected abstract Property copy();
abstract Property copy();
/**
* Property flag utility method for {@link PropertyDescriptor}s. Given two property descriptors,

@ -32,6 +32,7 @@ import java.util.WeakHashMap;
* Helper class to manage property listeners and notification.
*/
public class PropertyListenerManager implements PropertyListener {
PropertyListenerManager() {}
/** property listeners for this object. */
private Map<PropertyListener,Boolean> listeners;

@ -67,7 +67,7 @@ public abstract class ScriptFunctionData {
* @param isBuiltin is the function built in
* @param isConstructor is the function a constructor
*/
protected ScriptFunctionData(final String name, final int arity, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
ScriptFunctionData(final String name, final int arity, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
this.name = name;
this.arity = arity;
this.code = new CompiledFunctions();

@ -83,7 +83,7 @@ public final class UserAccessorProperty extends Property {
* @param getterSlot getter slot, starting at first embed
* @param setterSlot setter slot, starting at first embed
*/
public UserAccessorProperty(final String key, final int flags, final int getterSlot, final int setterSlot) {
UserAccessorProperty(final String key, final int flags, final int getterSlot, final int setterSlot) {
super(key, flags, -1);
this.getterSlot = getterSlot;
this.setterSlot = setterSlot;

@ -57,7 +57,7 @@ public final class WithObject extends ScriptObject implements Scope {
* @param scope scope object
* @param expression with expression
*/
public WithObject(final ScriptObject scope, final Object expression) {
WithObject(final ScriptObject scope, final Object expression) {
super(scope, null);
setIsScope();
this.expression = expression;

@ -26,7 +26,7 @@
package jdk.nashorn.internal.runtime.linker;
@SuppressWarnings("serial")
class AdaptationException extends Exception {
final class AdaptationException extends Exception {
private final AdaptationResult adaptationResult;
AdaptationException(final AdaptationResult.Outcome outcome, final String classList) {

@ -32,7 +32,7 @@ import jdk.nashorn.internal.runtime.ECMAException;
* A result of generating an adapter for a class. A tuple of an outcome and - in case of an error outcome - a list of
* classes that caused the error.
*/
class AdaptationResult {
final class AdaptationResult {
/**
* Contains various outcomes for attempting to generate an adapter class. These are stored in AdapterInfo instances.
* We have a successful outcome (adapter class was generated) and four possible error outcomes: superclass is final,

@ -58,7 +58,7 @@ import java.lang.invoke.MethodHandle;
* you dynamically invoke a function with the same name from multiple places in your code, it is advisable to create a
* separate instance of this class for every place.
*/
public class InvokeByName {
public final class InvokeByName {
private final String name;
private final MethodHandle getter;
private final MethodHandle invoker;

@ -56,7 +56,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Set;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Label;

@ -37,7 +37,7 @@ import jdk.nashorn.internal.runtime.Undefined;
/**
* Provides static utility services to generated Java adapter classes.
*/
public class JavaAdapterServices {
public final class JavaAdapterServices {
private static final ThreadLocal<ScriptObject> classOverrides = new ThreadLocal<>();
private JavaAdapterServices() {

@ -42,7 +42,7 @@ import jdk.nashorn.internal.runtime.ScriptObject;
* Utility class shared by {@code NashornLinker} and {@code NashornPrimitiveLinker} for converting JS values to Java
* types.
*/
public class JavaArgumentConverters {
final class JavaArgumentConverters {
private static final MethodHandle TO_BOOLEAN = findOwnMH("toBoolean", Boolean.class, Object.class);
private static final MethodHandle TO_STRING = findOwnMH("toString", String.class, Object.class);

@ -39,7 +39,7 @@ import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
* we can have a more compact representation, as we know that we're always only using {@code "dyn:*"} operations; also
* we're storing flags in an additional primitive field.
*/
public class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor {
public final class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor {
/** Flags that the call site references a scope variable (it's an identifier reference or a var declaration, not a
* property access expression. */
public static final int CALLSITE_SCOPE = 0x01;

@ -46,7 +46,7 @@ import jdk.nashorn.internal.runtime.Undefined;
* This is the main dynamic linker for Nashorn. It is used for linking all {@link ScriptObject} and its subclasses (this
* includes {@link ScriptFunction} and its subclasses) as well as {@link Undefined}.
*/
public final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory, ConversionComparator {
final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory, ConversionComparator {
/**
* Returns true if {@code ScriptObject} is assignable from {@code type}, or it is {@code Undefined}.
*/

@ -25,7 +25,6 @@
package jdk.nashorn.internal.runtime.linker;
import jdk.nashorn.internal.lookup.Lookup;
import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle;
@ -35,6 +34,7 @@ import jdk.internal.dynalink.linker.GuardedInvocation;
import jdk.internal.dynalink.linker.LinkRequest;
import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
import jdk.internal.dynalink.support.Guards;
import jdk.nashorn.internal.lookup.Lookup;
import jdk.nashorn.internal.runtime.ScriptObject;
/**
@ -42,7 +42,7 @@ import jdk.nashorn.internal.runtime.ScriptObject;
* numbers). This class is only public so it can be accessed by classes in the {@code jdk.nashorn.internal.objects}
* package.
*/
public class PrimitiveLookup {
public final class PrimitiveLookup {
private PrimitiveLookup() {
}

@ -36,7 +36,7 @@ import java.util.StringTokenizer;
*
* {@code --log=module1:level1,module2:level2... }
*/
public class KeyValueOption extends Option<String> {
public final class KeyValueOption extends Option<String> {
/**
* Map of keys given
*/

@ -34,7 +34,7 @@ import jdk.nashorn.internal.runtime.QuotedStringTokenizer;
* bundle file. Metainfo such as parameters and description is here as well
* for context sensitive help generation.
*/
public class OptionTemplate implements Comparable<OptionTemplate> {
public final class OptionTemplate implements Comparable<OptionTemplate> {
/** Resource, e.g. "nashorn" for this option */
private final String resource;

@ -109,7 +109,6 @@ public abstract class AbstractScriptRunnable {
this.copyExpectedFileName = buildDir + File.separator + testName + ".EXPECTED";
this.expectedFileName = testFile.getPath() + ".EXPECTED";
final String failListString = System.getProperty(TEST_JS_FAIL_LIST);
if (failListString != null) {
final String[] failedTests = failListString.split(" ");
for (final String failedTest : failedTests) {
@ -151,10 +150,15 @@ public abstract class AbstractScriptRunnable {
}
// shared context or not?
protected static final boolean sharedContext;
protected static final boolean sharedContext = Boolean.getBoolean(TEST_JS_SHARED_CONTEXT);
protected static final String failListString = System.getProperty(TEST_JS_FAIL_LIST);
// VM options when a @fork test is executed by a separate process
protected static final String[] forkJVMOptions;
static {
sharedContext = Boolean.getBoolean(TEST_JS_SHARED_CONTEXT);
String vmOptions = System.getProperty(TestConfig.TEST_FORK_JVM_OPTIONS);
forkJVMOptions = (vmOptions != null)? vmOptions.split(" ") : new String[0];
}
private static ThreadLocal<ScriptEvaluator> evaluators = new ThreadLocal<>();
/**

@ -174,6 +174,9 @@ public final class ScriptRunnable extends AbstractScriptRunnable implements ITes
cmd.add(System.getProperty("java.home") + separator + "bin" + separator + "java");
cmd.add("-Djava.ext.dirs=dist");
for (String str : forkJVMOptions) {
cmd.add(str);
}
cmd.add(Shell.class.getName());
// now add the rest of the "in process" runtime arguments
cmd.addAll(getRuntimeArgs());

@ -74,6 +74,8 @@ public interface TestConfig {
// shared context mode or not
static final String TEST_JS_SHARED_CONTEXT = "test.js.shared.context";
static final String TEST_FORK_JVM_OPTIONS = "test.fork.jvm.options";
// file for storing last run's failed tests
static final String TEST_FAILED_LIST_FILE = "test.failed.list.file";
}