4 LIBS=${LIBS:-"-lpthread"}
5 WINBUILDDIR="Win32/Release"
8 HOSTOS="`uname -o 2>/dev/null||uname -s 2>/dev/null`"
9 if test `echo "$HOSTOS"|grep -i cygwin|wc -l` -gt 0;then
13 # build_test_micro_posix
14 # Build test_micro on a POSIX system.
15 build_test_micro_posix()
17 # See if there's a test_micro binary already.
18 test $clean -eq 0 && test -x test_micro && return 0
20 echo 'Compiling test_micro on posix system...'
23 if [ "$CC" = "gcc" ]; then
28 $CC -I. -I../dbinc -I../dbinc_auto -I.. -I$h/source \
29 $SRC -o test_micro ./libdb.a $LIBS || return 1
32 # build_test_micro_windows
33 # Build test_micro on a Windows system.
34 build_test_micro_windows()
36 # See if there's a test_micro binary already.
37 test $clean -eq 0 && test -x test_micro && return 0
39 echo 'Compiling test_micro on windows ...'
42 cl /nologo /o test_micro /DDB_WIN32 /G6 /Ox /MD\
43 -I./ -I../ -I$h/source/ -I../dbinc -I../dbinc_auto $SRC $WINSRC\
44 ./$WINBUILDDIR/libdb*.lib ./Release/libdb*.lib ws2_32.lib advapi32.lib
51 # You can set the MAJOR and MINOR environment variables to limit
52 # the BDB releases on which the tests are run.
53 echo Versions db-${MAJOR:-[3-9]}.${MINOR:-*}.*
54 for i in db-${MAJOR:-[3-9]}.${MINOR:-*}.*; do
56 major=`echo $i|sed "s/db-//g"|cut -d . -f 1`
57 minor=`echo $i|sed "s/db-//g"|cut -d . -f 2`
58 if test $major -gt "4";then
59 WINBUILDDIR="Win32/Release"
60 elif test $major -lt "4";then
62 elif test "X$minor" = "X" -o "$minor" -lt "8";then
65 WINBUILDDIR="Win32/Release"
68 if [ -f $i/$variant/libdb.a ] ; then
70 build_test_micro_posix || exit 1)
71 elif [ -f $i/build_windows/${WINBUILDDIR}/libdb??.lib ] ; then
72 (cd $i/build_windows &&
73 build_test_micro_windows || exit 1)
76 echo "$i run begins: `date`"
77 echo "test_micro $1..."
78 if [ -f $i/$variant/libdb.a ] ; then
79 (cd $i/$variant/ && ./test_micro $1 || exit 1)
80 if [ -f $t/gmon.out ] ; then
81 mv $t/gmon.out $i/$variant
82 gprof $i/$variant/.libs/lt-test_micro $i/$variant/gmon.out > $i/$variant/gprof.out
84 elif [ -f $i/build_windows/${WINBUILDDIR}/libdb??.lib ] ; then
85 (cd $i/build_windows/ && ./test_micro $1 || exit 1)
87 echo "$i run ends: `date`"
91 # Get a path to this shellscript.
94 if [ "$CYGWIN" = "1" ];then
95 h="`cygpath -m -a \"$h\"`"
97 # We may need to re-compile, create a list of our sources.
98 SRC="$h/source/b_curalloc.c $h/source/b_curwalk.c $h/source/b_del.c
99 $h/source/b_get.c $h/source/b_inmem.c $h/source/b_load.c $h/source/b_latch.c
100 $h/source/b_open.c $h/source/b_put.c $h/source/b_recover.c
101 $h/source/b_txn.c $h/source/b_txn_write.c $h/source/b_uname.c
102 $h/source/b_util.c $h/source/b_workload.c $h/source/test_micro.c
103 $h/../common/util_arg.c"
105 WINSRC="$h/../clib/getopt.c"
108 clean=0 # Rebuild test_micro
109 workload=0 # Run workload tests
110 start_test=0 # Start test
111 end_test=0 # End test
115 -c) # Rebuild test_micro.
118 -w) # Run workload tests
121 [1-9]*-[0-9]*) # Range: -3, 3-, 3-10
122 start_test=`echo $1|sed 's/-.*//'`
123 start_test=${start_test:=1}
124 end_test=`echo $1|sed 's/.*-//'`
125 end_test=${end_test:=0}
127 [1-9]*) # Specific test
131 -v) variant=$2 # get code here, rather than from build_unix
138 echo 'usage: test_micro [-cw] [# | #- | -# | #-#]' >& 2
142 if test $start_test != 0; then
143 cmd="$cmd -s $start_test"
145 if test $end_test != 0; then
146 cmd="$cmd -e $end_test"
149 # Create the run directory, and initialize test_micro's arguments.
150 t=RUN.`hostname | sed 's/\..*//'`
151 [ -d $t ] || mkdir $t
152 if [ "$CYGWIN" = "1" ];then
153 cmd="$cmd -d `(cd $t && cygpath -m -a \"$PWD\")`"
155 cmd="$cmd -d `(cd $t && pwd)`"
158 if test "$workload" -eq 1; then
159 cmd="$cmd -i $h/configs/run.workload"
161 cmd="$cmd -i $h/configs/run.std"
164 # Flush any I/O, just to get as a clean a timing as we can, ignore errors,
165 # sync is privleged on some systems.
166 (sync && sleep 1 2>&1) > /dev/null