aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.bat102
-rw-r--r--build/bootstrap.make2
-rw-r--r--common/makefile3
-rw-r--r--common/test.bat46
-rw-r--r--makefile9
-rw-r--r--mysql-driver.bat48
-rw-r--r--mysql.options9
-rw-r--r--mysql/makefile4
-rw-r--r--mysql/test.bat70
-rw-r--r--test.bat55
-rw-r--r--tester.bat44
-rw-r--r--tracer/makefile4
-rw-r--r--tracer/test.bat69
13 files changed, 412 insertions, 53 deletions
diff --git a/build.bat b/build.bat
new file mode 100644
index 0000000..a59c8bc
--- /dev/null
+++ b/build.bat
@@ -0,0 +1,102 @@
+@echo off
+rem file : build.bat
+rem author : Boris Kolpackov <boris@codesynthesis.com>
+rem copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+rem license : GNU GPL v2; see accompanying LICENSE file
+
+rem
+rem build.bat database vc-version [/Build|/Clean|/Rebuild]
+rem
+rem Build tests using the VC++ batch mode compilation.
+rem
+
+setlocal
+
+set "confs=__path__(configurations)"
+set "plats=__path__(platforms)"
+set "failed="
+
+if "_%1_" == "__" (
+ echo no database specified
+ goto usage
+)
+
+if "_%2_" == "__" (
+ echo no VC++ version specified
+ goto usage
+)
+
+if "_%2_" == "_9_" set "vcver=9"
+if "_%2_" == "_10_" set "vcver=10"
+
+if "_%vcver%_" == "__" (
+ echo unknown VC++ version %2
+ goto usage
+)
+
+set "action=%3"
+if "_%action%_" == "__" set "action=/Build"
+
+set "devenv=%DEVENV%"
+if "_%devenv%_" == "__" set "devenv=devenv.com"
+
+goto start
+
+rem
+rem %1 - solution name
+rem %2 - configuration to build
+rem %3 - platform to build
+rem
+:run_build
+ echo.
+ echo building %1 %3 %2
+ "%devenv%" %1 %action% "%2|%3" 2>&1
+ if errorlevel 1 set "failed=%failed% %1\%3\%2"
+goto :eof
+
+:start
+
+for %%c in (%confs%) do (
+ for %%p in (%plats%) do (
+ call :run_build libcommon/libcommon-%1-vc%vcver%.sln %%c %%p
+ )
+)
+
+for %%d in (tracer %1) do (
+ for %%c in (%confs%) do (
+ for %%p in (%plats%) do (
+ call :run_build %%d/%%d-vc%vcver%.sln %%c %%p
+ )
+ )
+)
+
+for %%c in (%confs%) do (
+ for %%p in (%plats%) do (
+ call :run_build common/common-%1-vc%vcver%.sln %%c %%p
+ )
+)
+
+if not "_%failed%_" == "__" goto error
+
+echo.
+echo ALL BUILDS SUCCEEDED
+echo.
+goto end
+
+:usage
+echo.
+echo usage: build.bat database vc-version [action]
+echo valid actions are /Build, /Clean, and /Rebuild
+echo.
+
+:error
+if not "_%failed%_" == "__" (
+ echo.
+ for %%t in (%failed%) do echo FAILED: %%t
+ echo.
+)
+endlocal
+exit /b 1
+
+:end
+endlocal
diff --git a/build/bootstrap.make b/build/bootstrap.make
index 8cff938..35e7a07 100644
--- a/build/bootstrap.make
+++ b/build/bootstrap.make
@@ -55,7 +55,7 @@ ifeq ($(dist_prefix),)
$(error dist_prefix is not set)
endif
-databases := mysql pgsql
+databases := mysql
$(dist): databases := $(databases)
# $1 project template without the -vcN.vc[x]proj suffix.
diff --git a/common/makefile b/common/makefile
index f575f74..346b8f8 100644
--- a/common/makefile
+++ b/common/makefile
@@ -28,7 +28,8 @@ name := $(notdir $(src_base))
$(dist): name := $(name)
$(dist): export dirs := $(tests)
$(dist): export thread_dirs := $(thread_tests)
-$(dist): export extra_dist := $(call vc9slns,$(name)) $(call vc10slns,$(name))
+$(dist): export extra_dist := test.bat $(call vc9slns,$(name)) \
+$(call vc10slns,$(name))
$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_tests)))
$(call meta-automake)
$(call meta-vc9slns,$(name))
diff --git a/common/test.bat b/common/test.bat
index 678e678..74e935d 100644
--- a/common/test.bat
+++ b/common/test.bat
@@ -8,18 +8,37 @@ setlocal
set "tests=__path__(dirs) __path__(thread_dirs)"
set "confs=__path__(configurations)"
+set "plats=__path__(platforms)"
set "topdir=__path__(topdir)\.."
+set "failed="
+
+if "_%1_" == "__" (
+ echo no database specified
+ goto usage
+)
goto start
+rem
+rem %1 - test directory
+rem %2 - configuration
+rem %3 - platform
+rem %4 - database
+rem
:run_test
cd %1
- if exist %2\driver.exe (
- echo %1\%2
- call %topdir%\tester.bat tracer %2
+ if "_%3_" == "_Win32_" (
+ set "dir=%2"
+ ) else (
+ set "dir=%3\%2"
+ )
+
+ if exist %dir%\driver.exe (
+ echo %1\%3\%2
+ call %topdir%\tester.bat %4 %2 %3
if errorlevel 1 (
- set "failed=%failed% %1\%2"
+ set "failed=%failed% %1\%3\%2"
)
)
@@ -30,19 +49,32 @@ goto :eof
for %%t in (%tests%) do (
for %%c in (%confs%) do (
- call :run_test %%t %%c
+ for %%p in (%plats%) do (
+ call :run_test %%t %%c %%p %1
+ )
)
)
if not "_%failed%_" == "__" goto error
+echo.
echo ALL TESTS PASSED
+echo.
goto end
+:usage
+echo.
+echo usage: test.bat database
+echo.
+
:error
-for %%t in (%failed%) do echo FAILED: %%t
+if not "_%failed%_" == "__" (
+ echo.
+ for %%t in (%failed%) do echo FAILED: %%t
+ echo.
+)
+endlocal
exit /b 1
-goto end
:end
endlocal
diff --git a/makefile b/makefile
index 213bab2..9748e4e 100644
--- a/makefile
+++ b/makefile
@@ -19,22 +19,25 @@ clean := $(out_base)/.clean
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs)))
-$(dist): data_dist := GPLv2 LICENSE README version tester.bat
+$(dist): data_dist := GPLv2 LICENSE README version test.bat tester.bat \
+mysql-driver.bat mysql.options
$(dist): exec_dist := bootstrap tester.in
-$(dist): export extra_dist := $(data_dist) $(exec_dist)
+$(dist): export extra_dist := $(data_dist) $(exec_dist) build.bat
$(dist): export version = $(shell cat $(src_root)/version)
$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_dirs)))
$(call dist-data,$(data_dist))
$(call dist-exec,$(exec_dist))
$(call dist-dir,m4)
+ $(call meta-vctest,tracer/tracer-vc10.sln,build.bat)
$(call meta-automake)
- $(call meta-autoconf)
+ $(call meta-autoconf)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(dirs)))
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_dirs)))
$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/vctest.make)
$(call include,$(bld_root)/meta/automake.make)
$(call include,$(bld_root)/meta/autoconf.make)
diff --git a/mysql-driver.bat b/mysql-driver.bat
new file mode 100644
index 0000000..f246e7b
--- /dev/null
+++ b/mysql-driver.bat
@@ -0,0 +1,48 @@
+@echo off
+rem file : mysql-driver.bat
+rem author : Boris Kolpackov <boris@codesynthesis.com>
+rem copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+rem license : GNU GPL v2; see accompanying LICENSE file
+
+rem
+rem mysql-driver.bat sql-file
+rem
+rem Run the mysql client on the SQL file specified. Adjust the
+rem option below to match your MySQL setup.
+rem
+
+setlocal
+
+set "options=%MYSQL_OPTIONS%"
+set "options=%options% --user=odb_test"
+set "options=%options% --database=odb_test"
+rem set "options=%options% --password="
+rem set "options=%options% --host="
+rem set "options=%options% --post="
+rem set "options=%options% --socket="
+
+set "mysql=%MYSQL_CLIENT%"
+
+if "_%mysql%_" == "__" set "mysql=mysql"
+
+if "_%1_" == "__" (
+ echo no sql file specified
+ goto usage
+)
+
+%mysql% %options% < %1
+
+if errorlevel 1 goto error
+goto end
+
+:usage
+echo.
+echo usage: mysql-driver.bat sql-file
+echo.
+
+:error
+endlocal
+exit /b 1
+
+:end
+endlocal
diff --git a/mysql.options b/mysql.options
new file mode 100644
index 0000000..54fc174
--- /dev/null
+++ b/mysql.options
@@ -0,0 +1,9 @@
+# Sample MySQL options file used to run the tests. Adjust to
+# match your MySQL setup.
+#
+--user 'odb_test'
+--db-name 'odb_test'
+# --password ''
+# --host ''
+# --port 0
+# --socket ''
diff --git a/mysql/makefile b/mysql/makefile
index 4b94e4c..fe6579e 100644
--- a/mysql/makefile
+++ b/mysql/makefile
@@ -19,12 +19,12 @@ $(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := $(notdir $(src_base))
$(dist): export dirs := $(tests)
-$(dist): export extra_dist := $(name)-vc9.sln $(name)-vc10.sln tests.bat
+$(dist): export extra_dist := $(name)-vc9.sln $(name)-vc10.sln test.bat
$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(tests)))
$(call meta-automake)
$(call meta-vc9sln,$(name)-vc9.sln)
$(call meta-vc10sln,$(name)-vc10.sln)
- $(call meta-vctest,$(name)-vc10.sln,$(src_root)/test.bat)
+ $(call meta-vctest,$(name)-vc10.sln,test.bat)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests)))
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests)))
diff --git a/mysql/test.bat b/mysql/test.bat
new file mode 100644
index 0000000..694eef8
--- /dev/null
+++ b/mysql/test.bat
@@ -0,0 +1,70 @@
+@echo off
+rem file : mysql/test.bat
+rem author : Boris Kolpackov <boris@codesynthesis.com>
+rem copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+rem license : GNU GPL v2; see accompanying LICENSE file
+
+setlocal
+
+set "tests=__path__(dirs)"
+set "confs=__path__(configurations)"
+set "plats=__path__(platforms)"
+set "topdir=__path__(topdir)\.."
+set "PATH=__path__(topdir)\libcommon\bin64;__path__(topdir)\libcommon\bin;%PATH%"
+set "failed="
+
+goto start
+
+rem
+rem %1 - test directory
+rem %2 - configuration
+rem %3 - platform
+rem
+:run_test
+ cd %1
+
+ if "_%3_" == "_Win32_" (
+ set "dir=%2"
+ ) else (
+ set "dir=%3\%2"
+ )
+
+ if exist %dir%\driver.exe (
+ echo %1\%3\%2
+ call %topdir%\tester.bat mysql %2 %3
+ if errorlevel 1 (
+ set "failed=%failed% %1\%3\%2"
+ )
+ )
+
+ cd ..
+goto :eof
+
+:start
+
+for %%t in (%tests%) do (
+ for %%c in (%confs%) do (
+ for %%p in (%plats%) do (
+ call :run_test %%t %%c %%p
+ )
+ )
+)
+
+if not "_%failed%_" == "__" goto error
+
+echo.
+echo ALL TESTS PASSED
+echo.
+goto end
+
+:error
+if not "_%failed%_" == "__" (
+ echo.
+ for %%t in (%failed%) do echo FAILED: %%t
+ echo.
+)
+endlocal
+exit /b 1
+
+:end
+endlocal
diff --git a/test.bat b/test.bat
index 9c72b2d..9d601cc 100644
--- a/test.bat
+++ b/test.bat
@@ -4,45 +4,64 @@ rem author : Boris Kolpackov <boris@codesynthesis.com>
rem copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
rem license : GNU GPL v2; see accompanying LICENSE file
+rem
+rem test.bat database
+rem
+rem Run tests built with VC++.
+rem
+
setlocal
-set "tests=__path__(dirs)"
-set "confs=__path__(configurations)"
-set "topdir=__path__(topdir)\.."
+set "failed="
+
+if "_%1_" == "__" (
+ echo no database specified
+ goto usage
+)
+
goto start
+rem
+rem %1 - directory
+rem %2 - database
+rem
:run_test
+ echo.
+ echo testing %1
+ echo.
cd %1
-
- if exist %2\driver.exe (
- echo %1\%2
- call %topdir%\tester.bat tracer %2
- if errorlevel 1 (
- set "failed=%failed% %1\%2"
- )
- )
-
+ call test.bat %2
+ if errorlevel 1 set "failed=%failed% %1"
cd ..
goto :eof
:start
-for %%t in (%tests%) do (
- for %%c in (%confs%) do (
- call :run_test %%t %%c
- )
+for %%d in (tracer common %1) do (
+ call :run_test %%d %1
)
if not "_%failed%_" == "__" goto error
+echo.
echo ALL TESTS PASSED
+echo.
goto end
+:usage
+echo.
+echo usage: test.bat database
+echo.
+
:error
-for %%t in (%failed%) do echo FAILED: %%t
+if not "_%failed%_" == "__" (
+ echo.
+ for %%t in (%failed%) do echo FAILED: %%t
+ echo.
+)
+endlocal
exit /b 1
-goto end
:end
endlocal
diff --git a/tester.bat b/tester.bat
index 9d812ac..fab0de2 100644
--- a/tester.bat
+++ b/tester.bat
@@ -4,51 +4,57 @@ rem author : Boris Kolpackov <boris@codesynthesis.com>
rem copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
rem license : GNU GPL v2; see accompanying LICENSE file
+rem
rem Run an ODB test. The test directory is the current directory.
-rem %1 database id, for example, mysql
-rem %2 configuration, for example, Debug or x64/Debug
+rem
+rem %1 database
+rem %2 configuration, for example, Debug or Release
+rem %3 platform, for example Win32 or x64
rem topdir variable containing the path to top project directory
+rem
-rem clear errorlevel
-rem setlocal & endlocal
+setlocal
-rem echo %1
-rem echo %2
-rem echo "%topdir%"
+set "PATH=%topdir%\libcommon\bin64;%topdir%\libcommon\bin;%PATH%"
if "_%DIFF%_" == "__" set DIFF=fc
+if "_%3_" == "_Win32_" (
+ set "dir=%2"
+) else (
+ set "dir=%3\%2"
+)
+
if exist test.sql (
- %topdir%\%1-driver test.sql
+ call %topdir%\%1-driver.bat test.sql
if errorlevel 1 goto error
)
-rem echo %2\driver.exe --options-file %topdir%\%1.options
-
if exist test.std (
- %2\driver.exe --options-file %topdir%\%1.options >test.out
+ %dir%\driver.exe --options-file %topdir%\%1.options >test.out
if errorlevel 1 goto error
%DIFF% test.std test.out
-
+
if errorlevel 1 (
del /f test.out
goto error
- )
-
- del /f test.out
+ )
+
+ del /f test.out
goto end
-
+
) else (
- %2\driver.exe --options-file %topdir%\%1.options
+ %dir%\driver.exe --options-file %topdir%\%1.options
if errorlevel 1 goto error
)
goto end
-
:error
+endlocal
exit /b 1
-goto end
:end
+endlocal
+
diff --git a/tracer/makefile b/tracer/makefile
index 3d40a9a..3e94d91 100644
--- a/tracer/makefile
+++ b/tracer/makefile
@@ -20,12 +20,12 @@ $(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := $(notdir $(src_base))
$(dist): export dirs := $(tests)
-$(dist): export extra_dist := $(name)-vc9.sln $(name)-vc10.sln tests.bat
+$(dist): export extra_dist := $(name)-vc9.sln $(name)-vc10.sln test.bat
$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(tests)))
$(call meta-automake)
$(call meta-vc9sln,$(name)-vc9.sln)
$(call meta-vc10sln,$(name)-vc10.sln)
- $(call meta-vctest,$(name)-vc10.sln,$(src_root)/test.bat)
+ $(call meta-vctest,$(name)-vc10.sln,test.bat)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests)))
diff --git a/tracer/test.bat b/tracer/test.bat
new file mode 100644
index 0000000..4c04576
--- /dev/null
+++ b/tracer/test.bat
@@ -0,0 +1,69 @@
+@echo off
+rem file : tracer/test.bat
+rem author : Boris Kolpackov <boris@codesynthesis.com>
+rem copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+rem license : GNU GPL v2; see accompanying LICENSE file
+
+setlocal
+
+set "tests=__path__(dirs)"
+set "confs=__path__(configurations)"
+set "plats=__path__(platforms)"
+set "topdir=__path__(topdir)\.."
+set "failed="
+
+goto start
+
+rem
+rem %1 - test directory
+rem %2 - configuration
+rem %3 - platform
+rem
+:run_test
+ cd %1
+
+ if "_%3_" == "_Win32_" (
+ set "dir=%2"
+ ) else (
+ set "dir=%3\%2"
+ )
+
+ if exist %dir%\driver.exe (
+ echo %1\%3\%2
+ call %topdir%\tester.bat tracer %2 %3
+ if errorlevel 1 (
+ set "failed=%failed% %1\%3\%2"
+ )
+ )
+
+ cd ..
+goto :eof
+
+:start
+
+for %%t in (%tests%) do (
+ for %%c in (%confs%) do (
+ for %%p in (%plats%) do (
+ call :run_test %%t %%c %%p
+ )
+ )
+)
+
+if not "_%failed%_" == "__" goto error
+
+echo.
+echo ALL TESTS PASSED
+echo.
+goto end
+
+:error
+if not "_%failed%_" == "__" (
+ echo.
+ for %%t in (%failed%) do echo FAILED: %%t
+ echo.
+)
+endlocal
+exit /b 1
+
+:end
+endlocal