Some cleanup and fixes to the runtests script. The -P option will be changing.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 7 Apr 2007 03:50:01 +0000 (03:50 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 7 Apr 2007 03:50:01 +0000 (03:50 +0000)
Its use from runtests is currently disabled.

git-svn-id: http://svn.complang.org/ragel/trunk@175 052ea7fc-9027-0410-9066-f65837a77df0

test/Makefile.in
test/cppscan1.rl
test/eofact.rl
test/mailbox1.rl
test/rlscan.rl
test/runtests
test/strings2.rl

index 4dafdc0..eeedf1f 100644 (file)
@@ -24,7 +24,7 @@ test:
 
 clean:
        rm -f *.c *.cpp *.m *.d *.java *.bin *.class *.exp \
-               *.out *_c.rl *_d.rl *_java.rl
+               *.out *_c.rl *_d.rl *_java.rl *_ruby.rl
 
 distclean: clean
        rm -f Makefile
index 623af28..9c92a1c 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * @LANG: c++
- * @ALLOW_GENFLAGS: -T0 -T1 -F0 -F1 -G0 -G1 -G2 -P
+ *
+ * Test works with split code gen.
  */
 
 #include "cppscan1.h"
index 890b73c..eeb91b8 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * @LANG: indep
- * @ALLOW_GENFLAGS: -T0 -T1 -F0 -F1 -G0 -G1 -G2 -P
+ *
+ * Test works with split code gen.
  */
 %%
 %%{
index 89e8775..a2bbea9 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * @LANG: c++
  * @CFLAGS: -I../aapl
- * @ALLOW_GENFLAGS: -T0 -T1 -F0 -F1 -G0 -G1 -G2 -P
+ *
+ * Test works with split code gen.
  */
 
 /*
index 943c4f5..24861b6 100644 (file)
@@ -2,7 +2,8 @@
  * Lexes Ragel input files.
  *
  * @LANG: c++
- * @ALLOW_GENFLAGS: -T0 -T1 -F0 -F1 -G0 -G1 -G2 -P
+ *
+ * Test works with split code gen.
  */
 
 #include <iostream>
index 1f21ad4..b647dcd 100755 (executable)
@@ -67,6 +67,67 @@ 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 $min_opt $lang_opt $test_case | $codegen $gen_opt -o $code_src"
+       if ! $ragel $min_opt $lang_opt $test_case | $codegen $gen_opt -o $code_src; then
+               test_error;
+       fi
+
+       out_args=""
+       [ $lang != java ] && out_args="-o ${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}"
+
+               $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};
 
@@ -188,96 +249,31 @@ for test_case; do
        allow_minflags=`sed '/@ALLOW_MINFLAGS:/s/^.*: *//p;d' $test_case`
        [ -z "$allow_minflags" ] && allow_minflags="-n -m -l -e"
 
-
-       # If we are in java or ruby then we are not interested in genflags
        case $lang in
        c|c++|objc|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"
-       ;;
-       *)
-               # Not interested in gen flags.
-               allow_genflags=noflags
-               genflags=noflags
-       ;;
-       esac
 
-       for min_opt in $minflags; do
-               for gen_opt in $genflags; do
+               for min_opt in $minflags; do
                        echo "$allow_minflags" | grep -e $min_opt >/dev/null || continue
 
-                       grep_gen_opt=${gen_opt}
-                       split_iters=${gen_opt#-P}
-                       if test $split_iters != $gen_opt; then
-                               grep_gen_opt="-P";
-                       fi
-                       echo "$allow_genflags" | grep -e $grep_gen_opt >/dev/null || continue
-
-                       if [ "$genflags" == noflags ]; then
-                               be_gen_opt=""
-                       else
-                               be_gen_opt=$gen_opt
-                       fi
-
-                       echo "$ragel $min_opt $lang_opt $test_case | $codegen $be_gen_opt -o $code_src"
-                       if ! $ragel $min_opt $lang_opt $test_case | $codegen $be_gen_opt -o $code_src; then
-                               test_error;
-                       fi
-
-                       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
-
-                       out_args=""
-                       [ $lang != java ] && out_args="-o ${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}"
-
-                               $exec_cmd 2>&1 > $output;
-                               if diff $expected_out $output > /dev/null; then
-                                       echo "passed";
-                               else
-                                       echo "FAILED";
-                                       test_error;
-                               fi;
-                       fi
+                       for gen_opt in $genflags; do
+                               echo "$allow_genflags" | grep -e $gen_opt >/dev/null || continue
+                               run_test
+                       done
                done
-       done
+       ;;
+
+       java|ruby) 
+               # 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
+       ;;
+       esac
+
 done
index ad4dd40..6307a2b 100644 (file)
@@ -1,7 +1,9 @@
 /*
  * @LANG: c
- * @ALLOW_GENFLAGS: -T0 -T1 -F0 -F1 -P
+ * @ALLOW_GENFLAGS: -T0 -T1 -F0 -F1
  * @ALLOW_MINFLAGS: -n -m -l
+ *
+ * Test works with split code gen.
  */
 
 #include <string.h>