1.1 --- a/test/tools/javac/quid/MakeNegTests.sh Thu Sep 23 17:33:52 2010 -0700 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,97 +0,0 @@ 1.4 -#!/bin/sh 1.5 - 1.6 -# 1.7 -# Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. 1.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.9 -# 1.10 -# This code is free software; you can redistribute it and/or modify it 1.11 -# under the terms of the GNU General Public License version 2 only, as 1.12 -# published by the Free Software Foundation. 1.13 -# 1.14 -# This code is distributed in the hope that it will be useful, but WITHOUT 1.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 -# version 2 for more details (a copy is included in the LICENSE file that 1.18 -# accompanied this code). 1.19 -# 1.20 -# You should have received a copy of the GNU General Public License version 1.21 -# 2 along with this work; if not, write to the Free Software Foundation, 1.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 -# 1.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 -# or visit www.oracle.com if you need additional information or have any 1.26 -# questions. 1.27 -# 1.28 - 1.29 -# @test 1.30 -# @bug 6746458 1.31 -# @summary Verify correct rejection of illegal quoted identifiers. 1.32 -# @run shell MakeNegTests.sh 1.33 - 1.34 -default_template=QuotedIdent.java 1.35 -# the rest of this file is a generic "//BAD"-line tester 1.36 - 1.37 -: ${TESTSRC=.} ${TESTCLASSES=.} 1.38 -javac="${TESTJAVA+${TESTJAVA}/bin/}javac" 1.39 - 1.40 -verbose=false quiet=false 1.41 - 1.42 -main() { 1.43 - case "${@-}" in 1.44 - *.java*) 1.45 - for template in "$@"; do 1.46 - expand_and_test "$template" 1.47 - done;; 1.48 - *) expand_and_test "${TESTSRC}/$default_template";; 1.49 - esac 1.50 -} 1.51 - 1.52 -expand_and_test() { 1.53 - template=$1 1.54 - expand "$@" 1.55 - testneg "$@" 1.56 -} 1.57 - 1.58 -expand() { 1.59 - template=$1 1.60 - badlines=` grep -n < "$template" '//BAD' ` 1.61 - badcount=` echo "$badlines" | wc -l ` 1.62 - [ $badcount -gt 0 ] || { echo "No negative test cases in $template"; exit 1; } 1.63 - $quiet || echo "Expanding $badcount negative test cases from $template:" 1.64 - $quiet || echo "$badlines" 1.65 - badnums=` echo "$badlines" | sed 's/:.*//' ` 1.66 - casestem=` getcasestem "$template" ` 1.67 - tclassname=` basename "$template" .java ` 1.68 - rm "$casestem"*.java 1.69 - for badnum in $badnums; do 1.70 - casefile="$casestem"${badnum}.java 1.71 - cclassname=` basename "$casefile" .java ` 1.72 - sed < "$template" > "$casefile" " 1.73 - s|@compile|@compile/fail| 1.74 - / @[a-z]/s|@|##| 1.75 - ${badnum}s:^ *[/*]*: : 1.76 - s/${tclassname}/${cclassname}/g 1.77 - " 1.78 - $verbose && diff -u "$template" "$casefile" 1.79 - done 1.80 -} 1.81 - 1.82 -getcasestem() { 1.83 - echo `basename $1` | sed 's/.*\///;s/\.java$//;s/_BAD[0-9]*$//;s/$/_BAD/' 1.84 -} 1.85 - 1.86 -testneg() { 1.87 - template=$1 1.88 - for casefile in ` getcasestem "$template" `*.java; do 1.89 - $quiet || echo -------- $javac "$casefile" 1.90 - $javac "$casefile" > "$casefile".errlog 2>&1 && { 1.91 - echo "*** Compilation unexpectedly succeeded: $casefile" 1.92 - exit 1 1.93 - } 1.94 - $quiet || echo "Compilation failed as expected" 1.95 - $quiet || head ` $verbose || echo -3 ` < "$casefile".errlog 1.96 - rm "$casefile".errlog 1.97 - done 1.98 -} 1.99 - 1.100 -main "$@"