aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-06-03 15:02:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-06-03 15:02:51 +0200
commite6b93ff477d7c789b786b059dcab1f66e5aae013 (patch)
tree06abb2e92d7e6f99c957ba0f0641afc36a1712d9
parentd83890c0c2c95da9e190a8f9a7ddc29cd621bef7 (diff)
Use database name in options and driver files (autotools part)
-rw-r--r--configure.ac2
-rw-r--r--evolution/makefile2
-rwxr-xr-xevolution/tester40
-rwxr-xr-xevolution/tester.in43
-rw-r--r--m4/mssql.m438
-rw-r--r--m4/mysql.m442
-rw-r--r--m4/oracle.m440
-rw-r--r--m4/pgsql.m440
-rw-r--r--m4/sqlite.m44
-rwxr-xr-xtester.in11
10 files changed, 134 insertions, 128 deletions
diff --git a/configure.ac b/configure.ac
index 9dc69be..4a3af31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,5 +112,5 @@ STATIC_LIB([LIBCOMMON_STATIC_LIB], [Static library interface.])
#
AC_CONFIG_HEADERS([config.h libcommon/common/config.h])
AC_CONFIG_FILES([__path__(config_files)])
-AC_CONFIG_COMMANDS([tester-mode], [chmod +x tester])
+AC_CONFIG_COMMANDS([tester-mode], [chmod +x tester evolution/tester])
AC_OUTPUT
diff --git a/evolution/makefile b/evolution/makefile
index 9f85cf8..d83995e 100644
--- a/evolution/makefile
+++ b/evolution/makefile
@@ -33,7 +33,7 @@ $(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_tests)))
name := evolution
$(dist): name := $(name)
$(dist): data_dist := tester.bat
-$(dist): exec_dist := tester
+$(dist): exec_dist := tester.in
$(dist): export dirs := $(filter-out $(no_dist_tests),$(tests))
$(dist): export extra_dist := $(data_dist) $(exec_dist) test.bat \
$(call vc9slns,$(name)) $(call vc10slns,$(name)) $(call vc11slns,$(name))
diff --git a/evolution/tester b/evolution/tester
deleted file mode 100755
index 2aecea6..0000000
--- a/evolution/tester
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /bin/sh
-
-# file : evolution/tester
-# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
-# license : GNU GPL v2; see accompanying LICENSE file
-
-#
-# Run an evolution test. The test driver is in the current directory. The
-# data files, if any, are in $srcdir.
-#
-
-if test -f test1.sql; then
- # Standalone schema.
- #
-
- # Drop everything.
- $top_builddir/db-driver test3.sql || exit 1
- $top_builddir/db-driver test2.sql || exit 1
- $top_builddir/db-driver test1.sql || exit 1
-
- # Base schema.
- $top_builddir/db-driver test3-002-pre.sql || exit 1
- $top_builddir/db-driver test3-002-post.sql || exit 1
- ./driver --options-file "$top_builddir/db.options" 1 || exit 1
-
- # Migration.
- $top_builddir/db-driver test3-003-pre.sql || exit 1
- ./driver --options-file "$top_builddir/db.options" 2 || exit 1
- $top_builddir/db-driver test3-003-post.sql || exit 1
-
- # Current schema.
- ./driver --options-file "$top_builddir/db.options" 3 || exit 1
-
-else
- # Embedded schema. Just run the driver.
- #
- ./driver --options-file "$top_builddir/db.options" 1 || exit 1
- ./driver --options-file "$top_builddir/db.options" 2 || exit 1
- ./driver --options-file "$top_builddir/db.options" 3 || exit 1
-fi
diff --git a/evolution/tester.in b/evolution/tester.in
new file mode 100755
index 0000000..805b360
--- /dev/null
+++ b/evolution/tester.in
@@ -0,0 +1,43 @@
+#! /bin/sh
+
+# file : evolution/tester.in
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+#
+# Run an evolution test. The test driver is in the current directory. The
+# data files, if any, are in $srcdir.
+#
+
+db_driver="$top_builddir/@database@-driver"
+db_options="$top_builddir/@database@.options"
+
+if test -f test1.sql; then
+ # Standalone schema.
+ #
+
+ # Drop everything.
+ $db_driver test3.sql || exit 1
+ $db_driver test2.sql || exit 1
+ $db_driver test1.sql || exit 1
+
+ # Base schema.
+ $db_driver test3-002-pre.sql || exit 1
+ $db_driver test3-002-post.sql || exit 1
+ ./driver --options-file "$db_options" 1 || exit 1
+
+ # Migration.
+ $db_driver test3-003-pre.sql || exit 1
+ ./driver --options-file "$db_options" 2 || exit 1
+ $db_driver test3-003-post.sql || exit 1
+
+ # Current schema.
+ ./driver --options-file "$db_options" 3 || exit 1
+
+else
+ # Embedded schema. Just run the driver.
+ #
+ ./driver --options-file "$db_options" 1 || exit 1
+ ./driver --options-file "$db_options" 2 || exit 1
+ ./driver --options-file "$db_options" 3 || exit 1
+fi
diff --git a/m4/mssql.m4 b/m4/mssql.m4
index dea9b98..38f2cee 100644
--- a/m4/mssql.m4
+++ b/m4/mssql.m4
@@ -176,39 +176,39 @@ fi
#
AC_CONFIG_COMMANDS([mssql.options],
[
- rm -f db.options
- echo '#! /bin/sh' >db-driver
+ rm -f mssql.options
+ echo '#! /bin/sh' >mssql-driver
- echo 'opt=' >>db-driver
+ echo 'opt=' >>mssql-driver
if test x$mssql_user_set = xyes; then
- echo "--user '$mssql_user'" >>db.options
- echo 'opt="$opt -U '"$mssql_user"'"' >>db-driver
+ echo "--user '$mssql_user'" >>mssql.options
+ echo 'opt="$opt -U '"$mssql_user"'"' >>mssql-driver
- echo "--password '$mssql_password'" >>db.options
- echo 'opt="$opt -P '"$mssql_password"'"' >>db-driver
+ echo "--password '$mssql_password'" >>mssql.options
+ echo 'opt="$opt -P '"$mssql_password"'"' >>mssql-driver
fi
if test x$mssql_db_set = xyes; then
- echo "--database '$mssql_db'" >>db.options
- echo 'opt="$opt -d '"$mssql_db"'"' >>db-driver
+ echo "--database '$mssql_db'" >>mssql.options
+ echo 'opt="$opt -d '"$mssql_db"'"' >>mssql-driver
fi
- echo "--server '$mssql_server'" >>db.options
- echo 'opt="$opt -S '"$mssql_server"'"' >>db-driver
+ echo "--server '$mssql_server'" >>mssql.options
+ echo 'opt="$opt -S '"$mssql_server"'"' >>mssql-driver
if test x$mssql_driver_set = xyes; then
- echo "--driver '$mssql_driver'" >>db.options
+ echo "--driver '$mssql_driver'" >>mssql.options
fi
- echo 'opt="$opt -x -r -b"' >>db-driver
- echo 'if test x$[]1 != x; then' >>db-driver
- echo " exec $mssql_client "'$opt -i $[]1' >>db-driver
- echo "else" >>db-driver
- echo " exec $mssql_client "'$opt' >>db-driver
- echo "fi" >>db-driver
+ echo 'opt="$opt -x -r -b"' >>mssql-driver
+ echo 'if test x$[]1 != x; then' >>mssql-driver
+ echo " exec $mssql_client "'$opt -i $[]1' >>mssql-driver
+ echo "else" >>mssql-driver
+ echo " exec $mssql_client "'$opt' >>mssql-driver
+ echo "fi" >>mssql-driver
- chmod +x db-driver
+ chmod +x mssql-driver
],
[
mssql_client="$mssql_client"
diff --git a/m4/mysql.m4 b/m4/mysql.m4
index 6efc2b7..fd41025 100644
--- a/m4/mysql.m4
+++ b/m4/mysql.m4
@@ -203,48 +203,48 @@ fi
#
AC_CONFIG_COMMANDS([mysql.options],
[
- rm -f db.options
- echo '#! /bin/sh' >db-driver
+ rm -f mysql.options
+ echo '#! /bin/sh' >mysql-driver
- echo 'opt=' >>db-driver
+ echo 'opt=' >>mysql-driver
if test x$mysql_user_set = xyes; then
- echo "--user '$mysql_user'" >>db.options
- echo 'opt="$opt --user='"$mysql_user"'"' >>db-driver
+ echo "--user '$mysql_user'" >>mysql.options
+ echo 'opt="$opt --user='"$mysql_user"'"' >>mysql-driver
fi
if test x$mysql_password_set = xyes; then
- echo "--password '$mysql_password'" >>db.options
- echo 'opt="$opt --password='"$mysql_password"'"' >>db-driver
+ echo "--password '$mysql_password'" >>mysql.options
+ echo 'opt="$opt --password='"$mysql_password"'"' >>mysql-driver
fi
if test x$mysql_db_set = xyes; then
- echo "--database '$mysql_db'" >>db.options
- echo 'opt="$opt --database='"$mysql_db"'"' >>db-driver
+ echo "--database '$mysql_db'" >>mysql.options
+ echo 'opt="$opt --database='"$mysql_db"'"' >>mysql-driver
fi
if test x$mysql_host_set = xyes; then
- echo "--host '$mysql_host'" >>db.options
- echo 'opt="$opt --host='"$mysql_host"'"' >>db-driver
+ echo "--host '$mysql_host'" >>mysql.options
+ echo 'opt="$opt --host='"$mysql_host"'"' >>mysql-driver
fi
if test x$mysql_port_set = xyes; then
- echo "--port '$mysql_port'" >>db.options
- echo 'opt="$opt --port='"$mysql_port"'"' >>db-driver
+ echo "--port '$mysql_port'" >>mysql.options
+ echo 'opt="$opt --port='"$mysql_port"'"' >>mysql-driver
fi
if test x$mysql_socket_set = xyes; then
- echo "--socket '$mysql_socket'" >>db.options
- echo 'opt="$opt --socket='"$mysql_socket"'"' >>db-driver
+ echo "--socket '$mysql_socket'" >>mysql.options
+ echo 'opt="$opt --socket='"$mysql_socket"'"' >>mysql-driver
fi
- echo 'if test x$[]1 != x; then' >>db-driver
- echo " exec $mysql_client "'$opt <$[]1' >>db-driver
- echo "else" >>db-driver
- echo " exec $mysql_client "'$opt' >>db-driver
- echo "fi" >>db-driver
+ echo 'if test x$[]1 != x; then' >>mysql-driver
+ echo " exec $mysql_client "'$opt <$[]1' >>mysql-driver
+ echo "else" >>mysql-driver
+ echo " exec $mysql_client "'$opt' >>mysql-driver
+ echo "fi" >>mysql-driver
- chmod +x db-driver
+ chmod +x mysql-driver
],
[
mysql_client="$mysql_client"
diff --git a/m4/oracle.m4 b/m4/oracle.m4
index 920e981..ba8b7d6 100644
--- a/m4/oracle.m4
+++ b/m4/oracle.m4
@@ -180,47 +180,47 @@ fi
#
AC_CONFIG_COMMANDS([oracle.options],
[
- rm -f db.options
- echo '#! /bin/sh' >db-driver
+ rm -f oracle.options
+ echo '#! /bin/sh' >oracle-driver
- echo 'conn_str=' >>db-driver
+ echo 'conn_str=' >>oracle-driver
if test x$oracle_user_set = xyes; then
- echo "--user '$oracle_user'" >>db.options
- echo 'conn_str="'"$oracle_user"'"' >>db-driver
+ echo "--user '$oracle_user'" >>oracle.options
+ echo 'conn_str="'"$oracle_user"'"' >>oracle-driver
fi
if test x$oracle_password_set = xyes; then
- echo "--password '$oracle_password'" >>db.options
- echo 'conn_str="$conn_str/'"$oracle_password"'"' >>db-driver
+ echo "--password '$oracle_password'" >>oracle.options
+ echo 'conn_str="$conn_str/'"$oracle_password"'"' >>oracle-driver
fi
if test x$oracle_host_set = xyes; then
- echo "--host '$oracle_host'" >>db.options
- echo 'conn_str="$conn_str@//'"$oracle_host"'"' >>db-driver
+ echo "--host '$oracle_host'" >>oracle.options
+ echo 'conn_str="$conn_str@//'"$oracle_host"'"' >>oracle-driver
if test x$oracle_port_set = xyes; then
- echo "--port '$oracle_port'" >>db.options
- echo 'conn_str="$conn_str:'"$oracle_port"'"' >>db-driver
+ echo "--port '$oracle_port'" >>oracle.options
+ echo 'conn_str="$conn_str:'"$oracle_port"'"' >>oracle-driver
fi
fi
if test x$oracle_service != x; then
if test x$oracle_host_set = xno; then
- echo 'conn_str="$conn_str@"' >>db-driver
+ echo 'conn_str="$conn_str@"' >>oracle-driver
fi
- echo "--service '$oracle_service'" >>db.options
- echo 'conn_str="$conn_str/'"$oracle_service"'"' >>db-driver
+ echo "--service '$oracle_service'" >>oracle.options
+ echo 'conn_str="$conn_str/'"$oracle_service"'"' >>oracle-driver
fi
- echo 'if test x$[]1 != x; then' >>db-driver
- echo " exec $oracle_client -L -S "'$conn_str @$[]1' >>db-driver
- echo "else" >>db-driver
- echo " exec $oracle_client -L -S "'$conn_str' >>db-driver
- echo "fi" >>db-driver
+ echo 'if test x$[]1 != x; then' >>oracle-driver
+ echo " exec $oracle_client -L -S "'$conn_str @$[]1' >>oracle-driver
+ echo "else" >>oracle-driver
+ echo " exec $oracle_client -L -S "'$conn_str' >>oracle-driver
+ echo "fi" >>oracle-driver
- chmod +x db-driver
+ chmod +x oracle-driver
],
[
oracle_client="$oracle_client"
diff --git a/m4/pgsql.m4 b/m4/pgsql.m4
index 0ee4a4c..bb3c26e 100644
--- a/m4/pgsql.m4
+++ b/m4/pgsql.m4
@@ -149,42 +149,42 @@ fi
#
AC_CONFIG_COMMANDS([pgsql.options],
[
- rm -f db.options
- echo '#! /bin/sh' >db-driver
+ rm -f pgsql.options
+ echo '#! /bin/sh' >pgsql-driver
- echo 'opt=' >>db-driver
+ echo 'opt=' >>pgsql-driver
if test x$pgsql_user_set = xyes; then
- echo "--username '$pgsql_user'" >>db.options
- echo 'opt="$opt --username='"$pgsql_user"'"' >>db-driver
+ echo "--username '$pgsql_user'" >>pgsql.options
+ echo 'opt="$opt --username='"$pgsql_user"'"' >>pgsql-driver
fi
if test x$pgsql_db_set = xyes; then
- echo "--dbname '$pgsql_db'" >>db.options
- echo 'opt="$opt --dbname='"$pgsql_db"'"' >>db-driver
+ echo "--dbname '$pgsql_db'" >>pgsql.options
+ echo 'opt="$opt --dbname='"$pgsql_db"'"' >>pgsql-driver
fi
if test x$pgsql_host_set = xyes; then
- echo "--host '$pgsql_host'" >>db.options
- echo 'opt="$opt --host='"$pgsql_host"'"' >>db-driver
+ echo "--host '$pgsql_host'" >>pgsql.options
+ echo 'opt="$opt --host='"$pgsql_host"'"' >>pgsql-driver
fi
if test x$pgsql_port_set = xyes; then
- echo "--port '$pgsql_port'" >>db.options
- echo 'opt="$opt --port='"$pgsql_port"'"' >>db-driver
+ echo "--port '$pgsql_port'" >>pgsql.options
+ echo 'opt="$opt --port='"$pgsql_port"'"' >>pgsql-driver
fi
- echo 'opt="$opt --quiet"' >>db-driver
- echo 'PGOPTIONS=--client-min-messages=warning' >>db-driver
- echo 'export PGOPTIONS' >>db-driver
+ echo 'opt="$opt --quiet"' >>pgsql-driver
+ echo 'PGOPTIONS=--client-min-messages=warning' >>pgsql-driver
+ echo 'export PGOPTIONS' >>pgsql-driver
- echo 'if test x$[]1 != x; then' >>db-driver
- echo " exec $pgsql_client "'$opt --set ON_ERROR_STOP=1 -f $[]1' >>db-driver
- echo "else" >>db-driver
- echo " exec $pgsql_client "'$opt' >>db-driver
- echo "fi" >>db-driver
+ echo 'if test x$[]1 != x; then' >>pgsql-driver
+ echo " exec $pgsql_client "'$opt --set ON_ERROR_STOP=1 -f $[]1' >>pgsql-driver
+ echo "else" >>pgsql-driver
+ echo " exec $pgsql_client "'$opt' >>pgsql-driver
+ echo "fi" >>pgsql-driver
- chmod +x db-driver
+ chmod +x pgsql-driver
],
[
pgsql_client="$pgsql_client"
diff --git a/m4/sqlite.m4 b/m4/sqlite.m4
index 9dc616a..247382e 100644
--- a/m4/sqlite.m4
+++ b/m4/sqlite.m4
@@ -46,10 +46,10 @@ fi
#
AC_CONFIG_COMMANDS([sqlite.options],
[
- rm -f db.options
+ rm -f sqlite.options
if test x$sqlite_db_set = xyes; then
- echo "--database '$sqlite_db'" >>db.options
+ echo "--database '$sqlite_db'" >>sqlite.options
fi
],
[
diff --git a/tester.in b/tester.in
index c9873d4..e2d5297 100755
--- a/tester.in
+++ b/tester.in
@@ -9,11 +9,14 @@
# data files, if any, are in $srcdir.
#
+db_driver="$top_builddir/@database@-driver"
+db_options="$top_builddir/@database@.options"
+
# Globbing returns files in alphabetic order.
#
for f in `echo test*.sql`; do
if test -f $f; then
- $top_builddir/db-driver $f
+ $db_driver $f
if test $? -ne 0; then
exit 1
@@ -21,10 +24,10 @@ for f in `echo test*.sql`; do
fi
done
-echo ./driver --options-file "$top_builddir/db.options"
+echo ./driver --options-file "$db_options"
if test -f "$srcdir/test.std"; then
- ./driver --options-file "$top_builddir/db.options" >test.out
+ ./driver --options-file "$db_options" >test.out
if test $? -ne 0; then
exit 1
@@ -35,5 +38,5 @@ if test -f "$srcdir/test.std"; then
rm -f test.out
exit $r
else
- ./driver --options-file "$top_builddir/db.options"
+ ./driver --options-file "$db_options"
fi