| 1 |
--perl |
| 2 |
use strict; |
| 3 |
use IO::File; |
| 4 |
use lib "lib/"; |
| 5 |
use My::Platform; |
| 6 |
|
| 7 |
|
| 8 |
# |
| 9 |
# Looks for MySQL Connector/J JAR file in MTR_CLASSPATH |
| 10 |
# |
| 11 |
|
| 12 |
my $ok = 0; |
| 13 |
my $classpath = $ENV{'MTR_CLASSPATH'} || ''; |
| 14 |
my $vardir = $ENV{MYSQLTEST_VARDIR} or die "Need MYSQLTEST_VARDIR"; |
| 15 |
my $jar; |
| 16 |
my $notfound; |
| 17 |
my $sep = (IS_WINDOWS) ? ';' : ':'; |
| 18 |
|
| 19 |
|
| 20 |
# -- look for the Connctor/J jar file |
| 21 |
foreach $jar (split $sep, $classpath) { |
| 22 |
if($jar =~ m/mysql-connector/ && -f $jar) { |
| 23 |
$ok = 2; |
| 24 |
last; |
| 25 |
} |
| 26 |
elsif($jar =~ m/mysql-connector/) { |
| 27 |
$ok = 1; |
| 28 |
$notfound = $jar; |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
# -- write the result to the output file |
| 33 |
my $F = IO::File->new("$vardir/tmp/have_connectorj_result.inc", "w") or die; |
| 34 |
if($ok == 2) { |
| 35 |
print $F "--echo Found Connector/J JAR in MTR_CLASSPATH\n"; |
| 36 |
} |
| 37 |
elsif($ok == 1) { |
| 38 |
print $F "--let \$skip_test=1\n"; |
| 39 |
print $F "--let \$skip_reason=JAR file not found: \"$notfound\"\n"; |
| 40 |
} |
| 41 |
else { |
| 42 |
print $F "--let \$skip_test=1\n"; |
| 43 |
print $F "--let \$skip_reason=Please specify Connector/J JAR file in MTR_CLASSPATH env variable\n"; |
| 44 |
} |
| 45 |
|
| 46 |
$F->close(); |
| 47 |
|
| 48 |
EOF |
| 49 |
|
| 50 |
--source $MYSQLTEST_VARDIR/tmp/have_connectorj_result.inc |
| 51 |
--remove_file $MYSQLTEST_VARDIR/tmp/have_connectorj_result.inc |
| 52 |
|
| 53 |
# skip if connectorj not found |
| 54 |
if ($skip_test) { |
| 55 |
--skip $skip_reason |
| 56 |
} |