From: Ulya Trofimovich Date: Tue, 2 Jun 2015 12:19:50 +0000 (+0100) Subject: Support 'make distcheck'. X-Git-Tag: 0.15~226 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2bc24704ebd2a0e6050f755dbd93a5cd987a418;p=re2c Support 'make distcheck'. The only problem with 'make distcheck' was that we needed write access to top source directory ('make' wanted to overwrite bootstrap parser if it was built with bison and 'make check' wanted to create temporary files in 'test/' directory). This commit fixes it: - 'make' doesn't try to overwrite bootstrap if it is identical to the existing one (must always be true for 'make distcheck') - testing script makes a temporary directory and keeps all temporary files there. If some tests failed, temporary files for them are left and test sources and reference results are copied into temporary directory to make debug more convenient. This commit makes use of 'make distcheck' in release script. --- diff --git a/re2c/Makefile.am b/re2c/Makefile.am index cb415805..67b329c0 100644 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -150,8 +150,11 @@ $(AUTOGEN_PARSER): $(CUSTOM_PARSER) @if test $(BISON) = "yes"; \ then \ bison $(YFLAGS) --output=$@ --defines=$(AUTOGEN_PARSER_HDR) $< && \ - cp $@ $(top_srcdir)/$(BOOTSTRAP_PARSER) && \ - cp $(AUTOGEN_PARSER_HDR) $(top_srcdir)/$(BOOTSTRAP_PARSER_HDR); \ + if cmp -s $@ $(top_srcdir)/$(BOOTSTRAP_PARSER); \ + then \ + cp $@ $(top_srcdir)/$(BOOTSTRAP_PARSER) && \ + cp $(AUTOGEN_PARSER_HDR) $(top_srcdir)/$(BOOTSTRAP_PARSER_HDR); \ + fi; \ else \ cp $(top_srcdir)/$(BOOTSTRAP_PARSER) $@ && \ cp $(top_srcdir)/$(BOOTSTRAP_PARSER_HDR) $(AUTOGEN_PARSER_HDR); \ diff --git a/re2c/release.sh b/re2c/release.sh index 01bba23f..258f98cc 100755 --- a/re2c/release.sh +++ b/re2c/release.sh @@ -24,39 +24,22 @@ mkdir $builddir cd $builddir ../configure --enable-docs && \ - make bootstrap -j5 && \ - make tests && \ - make dist - - # dist-check - tmpdir=` date +"%Y%m%d%H%M%S%N"` - mkdir $tmpdir - cp re2c-$version.tar.gz $tmpdir - cd $tmpdir - gunzip re2c-$version.tar.gz - tar -x -f re2c-$version.tar - cd re2c-$version - ./configure && \ - make bootstrap -j5 && \ - make tests - - # upload files on sourceforge - src=release - src_tarballs=$src/frs/project/re2c/re2c/$version - src_docs=$src/project-web/re2c/htdocs - mkdir -p $src_tarballs - mkdir -p $src_docs - cp ../../re2c-$version.tar.gz $src_tarballs - cp doc/index.html doc/manual.html $src_docs - rsync -rK $src/ skvadrik@web.sourceforge.net:/home - cd .. - cd .. - rm -r $tmpdir + make bootstrap -j5 + make distcheck -j5 + + # upload files on sourceforge + src=release + src_tarballs=$src/frs/project/re2c/re2c/$version + src_docs=$src/project-web/re2c/htdocs + mkdir -p $src_tarballs $src_docs + cp re2c-$version.tar.gz $src_tarballs + cp ../doc/index.html doc/manual.html $src_docs + rsync -rK $src/ skvadrik@web.sourceforge.net:/home cd .. # $builddir # commit release git commit -a -m "Release $version." git tag $version -git push -git push --tags +git push --follow-tags +git push --follow-tags github master diff --git a/re2c/run_tests.sh.in b/re2c/run_tests.sh.in index 99a833a5..5819321c 100644 --- a/re2c/run_tests.sh.in +++ b/re2c/run_tests.sh.in @@ -22,7 +22,7 @@ detect_cpu_count () { valgrind="" wine="" -re2c="@builddir@/re2c" +re2c="./re2c" threads=`detect_cpu_count; echo $CPUS` tests=() for arg in $* @@ -46,11 +46,11 @@ do done echo "Running in ${threads} thread(s)" -testdir="@srcdir@/test" -if [ ${#tests[@]} -eq 0 ] -then - tests=(`for i in $testdir; do find $i -name '*.re'; done | sort`) -fi +test_srcdir="@top_srcdir@/test" +test_blddir="test_"`date +%y%m%d%H%M%S` +rm -rf $test_blddir && mkdir $test_blddir +[ ${#tests[@]} -ne 0 ] || tests=(`find $test_srcdir -name '*.re' | sort`) + tests_per_thread=$((${#tests[@]} / threads + 1)) packs=() for ((i = 0; i < threads; i++)) @@ -88,14 +88,14 @@ run_pack() { for x in $* do 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 genname=` printf "%s" "$switches" | sed -e 's,--.*$,,g' -e 's,^.[^o]*$,,g' -e 's,^[^ot]*t.*o.*$,,g' -e 's,^-[^o]*o\(.*\),'"$testdir"'/\1,g'` - local headers=` printf "%s" "$switches" | sed -e 's,--.*$,,g' -e 's,^.[^t]*$,,g' -e 's,^[^ot]*o.*t.*$,,g' -e 's,^-[^t]*t\(.*\),'"$testdir"'/\1,g'` - local switches=`printf "%s" "$switches" | sed -e 's,^-\([^ot-]*[ot]\)\(.*\)$,-\1'"$testdir"'/\2,g'` + local genname=` printf "%s" "$switches" | sed -e 's,--.*$,,g' -e 's,^.[^o]*$,,g' -e 's,^[^ot]*t.*o.*$,,g' -e 's,^-[^o]*o\(.*\),'"$test_blddir"'/\1,g'` + local headers=` printf "%s" "$switches" | sed -e 's,--.*$,,g' -e 's,^.[^t]*$,,g' -e 's,^[^ot]*o.*t.*$,,g' -e 's,^-[^t]*t\(.*\),'"$test_blddir"'/\1,g'` + local switches=`printf "%s" "$switches" | sed -e 's,^-\([^ot-]*[ot]\)\(.*\)$,-\1'"$test_blddir"'/\2,g'` # don't use the -o flag, since it makes it harder to diff. - local outname=$testdir/`basename ${x%.re}.c.temp` - local outdiff=$testdir/`basename ${x%.re}.c.diff` - local typname=$testdir/`basename ${x%.re}.h.temp` - local typdiff=$testdir/`basename ${x%.re}.h.diff` + local outname=$test_blddir/`basename ${x%.re}.c.temp` + local outdiff=$test_blddir/`basename ${x%.re}.c.diff` + local typname=$test_blddir/`basename ${x%.re}.h.temp` + local typdiff=$test_blddir/`basename ${x%.re}.h.diff` local cmd="${valgrind} ${wine} ${re2c} $switches $x" if test -n "${wine}" @@ -105,7 +105,11 @@ run_pack() { $cmd 2>&1 | LC_ALL=C sed -e "s,$x,`basename $x`,g" -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' ${filter_newlines} > $outname if test -n "$genname" then - cat $genname | sed -e 's,'"$testdir"'/,,g' -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $outname + cat $genname | sed \ + -e 's,'"$test_srcdir"'/,,g' \ + -e 's,'"$test_blddir"'/,,g' \ + -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' \ + > $outname rm $genname fi @@ -113,6 +117,7 @@ run_pack() { then echo "FAIL missing ${x%.re}.c" local errcnt=$(($errcnt + 1)) + cp -f $x $test_blddir else local r=`diff ${x%.re}.c $outname > $outdiff; echo $?` if [[ $r == 0 ]] @@ -122,17 +127,19 @@ run_pack() { else echo "FAIL $x: $switches" local errcnt=$(($errcnt + 1)) + cp -f $x ${x%.re}.c $test_blddir fi fi if test -n "$headers" then - cat $headers | sed -e 's,'"$testdir"'/,,g' -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $typname + 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 $test_blddir elif diff ${x%.re}.h $typname > $typdiff then echo "OK $x: $switches" @@ -140,6 +147,7 @@ run_pack() { else echo "FAIL $x: $switches" local errcnt=$(($errcnt + 1)) + cp -f $x ${x%.re}.h $test_blddir fi fi test -f $outdiff -a ! -s $outdiff && rm -f $outdiff @@ -175,10 +183,10 @@ do rm -f ${logs[i]} done - if [ $errors -eq 0 ] then echo "All ${#tests[@]} tests passed successfully." + rm -r $test_blddir exit 0 else echo "Error: $errors out ${#tests[@]} tests failed."