From 66732b210c512b8dfe7e97d3ab6522cf3be72a72 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 10 Jul 2012 14:40:13 +0200 Subject: Add support for multiple database schema files Files are executed in alphabetic order. --- build/bootstrap.make | 5 ++++- tester.bat | 11 +++++++---- tester.in | 14 +++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/build/bootstrap.make b/build/bootstrap.make index 531d4f4..aba7532 100644 --- a/build/bootstrap.make +++ b/build/bootstrap.make @@ -47,8 +47,11 @@ endif # Database schema creation. # ifeq ($(filter $(db_id),sqlite),) +$(out_base)/.test: schema-extra = \ +$(call message,sql $$1,$(dcf_root)/db-driver $$1,$(src_base)/$1)$(literal_newline)$(literal_tab) $(out_base)/.test: schema = \ -$(call message,sql $$1,$(dcf_root)/db-driver $$1,$(out_base)/test.sql) +$(foreach s,$1,$(call schema-extra,$s))$(call \ +message,sql $$1,$(dcf_root)/db-driver $$1,$(out_base)/test.sql) endif # Dist setup. diff --git a/tester.bat b/tester.bat index f5b00f5..fdd408c 100644 --- a/tester.bat +++ b/tester.bat @@ -24,9 +24,13 @@ if "_%3_" == "_Win32_" ( set "dir=%3\%2" ) -if exist test.sql ( - call %topdir%\%1-driver.bat test.sql - if errorlevel 1 goto error +rem Globbing returns files in alphabetic order. +rem +if exist *.sql ( + for %%f in (*.sql) do ( + call %topdir%\%1-driver.bat %%f + if errorlevel 1 goto error + ) ) if exist test.std ( @@ -56,4 +60,3 @@ exit /b 1 :end endlocal - diff --git a/tester.in b/tester.in index c55c59a..84b77ad 100755 --- a/tester.in +++ b/tester.in @@ -9,13 +9,17 @@ # data files, if any, are in $srcdir. # -if test -f test.sql; then - $top_builddir/db-driver test.sql +# Globbing returns files in alphabetic order. +# +for f in `echo *.sql`; do + if test -f $f; then + $top_builddir/db-driver $f - if test $? -ne 0; then - exit 1 + if test $? -ne 0; then + exit 1 + fi fi -fi +done echo ./driver --options-file "$top_builddir/db.options" -- cgit v1.1