MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
have_openjpa.inc
1 --perl
2 #
3 # Look for Apache OpenJPA library, if not found: skip test.
4 #
5 
6 use strict;
7 use IO::File;
8 use lib "lib/";
9 use My::Platform;
10 
11 my $ok = 0;
12 my $classpath = $ENV{'MTR_CLASSPATH'} || '';
13 my $vardir = $ENV{MYSQLTEST_VARDIR} or die "Need MYSQLTEST_VARDIR";
14 my $jar;
15 my $notfound;
16 my $sep = (IS_WINDOWS) ? ';' : ':';
17 
18 # -- look for the openjpa jar file
19 
20 foreach $jar (split $sep, $classpath) {
21  if($jar =~ m/openjpa/ && -f $jar) {
22  $ok = 2;
23  }
24  elsif($jar =~ m/openjpa/) {
25  $ok = 1;
26  $notfound = $jar;
27  }
28 }
29 
30 # -- write the result to the output file
31 my $F = IO::File->new("$vardir/tmp/have_openjpa_result.inc", 'w') or die;
32 
33 if($ok == 2) {
34  print $F "--echo Found clusterj-openjpa.jar in MTR_CLASSPATH\n"
35 }
36 elsif($ok == 1) {
37  print $F "--skip JAR file not found: \"$notfound\"\n";
38 }
39 else {
40  print $F "--skip Could not find Apache OpenJPA jar in MTR_CLASSPATH ($classpath)\n";
41 }
42 
43 $F->close();
44 
45 EOF
46 
47 --source $MYSQLTEST_VARDIR/tmp/have_openjpa_result.inc