[ragel-users] [PATCH 1/6] Don't use AC_DEFINE to pass the commands for the compilers to the runtest script.

Adrian Thurston thurs... at cs.queensu.ca
Mon Oct 6 17:33:07 UTC 2008


Any reason? The effect of both approaches seems to be the same.

-Adrian

Diego 'Flameeyes' Pettenò wrote:
> Instead of parsing the config.h header from runtest, make it use
> proper autoconf by generating it at the end of the configure run.
> ---
> 
>  configure.in     |   28 +----
>  test/runtests    |  320 ------------------------------------------------------
>  test/runtests.in |  320 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 327 insertions(+), 341 deletions(-)
>  delete mode 100755 test/runtests
>  create mode 100755 test/runtests.in
> 
> diff --git a/configure.in b/configure.in
> index a257a70..cc25f2e 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -31,10 +31,6 @@ AC_PROG_CC
>  AC_PROG_CXX
>  AC_CHECK_TOOL(AR, ar)
>  AC_PROG_RANLIB
> -AC_DEFINE_UNQUOTED(CC,$CC)
> -AC_DEFINE_UNQUOTED(CXX,$CXX)
> -AC_DEFINE_UNQUOTED(AR,$AR)
> -AC_DEFINE_UNQUOTED(RANLIB,$RANLIB)
>  
>  dnl Set test on c++ compiler.
>  AC_LANG_CPLUSPLUS
> @@ -75,9 +71,7 @@ fi # BUILD_PARSERS
>  
>  dnl Check for the D compiler
>  AC_CHECK_PROG(GDC, gdc, gdc)
> -if test -n "$GDC"; then
> -	AC_DEFINE_UNQUOTED(GDC,$GDC)
> -fi
> +AC_SUBST(GDC)
>  
>  dnl Check for the Objective-C compiler
>  AC_MSG_CHECKING([for the Objective-C compiler])
> @@ -88,7 +82,7 @@ GOBJC=""
>  if gcc -x objective-c conftest.m -o conftest.bin 2>/dev/null; then
>  	GOBJC="gcc -x objective-c"
>  	AC_MSG_RESULT([yes])
> -	AC_DEFINE_UNQUOTED(GOBJC,$GOBJC)
> +	AC_SUBST(GOBJC)
>  else
>  	AC_MSG_RESULT([no])
>  fi
> @@ -96,29 +90,21 @@ AC_SUBST(GOBJC)
>  
>  dnl Check for the Java compiler.
>  AC_CHECK_PROG(JAVAC, javac, javac)
> -if test -n "$JAVAC"; then
> -	AC_DEFINE_UNQUOTED(JAVAC,$JAVAC)
> -fi
> +AC_SUBST(JAVAC)
>  
>  dnl Check for TXL.
>  AC_CHECK_PROG(TXL, txl, txl)
> -if test -n "$TXL"; then
> -	AC_DEFINE_UNQUOTED(TXL,$TXL)
> -fi
> +AC_SUBST(TXL)
>  
>  dnl Check for Ruby.
>  AC_CHECK_PROG(RUBY, ruby, ruby)
> -if test -n "$RUBY"; then
> -	AC_DEFINE_UNQUOTED(RUBY,$RUBY)
> -fi
> +AC_SUBST(RUBY)
>  
>  dnl Check for the C# compiler.
>  AC_CHECK_PROG(GMCS, gmcs, gmcs)
> -if test -n "$GMCS"; then
> -	AC_DEFINE_UNQUOTED(GMCS,$GMCS)
> -fi
> +AC_SUBST(GMCS)
>  
>  dnl write output files
> -AC_OUTPUT(Makefile common/Makefile ragel/Makefile redfsm/Makefile rlgen-cd/Makefile rlgen-java/Makefile rlgen-ruby/Makefile rlgen-dot/Makefile rlgen-csharp/Makefile doc/Makefile test/Makefile)
> +AC_OUTPUT(Makefile common/Makefile ragel/Makefile redfsm/Makefile rlgen-cd/Makefile rlgen-java/Makefile rlgen-ruby/Makefile rlgen-dot/Makefile rlgen-csharp/Makefile doc/Makefile test/Makefile test/runtests)
>  
>  echo "configuration of ragel complete"
> diff --git a/test/runtests b/test/runtests
> deleted file mode 100755
> index a50c7c9..0000000
> --- a/test/runtests
> +++ /dev/null
> @@ -1,320 +0,0 @@
> -#!/bin/bash
> -
> -#
> -#   Copyright 2006 Adrian Thurston <thurs... at cs.queensu.ca>
> -#
> -
> -#   This file is part of Ragel.
> -#
> -#   Ragel is free software; you can redistribute it and/or modify
> -#   it under the terms of the GNU General Public License as published by
> -#   the Free Software Foundation; either version 2 of the License, or
> -#   (at your option) any later version.
> -#
> -#   Ragel 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 for more details.
> -#
> -#   You should have received a copy of the GNU General Public License
> -#   along with Ragel; if not, write to the Free Software
> -#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
> -
> -while getopts "gcnmleT:F:G:P:CDJRA" opt; do
> -	case $opt in
> -		T|F|G|P) 
> -			genflags="$genflags -$opt$OPTARG"
> -			options="$options -$opt$OPTARG"
> -			;;
> -		n|m|l|e) 
> -			minflags="$minflags -$opt"
> -			options="$options -$opt"
> -			;;
> -		c) 
> -			compile_only="true"
> -			options="$options -$opt"
> -			;;
> -		g) 
> -			allow_generated="true"
> -			;;
> -		C|D|J|R|A) 
> -			langflags="$langflags -$opt"
> -			;;
> -	esac
> -done
> -
> -[ -z "$minflags" ] && minflags="-n -m -l -e"
> -[ -z "$genflags" ] && genflags="-T0 -T1 -F0 -F1 -G0 -G1 -G2"
> -[ -z "$langflags" ] && langflags="-C -D -J -R -A"
> -
> -shift $((OPTIND - 1));
> -
> -[ -z "$*" ] && set -- *.rl
> -
> -config=../common/config.h
> -ragel=../ragel/ragel
> -
> -cxx_compiler=`sed '/^#define CXX/s/#define CXX *//p;d' $config`
> -c_compiler=`sed '/^#define CC/s/#define CC *//p;d' $config`
> -objc_compiler=`sed '/^#define GOBJC/s/#define GOBJC *//p;d' $config`
> -d_compiler=`sed '/^#define GDC/s/#define GDC *//p;d' $config`
> -java_compiler=`sed '/#define JAVAC/s/#define JAVAC *//p;d' $config`
> -txl_engine=`sed '/^#define TXL/s/#define TXL *//p;d' $config`
> -ruby_engine=`sed '/^#define RUBY/s/#define RUBY *//p;d' $config`
> -csharp_compiler=`sed '/#define GMCS/s/#define GMCS *//p;d' $config`
> -
> -function test_error
> -{
> -	exit 1;
> -}
> -
> -#	split_objs=""
> -#	if test $split_iters != "$gen_opt"; then
> -#		n=0;
> -#		while test $n -lt $split_iters; do
> -#			part_root=${root}_`awk 'BEGIN {
> -#				width = 0;
> -#				high = '$split_iters' - 1;
> -#				while ( high > 0 ) {
> -#					width = width + 1;
> -#					high = int(high / 10);
> -#				}
> -#				suffFormat = "%" width "." width "d\n";
> -#				printf( suffFormat, '$n' );
> -#				exit 0;
> -#			}'`
> -#			part_src=${part_root}.c
> -#			part_bin=${part_root}.o
> -#			echo "$compiler -c $cflags -o $part_bin $part_src"
> -#			if ! $compiler -c $cflags -o $part_bin $part_src; then
> -#				test_error;
> -#			fi
> -#			split_objs="$split_objs $part_bin"
> -#			n=$((n+1))
> -#		done
> -#	fi
> -
> -function run_test()
> -{
> -	echo "$ragel $lang_opt $min_opt $gen_opt -o $code_src $test_case"
> -	if ! $ragel $lang_opt $min_opt $gen_opt -o $code_src $test_case; then
> -		test_error;
> -	fi
> -
> -	out_args=""
> -	[ $lang != java ] && out_args="-o ${binary}";
> -    [ $lang == csharp ] && out_args="-out:${binary}";
> -
> -	# Ruby doesn't need to be compiled.
> -	if [ $lang != ruby ]; then
> -		echo "$compiler ${cflags} ${out_args} ${code_src}"
> -		if ! $compiler ${cflags} ${out_args} ${code_src}; then
> -			test_error;
> -		fi
> -	fi
> -
> -	if [ "$compile_only" != "true" ]; then
> -		echo -n "running $root ... ";
> -		
> -		exec_cmd=./$binary
> -		[ $lang = java ] && exec_cmd="java ${root}"
> -		[ $lang = ruby ] && exec_cmd="ruby ${code_src}"
> -		[ $lang = csharp ] && exec_cmd="mono ${exec_cmd}"
> -
> -		$exec_cmd 2>&1 > $output;
> -		if diff $expected_out $output > /dev/null; then
> -			echo "passed";
> -		else
> -			echo "FAILED";
> -			test_error;
> -		fi;
> -	fi
> -}
> -
> -for test_case; do
> -	root=${test_case%.rl};
> -
> -	if ! [ -f "$test_case" ]; then
> -		echo "runtests: not a file: $test_case"; >&2
> -		exit 1;
> -	fi
> -
> -	# Check if we should ignore the test case
> -	ignore=`sed '/@IGNORE:/s/^.*: *//p;d' $test_case`
> -    if [ "$ignore" = yes ]; then
> -        continue;
> -    fi
> -
> -	# If the generated flag is given make sure that the test case is generated.
> -	is_generated=`sed '/@GENERATED:/s/^.*: *//p;d' $test_case`
> -	if [ "$is_generated" = yes ] && [ "$allow_generated" != true ]; then
> -		continue;
> -	fi
> -
> -	expected_out=$root.exp;
> -	sed '1,/_____OUTPUT_____/d;$d' $test_case > $expected_out
> -
> -	lang=`sed '/@LANG:/s/^.*: *//p;d' $test_case`
> -	if [ -z "$lang" ]; then
> -		echo "$test_case: language unset"; >&2
> -		exit 1;
> -	fi
> -
> -	case $lang in
> -		c++)
> -			lang_opt=-C;
> -			codegen=../rlgen-cd/rlgen-cd;
> -			code_suffix=cpp;
> -			compiler=$cxx_compiler;
> -			cflags="-pedantic -ansi -Wall -O3"
> -		;;
> -		d)
> -			lang_opt=-D;
> -			codegen=../rlgen-cd/rlgen-cd;
> -			code_suffix=d;
> -			compiler=$d_compiler;
> -			cflags="-Wall -O3"
> -		;;
> -		c)
> -			lang_opt=-C;
> -			codegen=../rlgen-cd/rlgen-cd;
> -			code_suffix=c;
> -			compiler=$c_compiler;
> -			cflags="-pedantic -ansi -Wall -O3"
> -		;;
> -		obj-c)
> -			lang_opt=-C;
> -			codegen=../rlgen-cd/rlgen-cd;
> -			code_suffix=m;
> -			compiler=$objc_compiler
> -			cflags="-Wall -O3 -fno-strict-aliasing -lobjc"
> -		;;
> -		java)
> -			lang_opt=-J;
> -			codegen=../rlgen-java/rlgen-java;
> -			code_suffix=java;
> -			compiler=$java_compiler
> -			cflags=""
> -		;;
> -		ruby)
> -			lang_opt=-R;
> -			codegen=../rlgen-ruby/rlgen-ruby;
> -			code_suffix=rb;
> -			compiler=$ruby_engine
> -			cflags=""
> -		;;
> -        csharp)
> -            lang_opt="-A";
> -            codegen=../rlgen-csharp/rlgen-csharp;
> -            code_suffix=cs;
> -            compiler=$csharp_compiler
> -            cflags=""
> -        ;;
> -		indep)
> -			lang_opt="";
> -
> -			# If we have no txl engine then skip this test.
> -			[ -z "$txl_engine" ] && continue
> -			for lang in c d java ruby csharp; do
> -				case $lang in 
> -					c) lf="-C";;
> -					d) lf="-D";;
> -					java) lf="-J";;
> -					ruby) lf="-R";;
> -                    csharp) lf="-A";;
> -				esac
> -
> -				echo "$langflags" | grep -e $lf >/dev/null || continue
> -
> -				targ=${root}_$lang.rl
> -				echo "./langtrans_$lang.sh $test_case > $targ"
> -				if ! ./langtrans_$lang.sh $test_case > $targ; then
> -					test_error
> -				fi
> -				echo "./runtests -g $options $targ"
> -				if !  ./runtests -g $options $targ; then
> -					test_error
> -				fi
> -			done
> -			continue;
> -		;;
> -		*)
> -			echo "$test_case: unknown language type $lang" >&2
> -			exit 1;
> -		;;
> -	esac
> -
> -	# Make sure that we are interested in the host language.
> -	echo "$langflags" | grep -e $lang_opt >/dev/null || continue
> -
> -	code_src=$root.$code_suffix;
> -	binary=$root.bin;
> -	output=$root.out;
> -
> -	# If we have no compiler for the source program then skip it.
> -	[ -z "$compiler" ] && continue
> -
> -	additional_cflags=`sed '/@CFLAGS:/s/^.*: *//p;d' $test_case`
> -	[ -n "$additional_cflags" ] && cflags="$cflags $additional_cflags"
> -
> -	allow_minflags=`sed '/@ALLOW_MINFLAGS:/s/^.*: *//p;d' $test_case`
> -	[ -z "$allow_minflags" ] && allow_minflags="-n -m -l -e"
> -
> -	case $lang in
> -	c|c++|d)
> -		# Using genflags, get the allowed gen flags from the test case. If the
> -		# test case doesn't specify assume that all gen flags are allowed.
> -		allow_genflags=`sed '/@ALLOW_GENFLAGS:/s/^.*: *//p;d' $test_case`
> -		[ -z "$allow_genflags" ] && allow_genflags="-T0 -T1 -F0 -F1 -G0 -G1 -G2"
> -
> -		for min_opt in $minflags; do
> -			echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
> -			for gen_opt in $genflags; do
> -				echo "$allow_genflags" | grep -e $gen_opt >/dev/null || continue
> -				run_test
> -			done
> -		done
> -	;;
> -
> -	java) 
> -		# Not interested in gen opt.
> -		gen_opt=""
> -		for min_opt in $minflags; do
> -			echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
> -			run_test
> -		done
> -	;;
> -
> -	ruby) 
> -		# Using genflags, get the allowed gen flags from the test case. If the
> -		# test case doesn't specify assume that all gen flags are allowed.
> -		allow_genflags=`sed '/@ALLOW_GENFLAGS:/s/^.*: *//p;d' $test_case`
> -		[ -z "$allow_genflags" ] && allow_genflags="-T0 -T1 -F0 -F1"
> -
> -		for min_opt in $minflags; do
> -			echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
> -
> -			for gen_opt in $genflags; do
> -				echo "$allow_genflags" | grep -e $gen_opt >/dev/null || continue
> -				run_test
> -			done
> -		done
> -	;;
> -
> -	csharp)
> -		# Using genflags, get the allowed gen flags from the test case. If the
> -		# test case doesn't specify assume that all gen flags are allowed.
> -		allow_genflags=`sed '/@ALLOW_GENFLAGS:/s/^.*: *//p;d' $test_case`
> -		[ -z "$allow_genflags" ] && allow_genflags="-T0 -T1 -F0 -F1 -G0 -G1"
> -
> -		for min_opt in $minflags; do
> -			echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
> -			for gen_opt in $genflags; do
> -				echo "$allow_genflags" | grep -e $gen_opt >/dev/null || continue
> -				run_test
> -			done
> -		done
> -	;;
> -	esac
> -
> -done
> diff --git a/test/runtests.in b/test/runtests.in
> new file mode 100755
> index 0000000..ee14f6a
> --- /dev/null
> +++ b/test/runtests.in
> @@ -0,0 +1,320 @@
> +#!/bin/bash
> +
> +#
> +#   Copyright 2006 Adrian Thurston <thurs... at cs.queensu.ca>
> +#
> +
> +#   This file is part of Ragel.
> +#
> +#   Ragel is free software; you can redistribute it and/or modify
> +#   it under the terms of the GNU General Public License as published by
> +#   the Free Software Foundation; either version 2 of the License, or
> +#   (at your option) any later version.
> +#
> +#   Ragel 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 for more details.
> +#
> +#   You should have received a copy of the GNU General Public License
> +#   along with Ragel; if not, write to the Free Software
> +#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
> +
> +while getopts "gcnmleT:F:G:P:CDJRA" opt; do
> +	case $opt in
> +		T|F|G|P) 
> +			genflags="$genflags -$opt$OPTARG"
> +			options="$options -$opt$OPTARG"
> +			;;
> +		n|m|l|e) 
> +			minflags="$minflags -$opt"
> +			options="$options -$opt"
> +			;;
> +		c) 
> +			compile_only="true"
> +			options="$options -$opt"
> +			;;
> +		g) 
> +			allow_generated="true"
> +			;;
> +		C|D|J|R|A) 
> +			langflags="$langflags -$opt"
> +			;;
> +	esac
> +done
> +
> +[ -z "$minflags" ] && minflags="-n -m -l -e"
> +[ -z "$genflags" ] && genflags="-T0 -T1 -F0 -F1 -G0 -G1 -G2"
> +[ -z "$langflags" ] && langflags="-C -D -J -R -A"
> +
> +shift $((OPTIND - 1));
> +
> +[ -z "$*" ] && set -- *.rl
> +
> +config=../common/config.h
> +ragel=../ragel/ragel
> +
> +cxx_compiler=@CXX@
> +c_compiler=@CC@
> +objc_compiler=@GOBJC@
> +d_compiler=@GDC@
> +java_compiler=@JAVAC@
> +txl_engine=@TXL@
> +ruby_engine=@RUBY@
> +csharp_compiler=@GMCS@
> +
> +function test_error
> +{
> +	exit 1;
> +}
> +
> +#	split_objs=""
> +#	if test $split_iters != "$gen_opt"; then
> +#		n=0;
> +#		while test $n -lt $split_iters; do
> +#			part_root=${root}_`awk 'BEGIN {
> +#				width = 0;
> +#				high = '$split_iters' - 1;
> +#				while ( high > 0 ) {
> +#					width = width + 1;
> +#					high = int(high / 10);
> +#				}
> +#				suffFormat = "%" width "." width "d\n";
> +#				printf( suffFormat, '$n' );
> +#				exit 0;
> +#			}'`
> +#			part_src=${part_root}.c
> +#			part_bin=${part_root}.o
> +#			echo "$compiler -c $cflags -o $part_bin $part_src"
> +#			if ! $compiler -c $cflags -o $part_bin $part_src; then
> +#				test_error;
> +#			fi
> +#			split_objs="$split_objs $part_bin"
> +#			n=$((n+1))
> +#		done
> +#	fi
> +
> +function run_test()
> +{
> +	echo "$ragel $lang_opt $min_opt $gen_opt -o $code_src $test_case"
> +	if ! $ragel $lang_opt $min_opt $gen_opt -o $code_src $test_case; then
> +		test_error;
> +	fi
> +
> +	out_args=""
> +	[ $lang != java ] && out_args="-o ${binary}";
> +    [ $lang == csharp ] && out_args="-out:${binary}";
> +
> +	# Ruby doesn't need to be compiled.
> +	if [ $lang != ruby ]; then
> +		echo "$compiler ${cflags} ${out_args} ${code_src}"
> +		if ! $compiler ${cflags} ${out_args} ${code_src}; then
> +			test_error;
> +		fi
> +	fi
> +
> +	if [ "$compile_only" != "true" ]; then
> +		echo -n "running $root ... ";
> +		
> +		exec_cmd=./$binary
> +		[ $lang = java ] && exec_cmd="java ${root}"
> +		[ $lang = ruby ] && exec_cmd="ruby ${code_src}"
> +		[ $lang = csharp ] && exec_cmd="mono ${exec_cmd}"
> +
> +		$exec_cmd 2>&1 > $output;
> +		if diff $expected_out $output > /dev/null; then
> +			echo "passed";
> +		else
> +			echo "FAILED";
> +			test_error;
> +		fi;
> +	fi
> +}
> +
> +for test_case; do
> +	root=${test_case%.rl};
> +
> +	if ! [ -f "$test_case" ]; then
> +		echo "runtests: not a file: $test_case"; >&2
> +		exit 1;
> +	fi
> +
> +	# Check if we should ignore the test case
> +	ignore=`sed '/@IGNORE:/s/^.*: *//p;d' $test_case`
> +    if [ "$ignore" = yes ]; then
> +        continue;
> +    fi
> +
> +	# If the generated flag is given make sure that the test case is generated.
> +	is_generated=`sed '/@GENERATED:/s/^.*: *//p;d' $test_case`
> +	if [ "$is_generated" = yes ] && [ "$allow_generated" != true ]; then
> +		continue;
> +	fi
> +
> +	expected_out=$root.exp;
> +	sed '1,/_____OUTPUT_____/d;$d' $test_case > $expected_out
> +
> +	lang=`sed '/@LANG:/s/^.*: *//p;d' $test_case`
> +	if [ -z "$lang" ]; then
> +		echo "$test_case: language unset"; >&2
> +		exit 1;
> +	fi
> +
> +	case $lang in
> +		c++)
> +			lang_opt=-C;
> +			codegen=../rlgen-cd/rlgen-cd;
> +			code_suffix=cpp;
> +			compiler=$cxx_compiler;
> +			cflags="-pedantic -ansi -Wall -O3"
> +		;;
> +		d)
> +			lang_opt=-D;
> +			codegen=../rlgen-cd/rlgen-cd;
> +			code_suffix=d;
> +			compiler=$d_compiler;
> +			cflags="-Wall -O3"
> +		;;
> +		c)
> +			lang_opt=-C;
> +			codegen=../rlgen-cd/rlgen-cd;
> +			code_suffix=c;
> +			compiler=$c_compiler;
> +			cflags="-pedantic -ansi -Wall -O3"
> +		;;
> +		obj-c)
> +			lang_opt=-C;
> +			codegen=../rlgen-cd/rlgen-cd;
> +			code_suffix=m;
> +			compiler=$objc_compiler
> +			cflags="-Wall -O3 -fno-strict-aliasing -lobjc"
> +		;;
> +		java)
> +			lang_opt=-J;
> +			codegen=../rlgen-java/rlgen-java;
> +			code_suffix=java;
> +			compiler=$java_compiler
> +			cflags=""
> +		;;
> +		ruby)
> +			lang_opt=-R;
> +			codegen=../rlgen-ruby/rlgen-ruby;
> +			code_suffix=rb;
> +			compiler=$ruby_engine
> +			cflags=""
> +		;;
> +        csharp)
> +            lang_opt="-A";
> +            codegen=../rlgen-csharp/rlgen-csharp;
> +            code_suffix=cs;
> +            compiler=$csharp_compiler
> +            cflags=""
> +        ;;
> +		indep)
> +			lang_opt="";
> +
> +			# If we have no txl engine then skip this test.
> +			[ -z "$txl_engine" ] && continue
> +			for lang in c d java ruby csharp; do
> +				case $lang in 
> +					c) lf="-C";;
> +					d) lf="-D";;
> +					java) lf="-J";;
> +					ruby) lf="-R";;
> +                    csharp) lf="-A";;
> +				esac
> +
> +				echo "$langflags" | grep -e $lf >/dev/null || continue
> +
> +				targ=${root}_$lang.rl
> +				echo "./langtrans_$lang.sh $test_case > $targ"
> +				if ! ./langtrans_$lang.sh $test_case > $targ; then
> +					test_error
> +				fi
> +				echo "./runtests -g $options $targ"
> +				if !  ./runtests -g $options $targ; then
> +					test_error
> +				fi
> +			done
> +			continue;
> +		;;
> +		*)
> +			echo "$test_case: unknown language type $lang" >&2
> +			exit 1;
> +		;;
> +	esac
> +
> +	# Make sure that we are interested in the host language.
> +	echo "$langflags" | grep -e $lang_opt >/dev/null || continue
> +
> +	code_src=$root.$code_suffix;
> +	binary=$root.bin;
> +	output=$root.out;
> +
> +	# If we have no compiler for the source program then skip it.
> +	[ -z "$compiler" ] && continue
> +
> +	additional_cflags=`sed '/@CFLAGS:/s/^.*: *//p;d' $test_case`
> +	[ -n "$additional_cflags" ] && cflags="$cflags $additional_cflags"
> +
> +	allow_minflags=`sed '/@ALLOW_MINFLAGS:/s/^.*: *//p;d' $test_case`
> +	[ -z "$allow_minflags" ] && allow_minflags="-n -m -l -e"
> +
> +	case $lang in
> +	c|c++|d)
> +		# Using genflags, get the allowed gen flags from the test case. If the
> +		# test case doesn't specify assume that all gen flags are allowed.
> +		allow_genflags=`sed '/@ALLOW_GENFLAGS:/s/^.*: *//p;d' $test_case`
> +		[ -z "$allow_genflags" ] && allow_genflags="-T0 -T1 -F0 -F1 -G0 -G1 -G2"
> +
> +		for min_opt in $minflags; do
> +			echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
> +			for gen_opt in $genflags; do
> +				echo "$allow_genflags" | grep -e $gen_opt >/dev/null || continue
> +				run_test
> +			done
> +		done
> +	;;
> +
> +	java) 
> +		# Not interested in gen opt.
> +		gen_opt=""
> +		for min_opt in $minflags; do
> +			echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
> +			run_test
> +		done
> +	;;
> +
> +	ruby) 
> +		# Using genflags, get the allowed gen flags from the test case. If the
> +		# test case doesn't specify assume that all gen flags are allowed.
> +		allow_genflags=`sed '/@ALLOW_GENFLAGS:/s/^.*: *//p;d' $test_case`
> +		[ -z "$allow_genflags" ] && allow_genflags="-T0 -T1 -F0 -F1"
> +
> +		for min_opt in $minflags; do
> +			echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
> +
> +			for gen_opt in $genflags; do
> +				echo "$allow_genflags" | grep -e $gen_opt >/dev/null || continue
> +				run_test
> +			done
> +		done
> +	;;
> +
> +	csharp)
> +		# Using genflags, get the allowed gen flags from the test case. If the
> +		# test case doesn't specify assume that all gen flags are allowed.
> +		allow_genflags=`sed '/@ALLOW_GENFLAGS:/s/^.*: *//p;d' $test_case`
> +		[ -z "$allow_genflags" ] && allow_genflags="-T0 -T1 -F0 -F1 -G0 -G1"
> +
> +		for min_opt in $minflags; do
> +			echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
> +			for gen_opt in $genflags; do
> +				echo "$allow_genflags" | grep -e $gen_opt >/dev/null || continue
> +				run_test
> +			done
> +		done
> +	;;
> +	esac
> +
> +done
> 
> 
> 



More information about the ragel-users mailing list