1
# Copyright (c) 2009,2010 Oracle and/or its affiliates. All rights reserved.
2
# Use is subject to license terms.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful, but
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
# General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18
# Do a simple run of scripts to see that they're sound
21
use base qw(Test::Unit::TestCase);
27
my $self = shift()->SUPER::new(@_);
28
# your state for fixture here
43
my $status = system("perl -MCarp=verbose gensql.pl --grammar=conf/examples/example.yy --dsn=dummy --queries=1");
45
$self->assert_equals(0, $status);
47
my $status = system("perl -MCarp=verbose gensql.pl --grammar=unit/testStack.yy --dsn=dummy --queries=5");
49
$self->assert_equals(0, $status);
56
my $status = system("perl -MCarp=verbose gendata.pl --spec=conf/examples/example.zz --dsn=dummy");
58
$self->assert_equals(0, $status);
61
sub test_gendata_old {
64
my $status = system("perl -MCarp=verbose gendata-old.pl --dsn=dummy");
66
$self->assert_equals(0, $status);
72
my $status = system("perl -MCarp=verbose gentest.pl --dsn=dummy --grammar=conf/examples/example.yy --threads=1 --queries=1");
74
$self->assert_equals(0, $status);
76
$status = system("perl -MCarp=verbose gentest.pl --dsn=dummy --grammar=conf/examples/example.yy --threads=1 --queries=1 --mask=10 --mask-level=2");
78
$self->assert_equals(0, $status);
82
if ($ENV{TEST_OUT_OF_SOURCE}) {
83
## runall does not work with out of source builds
84
say("test_runall skipped for out-of-source build");
87
my $portbase = $ENV{TEST_PORTBASE}>0?int($ENV{TEST_PORTBASE}):22120;
88
my $pb = int(($portbase - 10000) / 10);
90
## This test requires RQG_MYSQL_BASE to point to a in source Mysql database
91
if ($ENV{RQG_MYSQL_BASE}) {
92
$ENV{LD_LIBRARY_PATH}=join(":",map{"$ENV{RQG_MYSQL_BASE}".$_}("/libmysql/.libs","/libmysql","/lib/mysql"));
93
my $status = system("perl -MCarp=verbose ./runall.pl --mtr-build-thread=$pb --grammar=conf/examples/example.yy --gendata=conf/examples/example.zz --queries=3 --threads=3 --basedir=".$ENV{RQG_MYSQL_BASE});
94
$self->assert_equals(0, $status);
100
## This test requires RQG_MYSQL_BASE to point to a Mysql database (in source, out of source or installed)
101
my $portbase = 10 + ($ENV{TEST_PORTBASE}>0?int($ENV{TEST_PORTBASE}):22120);
102
my $pb = int(($portbase - 10000) / 10);
105
if ($ENV{RQG_MYSQL_BASE}) {
106
$ENV{LD_LIBRARY_PATH}=join(":",map{"$ENV{RQG_MYSQL_BASE}".$_}("/libmysql/.libs","/libmysql","/lib/mysql"));
107
my $status = system("perl -MCarp=verbose ./runall-new.pl --mtr-build-thread=$pb --grammar=conf/examples/example.yy --gendata=conf/examples/example.zz --queries=3 --threads=3 --basedir=".$ENV{RQG_MYSQL_BASE}." --vardir=".cwd()."/unit/tmp");
108
$self->assert_equals(0, $status);