1#run_test.sh
2run_test()
3{
4prog=$1 
5mkdir -p ./dbenv
6rm -rf dbenv/*
7echo "Auto commit btree transaction tests:"
8$prog -s b -m t -t a  -T 200 -k 50 -l 100 -c 33554432 -n $2 >/dev/null
9echo "Transaction btree tests:"
10$prog -s b -m t -t e  -T 200 -k 50 -l 100 -c 33554432 -n $2 >/dev/null
11echo "CDS btree tests:"
12$prog -s b -m c -T 200 -k 50 -l 100 -c 33554432 -n $2  >/dev/null
13echo "DS btree tests:"
14$prog -s b -T 200 -k 50 -l 100 -c 33554432 -n $2  >/dev/null
15echo "Auto commit hash transaction tests:"
16$prog -s h -m t -t a  -T 200 -k 50 -l 100 -c 33554432 -n $2 >/dev/null
17echo "Transaction hash tests:"
18$prog -s h -m t -t e  -T 200 -k 50 -l 100 -c 33554432 -n $2 >/dev/null
19echo "CDS hash tests:"
20$prog -s h -m c -T 200 -k 50 -l 100 -c 33554432 -n $2 >/dev/null
21echo "DS hash tests:"
22$prog -s h -T 200 -k 50 -l 100 -c 33554432 -n $2  >/dev/null
23}
24
25run_mt()
26{
27prog=$1
28echo "Transaction btree multithreaded tests:"
29$prog -s b -m t -t e  -T 200 -k 50 -l 100 -c 33554432  -M > mt_test_btree_tds.out
30echo "Transaction btree multithreaded tests(auto commit):"
31$prog -s b -m t -t e  -T 200 -k 50 -l 100 -c 33554432  -M > mt_test_btree_tds_autocommit.out
32
33echo "Transaction hash multithreaded tests:"
34$prog -s h -m t -t e  -T 200 -k 50 -l 100 -c 33554432 -M > mt_test_hash_tds.out
35echo "Transaction hash multithreaded tests:"
36$prog -s h -m t -t e  -T 200 -k 50 -l 100 -c 33554432 -M > mt_test_hash_tds_autocommit.out
37# This test is not suitable for CDS mode because the writers will not stop inserting to 
38# the database until the reader reads enough key/data pairs, but the readers will never 
39# have a chance to open its cursor read any key/data pair since the write is writing to db.
40}
41run_tpcb()
42{
43prog=$1
44
45mkdir -p ./dbenv
46rm -fr dbenv/*
47
48$prog -i
49$prog -n $2
50
51}
52os=`uname -s`
53ntimes=1
54mttest=0
55if test "$1" = "tpcb" ; then #running tpcb test.
56	if test $# -gt 1 ; then
57		ntimes=$2
58	fi
59
60	if test "$os" = "CYGWIN_NT-5.1" ; then
61		run_tpcb "../build_windows/Win32/Release/exstl_tpcb.exe" $ntimes
62	else 
63		run_tpcb  "../build_unix/exstl_tpcb" $ntimes
64	fi
65else
66	if test "$1" = "mt" ; then #running ordinary test.
67		mttest=1
68	elif test $# -eq 2 ; then
69		ntimes=$2
70	fi
71	
72	if test "$os" = "CYGWIN_NT-5.1" ; then
73		echo "Debug version test"
74		if test $mttest -eq 1 ; then
75			run_mt "../build_windows/Win32/Debug/stl_test.exe"
76		else
77			run_test "../build_windows/Win32/Debug/stl_test.exe" $ntimes
78		fi
79		echo "Release version test"
80		if test $mttest -eq 1 ; then
81			run_mt "../build_windows/Win32/Release/stl_test.exe"
82		else
83			run_test "../build_windows/Win32/Release/stl_test.exe" $ntimes
84		fi
85	else
86		if test $mttest -eq 1 ; then
87			run_mt "../build_unix/test_dbstl"
88		else
89			run_test "../build_unix/test_dbstl"  $ntimes
90		fi
91	fi
92fi
93