nashorn/test/script/nosecurity/JDK-8050964.js
author twisti
Wed, 11 Nov 2015 14:40:38 -1000
changeset 34173 01bb07d23a5b
parent 31491 bba9c22de331
permissions -rw-r--r--
8141133: [JVMCI] crash during safepoint deopt if rethrow_exception is set Reviewed-by: twisti Contributed-by: Gilles Duboscq <gilles.m.duboscq@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     1
/*
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26067
b32ccc3a76c9 8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents: 25825
diff changeset
     4
 *
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
26067
b32ccc3a76c9 8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents: 25825
diff changeset
     8
 *
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    13
 * accompanied this code).
26067
b32ccc3a76c9 8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents: 25825
diff changeset
    14
 *
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26067
b32ccc3a76c9 8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents: 25825
diff changeset
    18
 *
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    21
 * questions.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    22
 */
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    23
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    24
/**
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    25
 * JDK-8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    26
 *
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    27
 * Make sure that nashorn.jar has only 'compact1' dependency.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    28
 *
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    29
 * @test
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    30
 * @option -scripting
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    31
 * @run
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    32
 */
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    33
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    34
// assume that this script is run with "nashorn.jar" System
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    35
// property set to relative path of nashorn.jar from the current
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    36
// directory of test execution.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    37
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    38
if (typeof fail != 'function') {
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    39
    fail = print;
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    40
}
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    41
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    42
var System = java.lang.System;
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    43
var File = java.io.File;
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    44
var nashornJar = new File(System.getProperty("nashorn.jar"));
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    45
if (! nashornJar.isAbsolute()) {
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    46
    nashornJar = new File(".", nashornJar);
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    47
}
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    48
31491
bba9c22de331 8130306: enable running Nashorn test on Windows
mhaupt
parents: 30698
diff changeset
    49
var os = System.getProperty("os.name"),
bba9c22de331 8130306: enable running Nashorn test on Windows
mhaupt
parents: 30698
diff changeset
    50
    win = os.startsWith("Windows"),
bba9c22de331 8130306: enable running Nashorn test on Windows
mhaupt
parents: 30698
diff changeset
    51
    jdepsName = "jdeps" + (win ? ".exe" : "");
bba9c22de331 8130306: enable running Nashorn test on Windows
mhaupt
parents: 30698
diff changeset
    52
25825
b97d77f4b98e 8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac
sundar
parents: 25586
diff changeset
    53
var javahome = System.getProperty("java.home");
31491
bba9c22de331 8130306: enable running Nashorn test on Windows
mhaupt
parents: 30698
diff changeset
    54
var jdepsPath = javahome + "/../bin/".replace(/\//g, File.separator) + jdepsName;
27571
08ef93eaca80 8049367: Modular Run-Time Images
chegar
parents: 26067
diff changeset
    55
if (! new File(jdepsPath).isFile()) {
31491
bba9c22de331 8130306: enable running Nashorn test on Windows
mhaupt
parents: 30698
diff changeset
    56
    jdepsPath = javahome + "/bin/".replace(/\//g, File.separator) + jdepsName;
27571
08ef93eaca80 8049367: Modular Run-Time Images
chegar
parents: 26067
diff changeset
    57
}
25825
b97d77f4b98e 8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac
sundar
parents: 25586
diff changeset
    58
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    59
// run jdep on nashorn.jar - only summary but print profile info
27811
e415087c78aa 8062638: RuntimeException when run command from js with -scripting on Cygwin
slugovoy
parents: 26067
diff changeset
    60
$ENV.PWD=System.getProperty("user.dir") // to avoid RE on Cygwin
25825
b97d77f4b98e 8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac
sundar
parents: 25586
diff changeset
    61
`${jdepsPath} -s -P ${nashornJar.absolutePath}`
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    62
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    63
// check for "(compact1)" in output from jdep tool
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    64
if (! /(compact1)/.test($OUT)) {
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    65
    fail("non-compact1 dependency: " + $OUT);
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    66
}