summaryrefslogtreecommitdiff
path: root/test/windows
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-02-23 13:47:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-02-23 13:47:34 +0200
commit3278c862abfc4a6cb9c27cd9dcfce2b8f2b73910 (patch)
tree70fbfe7dbb27250cdad3ead628ce6b7c4ab7287e /test/windows
parentafc81e5cb09219770a8a5b8cd2855b45ece0a42a (diff)
Add Windows test scripts
Diffstat (limited to 'test/windows')
-rw-r--r--test/windows/README34
-rwxr-xr-xtest/windows/odb/all31
-rwxr-xr-xtest/windows/odb/build.bat118
-rw-r--r--test/windows/odb/default.options1
-rwxr-xr-xtest/windows/odb/mingw/build132
-rwxr-xr-xtest/windows/odb/mingw/unpack31
-rw-r--r--test/windows/odb/mysql-driver.bat47
-rw-r--r--test/windows/odb/mysql.options8
-rwxr-xr-xtest/windows/odb/setenv.bat15
-rwxr-xr-xtest/windows/odb/unpack45
10 files changed, 462 insertions, 0 deletions
diff --git a/test/windows/README b/test/windows/README
new file mode 100644
index 0000000..8efd025
--- /dev/null
+++ b/test/windows/README
@@ -0,0 +1,34 @@
+Assumptions:
+
+ 1. Root directory is c:\projects
+ 2. Cygwin is in c:\cygwin
+ 3. T:\pack contains the source packages and odb compiler binary for
+ Windows (drive T: is mapped to your /tmp directory).
+
+Steps:
+
+1. Copy odb\ to the root directory.
+
+2. Edit default.options, mysql-driver.bat and mysql.options to match
+ your setup.
+
+3. Run the 'unpack' script.
+
+4. Set up VC++ lib and include directories for the following:
+
+ mysql
+ mysql64
+ odb/libodb
+ odb/libodb-tracer
+ odb/libodb-mysql
+ odb/libodb-boost
+
+ And bin directory for
+
+ odb/bin/
+
+5. Adjust DEVENV variable in setenv.bat.
+
+6. Run the 'all' script:
+
+ ./all <vc-version> 2>&1 | tee all.log
diff --git a/test/windows/odb/all b/test/windows/odb/all
new file mode 100755
index 0000000..cef5a67
--- /dev/null
+++ b/test/windows/odb/all
@@ -0,0 +1,31 @@
+#! /usr/bin/env bash
+
+trap 'exit 1' ERR
+
+function error ()
+{
+ echo "$*" 1>&2
+}
+
+if [ "$1" = "" ]; then
+ echo vc++ version expected
+ exit 1
+fi
+
+action=$2
+if [ "$action" == "" ]; then
+ action=/Build
+fi
+
+databases="mysql"
+
+for d in $databases; do
+ cmd.exe /C "setenv.bat build.bat $d $1 $action"
+ cd odb-tests
+ cmd.exe /C "..\setenv.bat test.bat $d"
+ cd ..
+ cd odb-examples
+ cmd.exe /C "..\setenv.bat test.bat $d"
+ cd ..
+done
+
diff --git a/test/windows/odb/build.bat b/test/windows/odb/build.bat
new file mode 100755
index 0000000..b97cf62
--- /dev/null
+++ b/test/windows/odb/build.bat
@@ -0,0 +1,118 @@
+@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
+
+setlocal
+
+set "confs=Debug Release"
+set "plats=Win32 x64"
+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 %%d in (libodb libodb-tracer libodb-%1 libodb-boost) do (
+ for %%c in (%confs%) do (
+ for %%p in (%plats%) do (
+ call :run_build %%d/%%d-vc%vcver%.sln %%c %%p
+ )
+ )
+)
+
+if not "_%failed%_" == "__" goto error
+
+for %%c in (%confs%) do (
+ for %%p in (%plats%) do (
+ call :run_build odb-examples/examples-%1-vc%vcver%.sln %%c %%p
+ )
+)
+
+if not "_%failed%_" == "__" goto error
+
+for %%c in (%confs%) do (
+ for %%p in (%plats%) do (
+ call :run_build odb-examples/boost/boost-%1-vc%vcver%.sln %%c %%p
+ )
+)
+
+if not "_%failed%_" == "__" goto error
+
+cd odb-tests
+call build.bat %1 %2 %action%
+if errorlevel 1 (
+ cd ..
+ goto error
+)
+
+cd boost
+call build.bat %1 %2 %action%
+if errorlevel 1 (
+ cd ..\..
+ 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/test/windows/odb/default.options b/test/windows/odb/default.options
new file mode 100644
index 0000000..97bcb9e
--- /dev/null
+++ b/test/windows/odb/default.options
@@ -0,0 +1 @@
+-I C:\projects\boost
diff --git a/test/windows/odb/mingw/build b/test/windows/odb/mingw/build
new file mode 100755
index 0000000..979cc16
--- /dev/null
+++ b/test/windows/odb/mingw/build
@@ -0,0 +1,132 @@
+#! /usr/bin/env bash
+
+# Build ODB for mingw
+#
+# -rebuild
+# -test
+#
+trap 'exit 1' ERR
+
+function error ()
+{
+ echo "$*" 1>&2
+}
+
+function clean ()
+{
+ if [ -f $1/Makefile ]; then
+ make -C $1 distclean
+ fi
+}
+
+MYSQL=/c/projects/mysql-mingw32/bin/mysql.exe
+CPPFLAGS=-I/c/projects/mysql-mingw32/include
+LDFLAGS="-L/c/projects/mysql-mingw32/lib -Wl,--enable-auto-import"
+
+test=n
+rebuild=n
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ -rebuild)
+ rebuild=y
+ shift
+ ;;
+ -test)
+ test=y
+ shift
+ ;;
+ *)
+ error "unknown option: $1"
+ exit 1
+ ;;
+ esac
+done
+
+# Clean everything up if we are rebuilding.
+#
+if [ $rebuild = y ]; then
+ clean libodb
+ clean libodb-mysql
+ clean libodb-tracer
+ clean odb-tests
+ clean odb-examples
+fi
+
+# Build libodb
+#
+cd libodb
+
+if [ $rebuild = y ]; then
+ ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS"
+fi
+
+make
+cd ..
+
+# Build libodb-mysql
+#
+cd libodb-mysql
+
+if [ $rebuild = y ]; then
+ ./configure --with-libodb=../libodb CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS"
+fi
+
+make
+cd ..
+
+# Build libodb-tracer
+#
+cd libodb-tracer
+
+if [ $rebuild = y ]; then
+ ./configure --with-libodb=../libodb CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS"
+fi
+
+make
+cd ..
+
+# Build odb-tests
+#
+cd odb-tests
+
+if [ $rebuild = y ]; then
+ ./configure \
+--with-database=mysql \
+--with-libodb=../libodb \
+--with-libodb-mysql=../libodb-mysql \
+--with-libodb-tracer=../libodb-tracer \
+--with-mysql-host=192.168.0.5 \
+--with-mysql-client=$MYSQL \
+CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" DIFFFLAGS=-ubB
+fi
+
+make
+
+if [ $test = y ]; then
+ make check
+fi
+
+cd ..
+
+# Build odb-examples
+#
+cd odb-examples
+
+if [ $rebuild = y ]; then
+ ./configure \
+--with-database=mysql \
+--with-libodb=../libodb \
+--with-libodb-mysql=../libodb-mysql \
+--with-mysql-host=192.168.0.5 \
+--with-mysql-client=$MYSQL \
+CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS"
+fi
+
+make
+
+if [ $test = y ]; then
+ make check
+fi
+
+cd ..
diff --git a/test/windows/odb/mingw/unpack b/test/windows/odb/mingw/unpack
new file mode 100755
index 0000000..0b334b9
--- /dev/null
+++ b/test/windows/odb/mingw/unpack
@@ -0,0 +1,31 @@
+#! /usr/bin/env bash
+
+trap 'exit 1' ERR
+
+function error ()
+{
+ echo "$*" 1>&2
+}
+
+base=/t/pack
+
+rm -rf libodb libodb-mysql libodb-tracer odb-tests odb-examples
+
+v=`echo $base/libodb-?.*.zip | sed -e "s%$base/libodb-\(.*\).zip%\1%"`
+
+echo unpacking $v from $base
+
+unzip -q $base/libodb-$v.zip
+mv libodb-$v libodb
+
+unzip -q $base/libodb-tracer-$v.zip
+mv libodb-tracer-$v libodb-tracer
+
+unzip -q $base/libodb-mysql-$v.zip
+mv libodb-mysql-$v libodb-mysql
+
+unzip -q $base/odb-tests-$v.zip
+mv odb-tests-$v odb-tests
+
+unzip -q $base/odb-examples-$v.zip
+mv odb-examples-$v odb-examples
diff --git a/test/windows/odb/mysql-driver.bat b/test/windows/odb/mysql-driver.bat
new file mode 100644
index 0000000..357e211
--- /dev/null
+++ b/test/windows/odb/mysql-driver.bat
@@ -0,0 +1,47 @@
+@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.
+rem
+
+setlocal
+
+set "options=%MYSQL_OPTIONS%"
+set "options=%options% --user=odb_test"
+set "options=%options% --database=odb_test"
+rem set "options=%options% --password="
+set "options=%options% --host=192.168.0.X"
+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/test/windows/odb/mysql.options b/test/windows/odb/mysql.options
new file mode 100644
index 0000000..84a973c
--- /dev/null
+++ b/test/windows/odb/mysql.options
@@ -0,0 +1,8 @@
+#
+#
+--user 'odb_test'
+--database 'odb_test'
+# --password ''
+--host '192.168.0.X'
+# --port 0
+# --socket ''
diff --git a/test/windows/odb/setenv.bat b/test/windows/odb/setenv.bat
new file mode 100755
index 0000000..91ea40a
--- /dev/null
+++ b/test/windows/odb/setenv.bat
@@ -0,0 +1,15 @@
+@echo off
+
+set ODB=c:\projects\odb
+set MYSQL=c:\projects\mysql
+set MYSQL64=c:\projects\mysql64
+set "DIFF=c:\cygwin\bin\diff.exe -ubB"
+set "DEVENV=c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com"
+set PATH=%ODB%\odb-tests\libcommon\bin;%ODB%\libodb\bin;%ODB%\libodb-mysql\bin;%ODB%\libodb-tracer\bin;%ODB%\libodb-boost\bin;%MYSQL%\bin;%PATH%
+set PATH=%ODB%\odb-tests\libcommon\bin64;%ODB%\libodb\bin64;%ODB%\libodb-mysql\bin64;%ODB%\libodb-tracer\bin64;%ODB%\libodb-boost\bin64;%MYSQL64%\bin;%PATH%
+
+if "_%1_" == "__" goto end
+
+%1 %2 %3 %4 %5 %6 %7 %8 %9
+
+:end
diff --git a/test/windows/odb/unpack b/test/windows/odb/unpack
new file mode 100755
index 0000000..5aaf68f
--- /dev/null
+++ b/test/windows/odb/unpack
@@ -0,0 +1,45 @@
+#! /usr/bin/env bash
+
+trap 'exit 1' ERR
+
+function error ()
+{
+ echo "$*" 1>&2
+}
+
+base=/cygdrive/t/pack
+
+rm -rf libodb libodb-mysql libodb-tracer libodb-boost odb odb-tests odb-examples
+
+v=`echo $base/libodb-?.*.zip | sed -e "s%$base/libodb-\(.*\).zip%\1%"`
+
+echo unpacking $v from $base
+
+unzip -q $base/libodb-$v.zip
+mv libodb-$v libodb
+
+unzip -q $base/libodb-tracer-$v.zip
+mv libodb-tracer-$v libodb-tracer
+
+unzip -q $base/libodb-mysql-$v.zip
+mv libodb-mysql-$v libodb-mysql
+
+unzip -q $base/libodb-boost-$v.zip
+mv libodb-boost-$v libodb-boost
+
+unzip -q $base/odb-tests-$v.zip
+mv odb-tests-$v odb-tests
+
+unzip -q $base/odb-examples-$v.zip
+mv odb-examples-$v odb-examples
+
+unzip -q $base/odb-$v-i686-windows.zip
+mv odb-$v-i686-windows odb
+
+cp default.options odb/etc/odb/
+
+cp mysql.options odb-tests/
+cp mysql-driver.bat odb-tests/
+
+cp mysql.options odb-examples/
+cp mysql-driver.bat odb-examples/