#!/bin/bash # # test pidl conditional rebuilds. Run from the source3 directory # function _fail { echo "FATAL: $1" exit 1 } function _check_built { local idl_path=$1 local idl_files=`ls $idl_path` || _fail "could not find idl at $idl_path" for i in $idl_files; do grep "Compiling $i" pidl_out.log || _fail "$i was not rebuilt" done } echo "testing full build, all idl should be built..." PIDL_OUTPUTDIR="librpc/gen_ndr" CPP="gcc -E" PIDL=../pidl/pidl srcdir=. ../librpc/build_idl.sh --full ../librpc/idl/*.idl &> pidl_out.log || _fail "build failed" _check_built "../librpc/idl/*.idl" || _fail "full idl build not successful" echo "+ passed" echo "testing removal of an output file" rm librpc/gen_ndr/ndr_dcerpc.c PIDL_OUTPUTDIR="librpc/gen_ndr" CPP="gcc -E" PIDL=../pidl/pidl srcdir=. ../librpc/build_idl.sh ../librpc/idl/*.idl &> pidl_out.log || _fail "build failed" _check_built "../librpc/idl/dcerpc.idl" || _fail "idl build not successful for removal" echo "+ passed" echo "testing modification a source idl" touch ../librpc/idl/dcerpc.idl PIDL_OUTPUTDIR="librpc/gen_ndr" CPP="gcc -E" PIDL=../pidl/pidl srcdir=. ../librpc/build_idl.sh ../librpc/idl/*.idl &> pidl_out.log || _fail "build failed" _check_built "../librpc/idl/dcerpc.idl" || _fail "idl build not successful for modified src" echo "+ passed" echo "testing modification of the pidl compiler itself, should rebuild everything..." touch ../pidl/lib/Parse/Pidl/Expr.pm PIDL_OUTPUTDIR="librpc/gen_ndr" CPP="gcc -E" PIDL=../pidl/pidl srcdir=. ../librpc/build_idl.sh ../librpc/idl/*.idl &> pidl_out.log || _fail "build failed" _check_built "../librpc/idl/*.idl" || _fail "idl build not successful for modified pidl" echo "+ passed" rm -f pidl_out.log