bin/fixorphantests.sh

changeset 0
b1a7da25b547
child 952
6d5471a497fb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/bin/fixorphantests.sh	Wed Apr 27 01:36:41 2016 +0800
     1.3 @@ -0,0 +1,52 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 +# 
     1.9 +# This code is free software; you can redistribute it and/or modify it
    1.10 +# under the terms of the GNU General Public License version 2 only, as
    1.11 +# published by the Free Software Foundation.
    1.12 +# 
    1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 +# version 2 for more details (a copy is included in the LICENSE file that
    1.17 +# accompanied this code).
    1.18 +# 
    1.19 +# You should have received a copy of the GNU General Public License version
    1.20 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 +# 
    1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 +# or visit www.oracle.com if you need additional information or have any
    1.25 +# questions.
    1.26 +#
    1.27 +
    1.28 +#ensure that all tests tagged with @test are also tagged with @run
    1.29 +
    1.30 +for f in $(find test/script/basic/*.js); do 
    1.31 +    grep @test $f >/dev/null
    1.32 +    TEST=$?
    1.33 +    grep @run $f >/dev/null
    1.34 +    RUN=$?    
    1.35 +
    1.36 +    if [ $TEST -eq 0 ] && [ ! $RUN -eq 0 ]; then		
    1.37 +	echo "repairing ${f}..."
    1.38 +	TEMP=$(mktemp /tmp/scratch.XXXXXX)
    1.39 +
    1.40 +	#IFS='', -raw flag to preserve white space
    1.41 +	while IFS='' read -r line; do 	    
    1.42 +	    echo $line | grep @test >/dev/null
    1.43 +	    TEST=$?
    1.44 +	    printf "%s\n" "$line" 
    1.45 +	    if [ $TEST -eq 0 ]; then
    1.46 +		printf "%s\n" "$line" | sed s/@test/@run/g 
    1.47 +	    fi	   
    1.48 +	done < $f >$TEMP
    1.49 +
    1.50 +	cp $TEMP $f
    1.51 +
    1.52 +	rm -fr $TEMP
    1.53 +    fi
    1.54 +
    1.55 +done

mercurial