[Groonga-mysql-commit] mroonga/mroonga [master] detect MySQL directory for testing automatically.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 9月 13日 (月) 11:07:23 JST


Kouhei Sutou	2010-09-13 02:07:23 +0000 (Mon, 13 Sep 2010)

  New Revision: 743a5418de79e35b4dd502137fac1cc234547696

  Log:
    detect MySQL directory for testing automatically.

  Modified files:
    configure.ac
    test/Makefile.am
    test/run-sql-test.sh

  Modified: configure.ac (+9 -0)
===================================================================
--- configure.ac    2010-09-10 00:01:37 +0000 (44c4fe0)
+++ configure.ac    2010-09-13 02:07:23 +0000 (2b86abf)
@@ -44,6 +44,15 @@ AC_DEFUN([CONFIG_OPTION_MYSQL],[
     [AC_MSG_ERROR([--with-mysql-source=PATH is required for standalone build])]
   )
 
+  ac_mysql_build_dir=
+  AC_ARG_WITH([mysql-build],
+    [AS_HELP_STRING([--with-mysql-build=PATH], [MySQL build directory PATH])],
+    [ac_mysql_build_dir="$withval"],
+    [ac_mysql_build_dir="$ac_mysql_source_dir"]
+  )
+  MYSQL_BUILD="$ac_mysql_build_dir"
+  AC_SUBST(MYSQL_BUILD)
+
   AC_MSG_CHECKING([mysql_config])
   AC_ARG_WITH([mysql-config],
     [AS_HELP_STRING([--with-mysql-config=PATH],

  Modified: test/Makefile.am (+8 -2)
===================================================================
--- test/Makefile.am    2010-09-10 00:01:37 +0000 (2eefdde)
+++ test/Makefile.am    2010-09-13 02:07:23 +0000 (5cf616f)
@@ -1,13 +1,19 @@
 SUBDIRS = unit sql
 
+TESTS = run-sql-test.sh
+TESTS_ENVIRONMENT = MYSQL_BUILD="$(MYSQL_BUILD)"
+
 if WITH_CUTTER
-TESTS = run-unit-test.sh
-TESTS_ENVIRONMENT = CUTTER="$(CUTTER)"
+TESTS += run-unit-test.sh
+TESTS_ENVIRONMENT += CUTTER="$(CUTTER)"
 endif
 
 EXTRA_DIST =					\
 	run-unit-test.sh			\
 	run-sql-test.sh
 
+echo-mysql-build:
+	echo $(MYSQL_BUILD)
+
 echo-cutter:
 	echo $(CUTTER)

  Modified: test/run-sql-test.sh (+18 -10)
===================================================================
--- test/run-sql-test.sh    2010-09-10 00:01:37 +0000 (1c3fd6b)
+++ test/run-sql-test.sh    2010-09-13 02:07:23 +0000 (ea3c93e)
@@ -1,13 +1,21 @@
 #!/bin/sh
 
-if test -n "$MYSQL_HOME"; then
-    SQL_TESTS="$MYSQL_HOME/mysql-test/suite/groonga"
-    if test -d "$SQL_TESTS"; then
-	cd $MYSQL_HOME/mysql-test
-	./mysql-test-run.pl --suite=groonga --force
-    else
-	echo "$SQL_TESTS does not exists. Aborting SQL test."
-    fi
-else
-    echo '$MYSQL_HOME is not defined. Aborting SQL test.'
+export BASE_DIR="$(cd $(dirname $0); pwd)"
+top_dir="$BASE_DIR/.."
+
+if test -z "$MYSQL_BUILD"; then
+    MYSQL_BUILD="$(make -s -C $BASE_DIR echo-mysql-build)"
+fi
+export MYSQL_BUILD
+
+test_suite_name="groonga"
+local_groonga_mysql_test_suite_dir="${BASE_DIR}/sql"
+mysql_test_dir="${MYSQL_BUILD}/mysql-test"
+test_suites_dir="${mysql_test_dir}/suite"
+groonga_mysql_test_suite_dir="${test_suites_dir}/${test_suite_name}"
+
+if ! test -e "${groonga_mysql_test_suite_dir}"; then
+    ln -s "${groonga_mysql_test_suite_dir}" "${groonga_mysql_test_suite_dir}"
 fi
+(cd "$mysql_test_dir" && \
+    ./mysql-test-run.pl --suite="${test_suite_name}" --force)




Groonga-mysql-commit メーリングリストの案内
Back to archive index