1#!/bin/sh - 2# 3# $Id: chk.rpc,v 1.2 2006/09/11 15:40:46 bostic Exp $ 4# 5# Check to make sure that the code samples in the documents build. 6 7r=../../rpc_server/rpc.src 8i=../../dbinc/db.in 9 10t1=__1 11t2=__2 12 13[ -d ../../dbinc ] || { 14 echo 'FAIL: cannot find source distribution directory.' 15 exit 1 16} 17 18exitv=0 19 20# $1: handle name 21# $2: handle prefix 22# $3: method file 23check() 24{ 25 echo "==== Checking $1/$2..." 26 27 # Build a list of DB_ENV handle methods from the include file. 28 sed -e "/$1 PUBLIC HANDLE LIST BEGIN/,/$1 PUBLIC HANDLE LIST END/p" \ 29 -e d < $i | 30 grep '[\* ](\*[a-z]' | 31 sed -e 's/).*$//' \ 32 -e 's/.*(\*//' \ 33 -e '/^$/d' > $t1 34 35 # Build a list of handle methods from the rpc.src file. 36 egrep '^BEGIN|^LOCAL|^NOFUNC' $r | 37 awk '{print $2}' | 38 egrep "^$2_" | 39 sed -e "/^$2_create/d" \ 40 -e "s/$2_//" > $t2 41 42 if cmp -s $t1 $t2 ; then 43 : 44 else 45 echo "FAIL: $1 handle methods do not match." 46 echo "<<< dbinc/db.in >>> rpc_server/rpc.src" 47 diff $t1 $t2 48 exit 1 49 fi 50 51 if [ -z "$3" ]; then 52 return 53 fi 54 55 # Build a list of handle methods from the env/env_method.c and 56 # db/db_method.c files. 57 sed -e "/$1 PUBLIC HANDLE LIST BEGIN/,/$1 PUBLIC HANDLE LIST END/p" \ 58 -e d < "$3" | 59 sed -e '/^#ifdef.HAVE_REPLICATION_THREADS/d' \ 60 -e '/^#else.*HAVE_REPLICATION_THREADS/,/^#endif/d' \ 61 -e '/PUBLIC/d' \ 62 -e 's/ = .*//' \ 63 -e 's/^.*->//' > $t2 64 65 if cmp -s $t1 $t2 ; then 66 : 67 else 68 echo "FAIL: $1 handle methods do not match." 69 echo "<<< dbinc/db.in >>> $3" 70 diff $t1 $t2 71 exit 1 72 fi 73} 74 75# We don't check the DB handle method limits from db/db_method.c, DB handle 76# methods are set in per-access method routines, they aren't consolidated. 77check DB db 78check DBC dbc 79check DB_ENV env ../../env/env_method.c 80check DB_TXN txn 81 82exit $exitv 83