Tue, 25 May 2010 15:54:51 -0700
6943119: Rebrand source copyright notices
Reviewed-by: darcy
jrose@267 | 1 | #!/bin/sh |
jrose@267 | 2 | |
jrose@267 | 3 | # |
ohair@554 | 4 | # Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. |
jrose@267 | 5 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jrose@267 | 6 | # |
jrose@267 | 7 | # This code is free software; you can redistribute it and/or modify it |
jrose@267 | 8 | # under the terms of the GNU General Public License version 2 only, as |
jrose@267 | 9 | # published by the Free Software Foundation. |
jrose@267 | 10 | # |
jrose@267 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
jrose@267 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jrose@267 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jrose@267 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
jrose@267 | 15 | # accompanied this code). |
jrose@267 | 16 | # |
jrose@267 | 17 | # You should have received a copy of the GNU General Public License version |
jrose@267 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
jrose@267 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jrose@267 | 20 | # |
ohair@554 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@554 | 23 | # questions. |
jrose@267 | 24 | # |
jrose@267 | 25 | |
jrose@267 | 26 | # @test |
jrose@267 | 27 | # @bug 6746458 |
jrose@267 | 28 | # @summary Verify correct rejection of illegal quoted identifiers. |
jrose@267 | 29 | # @run shell MakeNegTests.sh |
jrose@267 | 30 | |
jrose@267 | 31 | default_template=QuotedIdent.java |
jrose@267 | 32 | # the rest of this file is a generic "//BAD"-line tester |
jrose@267 | 33 | |
jrose@267 | 34 | : ${TESTSRC=.} ${TESTCLASSES=.} |
jrose@267 | 35 | javac="${TESTJAVA+${TESTJAVA}/bin/}javac" |
jrose@267 | 36 | |
jrose@267 | 37 | verbose=false quiet=false |
jrose@267 | 38 | |
jrose@267 | 39 | main() { |
jrose@267 | 40 | case "${@-}" in |
jrose@267 | 41 | *.java*) |
jrose@267 | 42 | for template in "$@"; do |
jrose@267 | 43 | expand_and_test "$template" |
jrose@267 | 44 | done;; |
jrose@267 | 45 | *) expand_and_test "${TESTSRC}/$default_template";; |
jrose@267 | 46 | esac |
jrose@267 | 47 | } |
jrose@267 | 48 | |
jrose@267 | 49 | expand_and_test() { |
jrose@267 | 50 | template=$1 |
jrose@267 | 51 | expand "$@" |
jrose@267 | 52 | testneg "$@" |
jrose@267 | 53 | } |
jrose@267 | 54 | |
jrose@267 | 55 | expand() { |
jrose@267 | 56 | template=$1 |
jrose@267 | 57 | badlines=` grep -n < "$template" '//BAD' ` |
jrose@267 | 58 | badcount=` echo "$badlines" | wc -l ` |
jrose@267 | 59 | [ $badcount -gt 0 ] || { echo "No negative test cases in $template"; exit 1; } |
jrose@267 | 60 | $quiet || echo "Expanding $badcount negative test cases from $template:" |
jrose@267 | 61 | $quiet || echo "$badlines" |
jrose@267 | 62 | badnums=` echo "$badlines" | sed 's/:.*//' ` |
jrose@267 | 63 | casestem=` getcasestem "$template" ` |
jrose@267 | 64 | tclassname=` basename "$template" .java ` |
jrose@267 | 65 | rm "$casestem"*.java |
jrose@267 | 66 | for badnum in $badnums; do |
jrose@267 | 67 | casefile="$casestem"${badnum}.java |
jrose@267 | 68 | cclassname=` basename "$casefile" .java ` |
jrose@267 | 69 | sed < "$template" > "$casefile" " |
jrose@267 | 70 | s|@compile|@compile/fail| |
jrose@267 | 71 | / @[a-z]/s|@|##| |
jrose@267 | 72 | ${badnum}s:^ *[/*]*: : |
jrose@267 | 73 | s/${tclassname}/${cclassname}/g |
jrose@267 | 74 | " |
jrose@267 | 75 | $verbose && diff -u "$template" "$casefile" |
jrose@267 | 76 | done |
jrose@267 | 77 | } |
jrose@267 | 78 | |
jrose@267 | 79 | getcasestem() { |
jjg@385 | 80 | echo `basename $1` | sed 's/.*\///;s/\.java$//;s/_BAD[0-9]*$//;s/$/_BAD/' |
jrose@267 | 81 | } |
jrose@267 | 82 | |
jrose@267 | 83 | testneg() { |
jrose@267 | 84 | template=$1 |
jrose@267 | 85 | for casefile in ` getcasestem "$template" `*.java; do |
jrose@267 | 86 | $quiet || echo -------- $javac "$casefile" |
jrose@267 | 87 | $javac "$casefile" > "$casefile".errlog 2>&1 && { |
jrose@267 | 88 | echo "*** Compilation unexpectedly succeeded: $casefile" |
jrose@267 | 89 | exit 1 |
jrose@267 | 90 | } |
jrose@267 | 91 | $quiet || echo "Compilation failed as expected" |
jrose@267 | 92 | $quiet || head ` $verbose || echo -3 ` < "$casefile".errlog |
jrose@267 | 93 | rm "$casefile".errlog |
jrose@267 | 94 | done |
jrose@267 | 95 | } |
jrose@267 | 96 | |
jrose@267 | 97 | main "$@" |