summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2000-10-11 17:01:58 -0600
committerunknown <sasha@mysql.sashanet.com>2000-10-11 17:01:58 -0600
commit9e853c97de28ee629fe42a1468b142ce20824261 (patch)
tree30fc73c9bdb96b26a01738df3c998600f867e0cf /mysql-test
parent8f41b00cf9f4dc7f73d244a1e9a4a9661702ffd1 (diff)
downloadmariadb-git-9e853c97de28ee629fe42a1468b142ce20824261.tar.gz
mysql-test-run added gcov support
sel000003.result BitKeeper file /home/sasha/src/bk/mysql-gcov/mysql-test/r/3.23/sel000003.result sel000003.test BitKeeper file /home/sasha/src/bk/mysql-gcov/mysql-test/t/3.23/sel000003.test mysql-test/mysql-test-run: added gcov support
Diffstat (limited to 'mysql-test')
-rwxr-xr-xmysql-test/mysql-test-run33
-rw-r--r--mysql-test/r/3.23/sel000003.result3
-rw-r--r--mysql-test/t/3.23/sel000003.test7
3 files changed, 41 insertions, 2 deletions
diff --git a/mysql-test/mysql-test-run b/mysql-test/mysql-test-run
index 64b0135d483..279d0af3497 100755
--- a/mysql-test/mysql-test-run
+++ b/mysql-test/mysql-test-run
@@ -26,6 +26,11 @@ SYST=0
REALT=0
TIMEFILE="$CWD/var/tmp/mysqltest-time"
DASHBLANK="---- ---- -------"
+MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
+ myisammrg heap sql"
+GCOV=`which gcov`
+GCOV_MSG=/tmp/mysqld-gcov.out
+GCOV_ERR=/tmp/mysqld-gcov.err
[ -z $COLUMNS ] && COLUMNS=80
E=`expr $COLUMNS - 8`
@@ -64,7 +69,7 @@ MYSQL_TEST="$BASEDIR/client/mysqltest"
MYSQLADMIN="$BASEDIR/client/mysqladmin"
MYSQL_TEST="$MYSQL_TEST --socket=$MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent"
INSTALL_DB="$MYBIN/mysql-test_install_db"
-
+[ $1 = "-gcov" ] && DO_GCOV=1
#++
# Terminal Modifications
@@ -166,8 +171,29 @@ mysql_install_db () {
return 0
}
+gcov_clean () {
+ find .. -name -name \*.gcov \
+ -or -name \*.da | xargs rm
+}
+
+gcov_collect () {
+ echo "Collecting source coverage info..."
+ [ -f $GCOV_MSG ] && rm $GCOV_MSG
+ [ -f $GCOV_ERR ] && rm $GCOV_ERR
+ for d in $MYSQLD_SRC_DIRS; do
+ cd ../$d
+ for f in *.h *.cc *.c; do
+ $GCOV $f 2>>$GCOV_ERR >>$GCOV_MSG
+ done
+ cd ../mysql-test
+ done
+
+ echo "gcov info in $GCOV_MSG, errors in $GCOV_ERR"
+}
+
mysql_start () {
+ cd .. # for gcov
$MYSQLD --no-defaults \
--skip-networking \
--basedir=$CWD \
@@ -176,7 +202,7 @@ mysql_start () {
--socket=$MYSOCK \
--log=$MYLOG \
--language=english >> $MYERR 2>&1 &
-
+ cd mysql-test
return 1
}
@@ -206,6 +232,7 @@ mysql_loadstd () {
return 1
}
+[ $DO_GCOV = 1 ] && gcov_clean # clean up stale gcov files if running with gcov
mysql_install_db
@@ -287,4 +314,6 @@ $ECHO
report_stats
$ECHO
+[ $DO_GCOV = 1 ] && gcov_collect # collect coverage information
+
exit 0
diff --git a/mysql-test/r/3.23/sel000003.result b/mysql-test/r/3.23/sel000003.result
new file mode 100644
index 00000000000..098e2cce1b0
--- /dev/null
+++ b/mysql-test/r/3.23/sel000003.result
@@ -0,0 +1,3 @@
+n score
+4 10
+2 20
diff --git a/mysql-test/t/3.23/sel000003.test b/mysql-test/t/3.23/sel000003.test
new file mode 100644
index 00000000000..660405b69a5
--- /dev/null
+++ b/mysql-test/t/3.23/sel000003.test
@@ -0,0 +1,7 @@
+use test;
+drop table if exists t;
+create table t(name char(20) not null primary key,
+ score smallint not null, key(score));
+insert into t values ('Sasha', 20), ('Matt', 20), ('Monty', 10),
+ ('David', 10), ('Tim', 10),('Jeremy', 10);
+@r/3.23/sel000003.result select count(*) as n,score from t group by score; \ No newline at end of file