~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to pb2gentest.pl

pb2gentest.pl: Fixed setting of MTR_BUILD_THREAD on Windows (multiple commands on single command line). Created convenience variable for checking if we are on Windows OS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
use lib 'lib';
2
2
use lib "$ENV{RQG_HOME}/lib";
3
3
 
4
 
 
5
4
use strict;
6
5
use Cwd;
7
6
use DBI;
19
18
$| = 1;
20
19
 
21
20
#
22
 
# Prepare ENV variables
 
21
# Check OS. Windows and Unix/Linux are too different.
23
22
#
24
 
 
 
23
my $windowsOS;
25
24
if (
26
25
        ($^O eq 'MSWin32') ||
27
26
        ($^O eq 'MSWin64')
28
27
) {
 
28
        $windowsOS = 'true';
 
29
}
 
30
 
 
31
#
 
32
# Prepare ENV variables
 
33
#
 
34
 
 
35
if ($windowsOS) {
29
36
        # For tail and for cdb
30
37
        $ENV{PATH} = 'G:\pb2\scripts\randgen\bin;G:\pb2\scripts\bin;C:\Program Files\Debugging Tools for Windows (x86);'.$ENV{PATH};
31
38
        $ENV{_NT_SYMBOL_PATH} = 'srv*c:\\cdb_symbols*http://msdl.microsoft.com/download/symbols;cache*c:\\cdb_symbols';
116
123
 
117
124
print localtime()." [$$] Information on the host system:\n";
118
125
system("hostname");
 
126
print("tree=   $tree\n");
 
127
print("test=   $test\n");
 
128
print("vardir= $vardir\n");
119
129
 
120
130
#print localtime()." [$$] Information on Random Query Generator version:\n";
121
131
#system("bzr parent");
145
155
if (not defined $port_range_id) {
146
156
        print("# Unable to get port base id from pb2 database. Picking a random one...\n");
147
157
        $port_range_id = pick_random_port_range_id();
148
 
        print("# MTR_BUILD_THREAD=$port_range_id\n");
149
158
}
 
159
print("MTR_BUILD_THREAD=$port_range_id\n");
150
160
 
151
161
my $cwd = cwd();
152
162
 
370
380
        # File name extension for plugins varies. Using .ddl for Windows and .so for others (*nix).
371
381
        # TODO: If plugins are used for more tests, generalize e.g. into a variable for the file extension only.
372
382
        my $plugins;
373
 
        if (    ($^O eq 'MSWin32') ||
374
 
                ($^O eq 'MSWin64')
375
 
        ) {
 
383
        if ($windowsOS) {
376
384
                $plugins = 'rpl_semi_sync_master=libsemisync_master.dll:rpl_semi_sync_slave=libsemisync_slave.dll';
377
385
 
378
386
                # We are on Windows OS, but the feature (semisynchroneous replication (plugins))
528
536
$command = "perl runall.pl --basedir=\"$basedir\" --mysqld=--loose-innodb-lock-wait-timeout=5 --mysqld=--table-lock-wait-timeout=5 --mysqld=--skip-safemalloc ".$command;
529
537
 
530
538
# Add env variable to specify unique port range to use to avoid conflicts.
531
 
$command = "MTR_BUILD_THREAD=$port_range_id ".$command;
 
539
if ($windowsOS) {
 
540
        $command = "set MTR_BUILD_THREAD=$port_range_id && ".$command;
 
541
} else {
 
542
        $command = "MTR_BUILD_THREAD=$port_range_id ".$command;
 
543
}
532
544
 
533
545
$command =~ s{[\r\n\t]}{ }sgio;
534
546
my $command_result = system($command);
535
547
 
536
 
if (
537
 
        ($^O ne 'MSWin32') &&
538
 
        ($^O ne 'MSWin64')
539
 
) {
 
548
if ($windowsOS) {
540
549
        system("killall -15 mysqld");
541
550
        system("ps -A | grep mysqld | awk -F' ' '{ print \$1 }' | xargs kill -15");
542
551
        sleep(5);