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