~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/kewpie/randgen/unit/TestTT.pm

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; version 2 of the License.
 
6
#
 
7
# This program is distributed in the hope that it will be useful, but
 
8
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
10
# General Public License for more details.
 
11
#
 
12
# You should have received a copy of the GNU General Public License
 
13
# along with this program; if not, write to the Free Software
 
14
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
 
15
# USA
 
16
 
 
17
# Do a simple run of scripts to see that they're sound
 
18
#
 
19
package TestTT;
 
20
use base qw(Test::Unit::TestCase);
 
21
use lib 'lib';
 
22
use GenTest;
 
23
use Cwd;
 
24
 
 
25
sub new {
 
26
    my $self = shift()->SUPER::new(@_);
 
27
    # your state for fixture here
 
28
    return $self;
 
29
}
 
30
 
 
31
my $generator;
 
32
sub set_up {
 
33
}
 
34
 
 
35
sub tear_down {
 
36
    # clean up after test
 
37
    unlink "unit/test1.xml";
 
38
    unlink "unit/test2.xml";
 
39
    unlink "unit/foo1.log";
 
40
    unlink "unit/foo2.log";
 
41
    system("rm -r unit/example*");
 
42
}
 
43
 
 
44
sub test_xml_runall {
 
45
    my $portbase = $ENV{TEST_PORTBASE}>0?int($ENV{TEST_PORTBASE}):22120;
 
46
    my $pb = int(($portbase - 10000) / 10);
 
47
    my $self = shift;
 
48
    ## This test requires RQG_MYSQL_BASE to point to a in source Mysql database
 
49
    if ($ENV{RQG_MYSQL_BASE}) {
 
50
        $ENV{LD_LIBRARY_PATH}=join(":",map{"$ENV{RQG_MYSQL_BASE}".$_}("/libmysql/.libs","/libmysql","/lib/mysql"));
 
51
        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 --report-xml-tt --report-xml-tt-type=none  --xml-output=unit/test1.xml --logfile=unit/foo1.log --report-tt-logdir=unit --basedir=".$ENV{RQG_MYSQL_BASE});
 
52
        $self->assert_equals(0, $status);
 
53
    }
 
54
}
 
55
 
 
56
sub test_xml_runall_new {
 
57
    my $self = shift;
 
58
    ## This test requires RQG_MYSQL_BASE to point to a Mysql database (in source, out of source or installed)
 
59
    my $portbase = 10 + ($ENV{TEST_PORTBASE}>0?int($ENV{TEST_PORTBASE}):22120);
 
60
    my $pb = int(($portbase - 10000) / 10);
 
61
 
 
62
    
 
63
    if ($ENV{RQG_MYSQL_BASE}) {
 
64
        $ENV{LD_LIBRARY_PATH}=join(":",map{"$ENV{RQG_MYSQL_BASE}".$_}("/libmysql/.libs","/libmysql","/lib/mysql"));
 
65
        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 --report-xml-tt --report-xml-tt-type=none --xml-output=unit/test2.xml --logfile=unit/foo2.log --report-tt-logdir=unit --basedir=".$ENV{RQG_MYSQL_BASE}." --vardir=".cwd()."/unit/tmp");
 
66
        $self->assert_equals(0, $status);
 
67
    }
 
68
}
 
69
 
 
70
1;