Home | History | Annotate | Line # | Download | only in test
      1      1.1  christos #!/bin/sh
      2      1.1  christos # libevent rpcgen_wrapper.sh
      3      1.1  christos # Transforms event_rpcgen.py failure into success for make, only if
      4      1.1  christos # regress.gen.c and regress.gen.h already exist in $srcdir.  This
      5      1.1  christos # is needed for "make distcheck" to pass the read-only $srcdir build,
      6      1.1  christos # as with read-only sources fresh from tarball, regress.gen.[ch] will
      7      1.1  christos # be correct in $srcdir but unwritable.  This previously triggered
      8      1.1  christos # Makefile.am to create stub regress.gen.c and regress.gen.h in the
      9      1.1  christos # distcheck _build directory, which were then detected as leftover
     10      1.1  christos # files in the build tree after distclean, breaking distcheck.
     11      1.1  christos # Note that regress.gen.[ch] are not in fresh git clones, making
     12      1.1  christos # working Python a requirement for make distcheck of a git tree.
     13      1.1  christos 
     14      1.1  christos exit_updated() {
     15  1.1.1.2  christos #    echo "Updated ${srcdir}/regress.gen.c and ${srcdir}/regress.gen.h"
     16      1.1  christos     exit 0
     17      1.1  christos }
     18      1.1  christos 
     19      1.1  christos exit_reuse() {
     20  1.1.1.2  christos     echo "event_rpcgen.py failed, ${srcdir}/regress.gen.\[ch\] will be reused." >&2
     21      1.1  christos     exit 0
     22      1.1  christos }
     23      1.1  christos 
     24      1.1  christos exit_failed() {
     25      1.1  christos     echo "Could not generate regress.gen.\[ch\] using event_rpcgen.sh" >&2
     26      1.1  christos     exit 1
     27      1.1  christos }
     28      1.1  christos srcdir=$1
     29      1.1  christos srcdir=${srcdir:-.}
     30  1.1.1.2  christos 
     31  1.1.1.3  christos ${srcdir}/../event_rpcgen.py --quiet ${srcdir}/regress.rpc \
     32  1.1.1.2  christos                test/regress.gen.h test/regress.gen.c
     33  1.1.1.2  christos 
     34      1.1  christos case "$?" in
     35      1.1  christos  0)
     36      1.1  christos     exit_updated
     37      1.1  christos     ;;
     38      1.1  christos  *)
     39      1.1  christos     test -r ${srcdir}/regress.gen.c -a -r ${srcdir}/regress.gen.h && \
     40      1.1  christos 	exit_reuse
     41      1.1  christos     exit_failed
     42      1.1  christos     ;;
     43      1.1  christos esac
     44