File: innodb_plugin_install.sb.pl

package info (click to toggle)
mysql-sandbox 3.2.05-1.1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 916 kB
  • sloc: perl: 9,878; sh: 191; makefile: 8
file content (150 lines) | stat: -rw-r--r-- 4,658 bytes parent folder | download | duplicates (2)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Test for Innodb plugin installation
#
#
my $TEST_VERSION = $ENV{TEST_VERSION};
my ($bare_version, $version) = get_bare_version ($TEST_VERSION);

my $plugindir = $ENV{SB_PLUGIN_DIR} 
    or die "expected environment variable \$SB_PLUGIN_DIR not set\n";

my %plugin_version = (
    '5.1.40' => '1.0.4',
    '5.1.41' => '1.0.5',
    '5.1.42' => '1.0.6',
    '5.1.43' => '1.0.6',
    '5.1.44' => '1.0.6',
    '5.1.45' => '1.0.6',
    '5.1.45' => '1.0.6',
    '5.1.46' => '1.0.7',
    '5.1.47' => '1.0.8',
    '5.1.48' => '1.0.9',
    '5.1.57' => '1.0.16',
    '5.1.63' => '1.0.17',
    '5.1.73' => '5.1.73',
);

my $skip_tests=0;

unless (defined $plugin_version{$TEST_VERSION})
{
    warn "# No plugin info found for version $TEST_VERSION\n";
    $plugin_version{$TEST_VERSION} = "<missing>";
    $skip_tests=1;
}

my @test_sb = (
    { 
        type        => 'exec',
        command     => "make_sandbox $TEST_VERSION -- --no_confirm "
                        . "--sandbox_directory=single_server",
        expected    => "sandbox server started",
        msg         => "single server started",
    },
    {
        type        => 'exec',
        command     => "make_replication_sandbox "
                       . "--replication_directory=group_server $TEST_VERSION ",
        expected    => 'replication directory installed',
        msg         => 'group directory started',
    },
    {
        type        => 'exec',
        command     => "sbtool -o plugin "
                       . " --plugin=innodb"
                       . " -s $sandbox_home/single_server ",
        expected    => ['innodb_version',  $plugin_version{$TEST_VERSION}],
        msg         => 'innodb plugin installed on single_server',
    },
    {
        type        => 'sql',
        path        => "$sandbox_home/single_server",
        query       => "create table test.t1 (i int) engine=innodb "
                       . "ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;"
                       . " show create table test.t1 ",
        expected    => ['innodb', 'compressed'],
        msg         => 'innodb plugin working on single_server',
    },
    {
        type        => 'exec',
        command     => "sbtool -o plugin "
                       . " --plugin=innodb"
                       . " -s $sandbox_home/group_server ",
        expected    => ['innodb_version', $plugin_version{$TEST_VERSION} ],
        msg         => 'innodb plugin installed on group_server',
    },
    {
        type        => 'sql',
        path        => "$sandbox_home/group_server/master",
        query       => "create table test.t1 (i int) engine=innodb "
                       . "ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;"
                       . " show create table test.t1 ",
        expected    => ['innodb', 'compressed'],
        msg         => 'innodb plugin working on group_server/master',
    },
    {   type => 'sleep', how_much => 2},
    {
        type        => 'sql',
        path        => "$sandbox_home/group_server/node1",
        query       => " show create table test.t1 ",
        expected    => ['innodb', 'compressed'],
        msg         => 'innodb plugin working on group_server/node1',
    },
    {
        type        => 'sql',
        path        => "$sandbox_home/group_server/node2",
        query       => " show create table test.t1 ",
        expected    => ['innodb', 'compressed'],
        msg         => 'innodb plugin working on group_server/node2',
    },
    { 
        type        => 'exec',
        command     => "$sandbox_home/single_server/stop",
        expected    => "ok",
        msg         => "single server stopped",
    },
    { 
        type        => 'exec',
        command     => "$sandbox_home/group_server/stop_all",
        expected    => "ok",
        msg         => "group server stopped",
    },
  
);

for my $test (@test_sb) {

    if ($skip_tests)
    {
        my $msg = $test->{msg} || '';
        my $expected = $test->{expected} || '';
        if ($expected)
        {
            if (ref $expected)
            {
                for my $e (@$expected)
                {
                    print "ok - skipped - $msg ($e)\n";
                }
            }
            else
            {
                print "ok - skipped - $msg ($expected)\n";
            }
        }
    }
    else
    {
        if ($test->{type} eq 'exec') {
            ok_exec( $test);
        }
        elsif ($test->{type} eq 'sql') {
            ok_sql($test);
        }
        elsif ($test->{type} eq 'sleep') {
            sleep($test->{how_much} || 1 );
        }
        else {
            die "unrecognized type\n";
        }
    }
}