From: Ulya Trofimovich Date: Wed, 14 Oct 2015 13:19:55 +0000 (+0100) Subject: run_tests.sh: paste type headers into source file and diff all at once. X-Git-Tag: 0.15~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d88f7b69a89eb93641c33d48a4163751dd7b654;p=re2c run_tests.sh: paste type headers into source file and diff all at once. --- diff --git a/re2c/run_tests.sh.in b/re2c/run_tests.sh.in index bc26d6ac..b23b1c93 100644 --- a/re2c/run_tests.sh.in +++ b/re2c/run_tests.sh.in @@ -112,12 +112,10 @@ run_pack() { fi local outname=${outx%.re}.c.temp local outdiff=${outx%.re}.c.diff - local typname=${outx%.re}.h.temp - local typdiff=${outx%.re}.h.diff local outc="${outx%.re}.c" local switches=`basename $x | sed -e 's/^[^.]*\.\(.*\)\.re$/-\1/g' -e 's/^[^-].*//g' -e 's/\([^ ]\)--/\1 --/g' -e 's/(\([^)]*\))/ \1/g' -e 's/- //g'` - local headers=` printf "%s" "$switches" | grep -e '^-[^t -]*t[^ -]\+' | sed -e 's,^-[^t -]*t\([^ -]\+\),'"$test_blddir"'/\1,g'` + local outh=` printf "%s" "$switches" | grep -e '^-[^t -]*t[^ -]\+' | sed -e 's,^-[^t -]*t\([^ -]\+\),'"$test_blddir"'/\1,g'` local switches=`printf "%s" "$switches" | sed -e 's,^-\([^ot-]*[ot]\)\(.*\)$,-\1'"$test_blddir"'/\2,g'` local switches="$switches -o $outc" # enable warnings globally @@ -149,16 +147,19 @@ run_pack() { $cmd 2>$outname_stderr cat $outname_stderr $outc > $outname rm $outname_stderr $outc - # don't forget '--skeleton' files + # don't forget '-S, --skeleton' files for f in `find $(dirname $outc) -type f -name "$(basename $outc).line*.input"` do cat $f ${f%.input}.keys >> $outname rm $f ${f%.input}.keys done + # don't forget '-t, --type-header' files + [ -n "$outh" ] && cat "$outh" >> $outname && rm "$outh" LC_ALL=C sed -i $outname \ -e "s,$x,`basename $x`,g" \ -e "s,$outc,,g" \ + -e "s,$outh,`[ -z $outh ] || basename $outh`,g" \ -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' if test ! -f ${x%.re}.c @@ -179,30 +180,7 @@ run_pack() { cp -f ${x%.re}.c ${outx%.re}.c fi fi - - if test -n "$headers" - then - cat $headers | sed -e 's,'"$test_blddir"'/,,g' -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $typname - rm $headers - if test ! -f ${x%.re}.h - then - echo "FAIL missing ${x%.re}.h" - local errcnt=$(($errcnt + 1)) - cp -f $x $outx - elif $diff_prog ${x%.re}.h $typname > $typdiff - then - echo "OK $x: $switches" - rm $typname - else - echo "FAIL $x: $switches" - local errcnt=$(($errcnt + 1)) - cp -f $x $outx - cp -f ${x%.re}.h ${outx%.re}.h - fi - fi test -f $outdiff -a ! -s $outdiff && rm -f $outdiff - test -f $typdiff -a ! -s $typdiff && rm -f $typdiff - fi done echo $errcnt > $log diff --git a/re2c/test/condition_05.cgitcondition_05.cgit.h.c b/re2c/test/condition_05.cgitcondition_05.cgit.h.c index 290ec32a..6a7bde3f 100644 --- a/re2c/test/condition_05.cgitcondition_05.cgit.h.c +++ b/re2c/test/condition_05.cgitcondition_05.cgit.h.c @@ -136,3 +136,9 @@ int main(int argc, char **argv) } return 0; } +/* Generated by re2c */ + +enum YYCONDTYPE { + yycnormal, + yyccomment, +}; diff --git a/re2c/test/condition_05.cgitcondition_05.cgit.h.h b/re2c/test/condition_05.cgitcondition_05.cgit.h.h deleted file mode 100644 index 439fa96e..00000000 --- a/re2c/test/condition_05.cgitcondition_05.cgit.h.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Generated by re2c */ - -enum YYCONDTYPE { - yycnormal, - yyccomment, -}; diff --git a/re2c/test/condition_05.cgtcondition_05.cgt.h.c b/re2c/test/condition_05.cgtcondition_05.cgt.h.c index 9e08070b..569f71c1 100644 --- a/re2c/test/condition_05.cgtcondition_05.cgt.h.c +++ b/re2c/test/condition_05.cgtcondition_05.cgt.h.c @@ -147,3 +147,10 @@ int main(int argc, char **argv) } return 0; } +/* Generated by re2c */ +#line 3 "condition_05.cgt.h" + +enum YYCONDTYPE { + yycnormal, + yyccomment, +}; diff --git a/re2c/test/condition_05.cgtcondition_05.cgt.h.h b/re2c/test/condition_05.cgtcondition_05.cgt.h.h deleted file mode 100644 index dbd252f4..00000000 --- a/re2c/test/condition_05.cgtcondition_05.cgt.h.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Generated by re2c */ -#line 3 "condition_05.cgt.h" - -enum YYCONDTYPE { - yycnormal, - yyccomment, -}; diff --git a/re2c/test/condtype.cgtcondtype.cg.h.c b/re2c/test/condtype.cgtcondtype.cg.h.c index 8b714e15..427c7cf8 100644 --- a/re2c/test/condtype.cgtcondtype.cg.h.c +++ b/re2c/test/condtype.cgtcondtype.cg.h.c @@ -39,3 +39,10 @@ yy9: return 0; } +/* Generated by re2c */ +#line 3 "condtype.cg.h" + +enum YYCONDTYPE { + yyca, + yycb, +}; diff --git a/re2c/test/condtype.cgtcondtype.cg.h.h b/re2c/test/condtype.cgtcondtype.cg.h.h deleted file mode 100644 index 2968e382..00000000 --- a/re2c/test/condtype.cgtcondtype.cg.h.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Generated by re2c */ -#line 3 "condtype.cg.h" - -enum YYCONDTYPE { - yyca, - yycb, -}; diff --git a/re2c/test/condtype.cstcondtype.cs.h.c b/re2c/test/condtype.cstcondtype.cs.h.c index c84d1087..f2b7795d 100644 --- a/re2c/test/condtype.cstcondtype.cs.h.c +++ b/re2c/test/condtype.cstcondtype.cs.h.c @@ -39,3 +39,10 @@ yy9: return 0; } +/* Generated by re2c */ +#line 3 "condtype.cs.h" + +enum YYCONDTYPE { + yyca, + yycb, +}; diff --git a/re2c/test/condtype.cstcondtype.cs.h.h b/re2c/test/condtype.cstcondtype.cs.h.h deleted file mode 100644 index 200c172c..00000000 --- a/re2c/test/condtype.cstcondtype.cs.h.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Generated by re2c */ -#line 3 "condtype.cs.h" - -enum YYCONDTYPE { - yyca, - yycb, -}; diff --git a/re2c/test/condtype.ctcondtype.c.h.c b/re2c/test/condtype.ctcondtype.c.h.c index e6fbd57a..c4bb7e0c 100644 --- a/re2c/test/condtype.ctcondtype.c.h.c +++ b/re2c/test/condtype.ctcondtype.c.h.c @@ -46,3 +46,10 @@ yy9: return 0; } +/* Generated by re2c */ +#line 3 "condtype.c.h" + +enum YYCONDTYPE { + yyca, + yycb, +}; diff --git a/re2c/test/condtype.ctcondtype.c.h.h b/re2c/test/condtype.ctcondtype.c.h.h deleted file mode 100644 index 691d86d2..00000000 --- a/re2c/test/condtype.ctcondtype.c.h.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Generated by re2c */ -#line 3 "condtype.c.h" - -enum YYCONDTYPE { - yyca, - yycb, -};