summaryrefslogtreecommitdiff
path: root/odb-tests/database-options.testscript
blob: 5a2c3ddb10f9822186946fd08937a2a478801d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# file      : database-options.testscript
# license   : GNU GPL v2; see accompanying LICENSE file

# For the enabled databases create the test driver option lists (*_options)
# for subsequent use in the tests. Also create the database-specific client
# option lists (*_client_options) and command lines (*_client_cmd) which can
# be used as a base for the data manipulation commands.
#
+if $mysql
   mysql_options = --user $config.odb_tests.mysql.user \
                   --database $config.odb_tests.mysql.database

   mysql_client_options = --user $config.odb_tests.mysql.user \
                          --database $config.odb_tests.mysql.database

   if $defined(config.odb_tests.mysql.passwd)
     mysql_options        += --password $config.odb_tests.mysql.passwd
     mysql_client_options += --password=$config.odb_tests.mysql.passwd
   end

   if $defined(config.odb_tests.mysql.host)
     mysql_options        += --host $config.odb_tests.mysql.host
     mysql_client_options += --host $config.odb_tests.mysql.host
   end

   if $defined(config.odb_tests.mysql.port)
     mysql_options        += --port $config.odb_tests.mysql.port
     mysql_client_options += --port $config.odb_tests.mysql.port
   end

   if $defined(config.odb_tests.mysql.socket)
     mysql_options        += --socket $config.odb_tests.mysql.socket
     mysql_client_options += --socket $config.odb_tests.mysql.socket
   end

   mysql_client_cmd = $path($mysql_client) $mysql_client_options
end

+if $sqlite
  sqlite_options = --database odb-test.db

  # Note that we currently don't manipulate the data using the sqlite3
  # utility. Thus, we don't create the sqlite client option list and command
  # line.
  #
end

+if $pgsql
   pgsql_options = --user $config.odb_tests.pgsql.user \
                   --database $config.odb_tests.pgsql.database

   pgsql_client_options = --quiet \
                          --set ON_ERROR_STOP=1 \
                          --username $config.odb_tests.pgsql.user \
                          --dbname $config.odb_tests.pgsql.database

  if $defined(config.odb_tests.pgsql.host)
    pgsql_options        += --host $config.odb_tests.pgsql.host
    pgsql_client_options += --host $config.odb_tests.pgsql.host
  end

  if $defined(config.odb_tests.pgsql.port)
    pgsql_options        += --port $config.odb_tests.pgsql.port
    pgsql_client_options += --port $config.odb_tests.pgsql.port
  end

  pgsql_client_cmd = $path($pgsql_client) $pgsql_client_options

  export PGOPTIONS=--client-min-messages=warning
end

+if $mssql
   mssql_options = --user $config.odb_tests.mssql.user \
                   --database $config.odb_tests.mssql.database

   mssql_client_options = -C -x -r 1 -b \
                          -U $config.odb_tests.mssql.user \
                          -d $config.odb_tests.mssql.database

   if $defined(config.odb_tests.mssql.passwd)
     mssql_options        += --password $config.odb_tests.mssql.passwd
     mssql_client_options += -P $config.odb_tests.mssql.passwd
   end

   if ($defined(config.odb_tests.mssql.host) || \
       $defined(config.odb_tests.mssql.port))
     mssql_server = \
       "tcp:($defined(config.odb_tests.mssql.host) ? $config.odb_tests.mssql.host : localhost)"

     if $defined(config.odb_tests.mssql.port)
       mssql_server = "$mssql_server,$config.odb_tests.mssql.port"
     end
   elif $defined(config.odb_tests.mssql.server)
     mssql_server = $config.odb_tests.mssql.server
   else
     mssql_server = [null]
   end

   if ($mssql_server != [null])
     mssql_options        += --server $mssql_server
     mssql_client_options += -S $mssql_server
   end

   if ($defined(config.odb_tests.mssql.driver)  && \
       $config.odb_tests.mssql.driver != [null] && \
       $config.odb_tests.mssql.driver != '')
     mssql_options += --driver $config.odb_tests.mssql.driver
   end

   mssql_client_cmd = $path($mssql_client) $mssql_client_options
end

# Set the default schema file name, which can be overridden by the subsequent
# tests in their own scopes.
#
schema = test