# @test
# @bug 6510337
# @run shell ClassPathWildCard.sh
# @summary A very basic/rudimentary test for classpath wildcards
# @author Kumar Srinivasan
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# 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.
#
# An elaborate wildcard testing is done by test/tools/javac/Paths/wcMineField.sh,
# this test is a small subset, primarily to ensure that java and javaw launcher
# behave consistently, while we are it , doesn't hurt to test other platforms
# as well.
# For debugging
# set -x
# _JAVA_LAUNCHER_DEBUG=true ; export _JAVA_LAUNCHER_DEBUG
# Verify directory context variables are set
if [ "${TESTJAVA}" = "" ]; then
echo "TESTJAVA not set. Test cannot execute. Failed."
exit 1
fi
if [ "${TESTSRC}" = "" ]; then
echo "TESTSRC not set. Test cannot execute. Failed."
exit 1
fi
if [ "${TESTCLASSES}" = "" ]; then
echo "TESTCLASSES not set. Test cannot execute. Failed."
exit 1
fi
OUTEXT=".out"
# We write out a test file, as javaw does not have any notion about
# stdout or stderr.
fullName=$1
(
printf " public static void main(String[] args) {"
printf " m = m.concat(\"java.class.path=\");\n"
printf " m = m.concat(System.getProperty(\"java.class.path\",\"NONE\"));\n"
printf " System.out.println(m);\n"
printf " try {\n"
printf " ps.println(m);\n"
printf " } catch (Exception e) {\n"
printf " System.out.println(e.getMessage());\n"
printf " System.exit(1);\n"
printf " }\n"
printf " }\n"
printf "}\n"
) > $fullName
}
Exp=$1
}
Exp=$1
}
if [ ! -f ${1}${OUTEXT} ]; then
printf "Error: %s fails\n" "$1"
exit 1
fi
}
# Note: see CR:6328875 this is why we use the NOOP variable
# below on Windows
variant=$1
NOOP=$2
# Test JAR files first
# Throw some class files into the mix
}
PATHSEP=";"
ExecJava "" "${PATHSEP}NOOPDIR"
ExecJava "w" "${PATHSEP}NOOPDIR"
break
;;
*)
PATHSEP=":"
ExecJava "" ""
break
;;
esac
exit 0