1#!/bin/sh - 2# 3# $Id: chk.stats,v 12.3 2007/04/20 18:29:00 bostic Exp $ 4# 5# Check to make sure all of the stat structure members are included in 6# all of the possible formats. 7 8# Top-level directory. 9d=../.. 10docs=$d/docs_src 11 12# Path names are from a top-level directory. 13[ -f $d/README ] || { 14 echo 'FAIL: cannot find source distribution directory.' 15 exit 1 16} 17 18exitv=0 19t=__tmp 20 21# Extract the field names for a structure from the db.h file. 22inc_fields() 23{ 24 sed -e "/struct $1 {/,/^};$/p" \ 25 -e d < $d/dbinc/db.in | 26 sed -e 1d \ 27 -e '$d' \ 28 -e '/;/!d' \ 29 -e 's/;.*//' \ 30 -e 's/^[ ].*[ \*]//' 31} 32 33cat << END_OF_IGNORE > IGNORE 34bt_maxkey 35bt_metaflags 36hash_metaflags 37qs_metaflags 38qs_ndata 39st_hash_max_nowait 40END_OF_IGNORE 41 42# Check to make sure the elements of a structure from db.h appear in 43# the other files. 44inc() 45{ 46 for i in `inc_fields $1`; do 47 if egrep -w $i IGNORE > /dev/null; then 48 echo " $1: ignoring $i" 49 continue 50 fi 51 for j in $2; do 52 if egrep -w $i $j > /dev/null; then 53 :; 54 else 55 echo " $1: $i not found in $j." 56 exitv=1 57 fi 58 done 59 done 60} 61 62inc "__db_bt_stat" "$d/tcl/tcl_db.c $d/btree/bt_stat.c $docs/db/db_stat.so" 63inc "__db_h_stat" "$d/tcl/tcl_db.c $d/hash/hash_stat.c $docs/db/db_stat.so" 64inc __db_lock_stat \ 65 "$d/tcl/tcl_lock.c $d/lock/lock_stat.c $docs/lock/lock_stat.so" 66inc __db_log_stat "$d/tcl/tcl_log.c $d/log/log_stat.c $docs/log/log_stat.so" 67inc __db_mpool_fstat \ 68 "$d/tcl/tcl_mp.c $d/mp/mp_stat.c $docs/memp/memp_stat.so" 69inc __db_mpool_stat \ 70 "$d/tcl/tcl_mp.c $d/mp/mp_stat.c $docs/memp/memp_stat.so" 71inc __db_mutex_stat \ 72 "$d/mutex/mut_stat.c $docs/mutex/mutex_stat.so" 73inc "__db_qam_stat" \ 74 "$d/tcl/tcl_db.c $d/qam/qam_stat.c $docs/db/db_stat.so" 75inc __db_rep_stat \ 76 "$d/tcl/tcl_rep.c $d/rep/rep_stat.c $docs/rep/rep_stat.so" 77inc __db_seq_stat \ 78 "$d/tcl/tcl_seq.c $d/sequence/seq_stat.c $docs/seq/seq_stat.so" 79inc __db_txn_stat \ 80 "$d/tcl/tcl_txn.c $d/txn/txn_stat.c $docs/txn/txn_stat.so" 81 82# Check to make sure the elements from a man page appears in db.in. 83man() 84{ 85 for i in `cat $t`; do 86 if egrep -w $i IGNORE > /dev/null; then 87 echo " $1: ignoring $i" 88 continue 89 fi 90 if egrep -w $i $d/dbinc/db.in > /dev/null; then 91 :; 92 else 93 echo " $1: $i not found in db.h." 94 exitv=1 95 fi 96 done 97} 98 99sed -e '/m4_field(/!d' \ 100 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < $docs/db/db_stat.so > $t 101man "checking db_stat.so against db.h" 102 103sed -e '/m4_field(/!d' \ 104 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < $docs/lock/lock_stat.so > $t 105man "checking lock_stat.so against db.h" 106 107sed -e '/m4_field(/!d' \ 108 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < $docs/log/log_stat.so > $t 109man "checking log_stat.so against db.h" 110 111sed -e '/m4_field(/!d' \ 112 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < $docs/memp/memp_stat.so > $t 113man "checking memp_stat.so against db.h" 114 115sed -e '/m4_field(/!d' \ 116 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < $docs/rep/rep_stat.so > $t 117man "checking rep_stat.so against db.h" 118 119sed -e '/m4_field(/!d' \ 120 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < $docs/seq/seq_stat.so > $t 121man "checking seq_stat.so against db.h" 122 123sed -e '/m4_field(/!d' \ 124 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' \ 125 -e 's/__LB__.*//' < $docs/txn/txn_stat.so > $t 126man "checking txn_stat.so against db.h" 127 128exit $exitv 129