jdk/test/tools/jjs/jjs-modulepathTest.sh
author sundar
Fri, 07 Oct 2016 21:28:00 +0530
changeset 41374 092e014ed01e
permissions -rw-r--r--
8167018: Nashorn and jjs should support --module-path and --add-modules options Reviewed-by: jlaskey, hannesw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41374
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     1
#!/bin/sh
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     2
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     3
#
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     4
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     6
#
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
     9
# published by the Free Software Foundation.
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    10
#
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    15
# accompanied this code).
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    16
#
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    20
#
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    23
# questions.
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    24
#
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    25
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    26
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    27
# @test
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    28
# @bug 8167018
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    29
# @summary Nashorn and jjs should support --module-path and --add-modules options
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    30
# @run shell jjs-modulepathTest.sh
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    31
# Tests --module-path option to set the module path for jjs
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    32
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    33
. ${TESTSRC-.}/common.sh
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    34
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    35
setup
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    36
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    37
mkdir -p ${TESTCLASSES}/com.greetings
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    38
rm -rf ${TESTCLASSES}/com.greetings
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    39
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    40
${JAVAC} ${TESTSRC}/com.greetings/module-info.java \
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    41
    ${TESTSRC}/com.greetings/com/greetings/*.java   \
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    42
     -d ${TESTCLASSES}/com.greetings
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    43
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    44
# no --add-modules passed. This should result in error.
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    45
${JJS} -scripting --module-path ${TESTCLASSES} ${TESTSRC}/modulepath.js
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    46
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    47
if [ $? -ne 0 ]; then
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    48
   echo "Error thrown as expected when --add-modules is missing!"
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    49
else
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    50
   echo "Should have thrown error for missing --add-modules!"
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    51
   exit 1
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    52
fi
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    53
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    54
# proper usage of --module-path with --add-modules
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    55
${JJS} -scripting --module-path ${TESTCLASSES} --add-modules com.greetings ${TESTSRC}/modulepath.js
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    56
if [ $? -ne 0 ]; then
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    57
   exit 1
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    58
fi
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    59
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    60
# check that repeated --add-modules values are combined
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    61
${JJS} -scripting --module-path ${TESTCLASSES} --add-modules java.base --add-modules com.greetings ${TESTSRC}/addmodulesrepeat.js
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    62
if [ $? -ne 0 ]; then
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    63
   exit 1
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    64
fi
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    65
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    66
rm -rf ${TESTCLASSES}/com.greetings
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    67
echo "Passed"
092e014ed01e 8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff changeset
    68
exit 0