List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:September 23 2009 4:41am
Subject:bzr push into mysql-5.1-telco-7.1 branch (jonas:3022 to 3023)
View as plain text  
 3023 Jonas Oreland	2009-09-23 [merge]
      merge 70 to 71

    modified:
      storage/ndb/src/common/util/CMakeLists.txt
      storage/ndb/src/common/util/Parser.cpp
      unittest/unit.pl
 3022 Jonas Oreland	2009-09-22 [merge]
      merge 70 to 71

    modified:
      storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
      storage/ndb/test/ndbapi/testNdbApi.cpp
      storage/ndb/test/run-test/daily-basic-tests.txt
=== modified file 'storage/ndb/src/common/util/CMakeLists.txt'
--- a/storage/ndb/src/common/util/CMakeLists.txt	2009-07-03 14:55:42 +0000
+++ b/storage/ndb/src/common/util/CMakeLists.txt	2009-09-23 04:40:45 +0000
@@ -54,7 +54,7 @@ ADD_LIBRARY(ndbgeneral STATIC
             basestring_vsnprintf.c
             Bitmask.cpp
 )
-TARGET_LINK_LIBRARIES(ndbgeneral zlib)
+TARGET_LINK_LIBRARIES(ndbgeneral zlib mysys ws2_32)
 
 ADD_EXECUTABLE(BaseString-t BaseString.cpp)
 SET_TARGET_PROPERTIES(BaseString-t
@@ -66,3 +66,7 @@ SET_TARGET_PROPERTIES(Bitmask-t
                       PROPERTIES COMPILE_FLAGS "-DTEST_BITMASK")
 TARGET_LINK_LIBRARIES(Bitmask-t ndbgeneral)
 
+ADD_EXECUTABLE(Parser-t Parser.cpp)
+SET_TARGET_PROPERTIES(Parser-t
+                      PROPERTIES COMPILE_FLAGS "-DTEST_PARSER")
+TARGET_LINK_LIBRARIES(Parser-t ndbgeneral)

=== modified file 'storage/ndb/src/common/util/Parser.cpp'
--- a/storage/ndb/src/common/util/Parser.cpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/common/util/Parser.cpp	2009-09-23 02:13:25 +0000
@@ -122,11 +122,12 @@ trim(char * str){
 static
 bool
 split(char * buf, char ** name, char ** value){
-  
-  * value = strchr(buf, ':');
-  if(* value == 0)
-    * value = strchr(buf, '=');
 
+  for (*value=buf; **value; (*value)++) {
+    if (**value == ':' || **value == '=') {
+      break;
+    }
+  }
 
   if(* value == 0){
     return false;
@@ -357,3 +358,20 @@ ParserImpl::checkMandatory(Context* ctx,
 }
 
 template class Vector<const ParserRow<ParserImpl::Dummy>*>;
+
+#ifdef TEST_PARSER
+#include <NdbTap.hpp>
+
+TAPTEST(Parser)
+{
+  char *str, *name, *value;
+
+  //split modifies arg so dup
+  str = strdup("x=c:\\windows");
+  OK(split(str, &name, &value));
+  OK(!strcmp(name, "x"));
+  OK(!strcmp(value, "c:\\windows"));
+
+  return 1;
+}
+#endif

=== modified file 'unittest/unit.pl'
--- a/unittest/unit.pl	2009-05-29 10:05:41 +0000
+++ b/unittest/unit.pl	2009-09-22 17:37:35 +0000
@@ -15,7 +15,6 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
-use Test::Harness;
 use File::Find;
 use Getopt::Long;
 
@@ -38,10 +37,10 @@ unit - Run unit tests in directory
 =cut
 
 my $big= $ENV{'MYTAP_CONFIG'} eq 'big';
-
+my $opt_verbose;
 my $result = GetOptions (
   "big!"        => \$big,
-  "verbose!"    => \$Test::Harness::verbose,
+  "verbose!"    => \$opt_verbose,
 );
 
 $ENV{'MYTAP_CONFIG'} = $big ? 'big' : '';
@@ -61,6 +60,19 @@ Run all unit tests in the current direct
 
 =cut
 
+BEGIN {
+  # Test::Harness have been extensively rewritten in newer perl
+  # versions and is now just a backward compatibility wrapper
+  # (with a bug causing the HARNESS_PERL_SWITCHES to be mangled)
+  # Prefer to use TAP::Harness directly if available
+  if (eval "use TAP::Harness; 1") {
+    eval 'sub NEW_HARNESS { 1 }';
+    warn "using TAP::Harness";
+  } else {
+    eval "use Test::Harness; 1" or  die "couldn't find Test::Harness!";
+    eval 'sub NEW_HARNESS { 0 }';
+  }
+}
 
 sub _find_test_files (@) {
     my @dirs = @_;
@@ -72,6 +84,7 @@ sub _find_test_files (@) {
     return @files;
 }
 
+
 sub run_cmd (@) {
     my @files;
 
@@ -99,12 +112,22 @@ sub run_cmd (@) {
         push(@files, _find_test_files $name) if -d $name;
         push(@files, $name) if -f $name;
     }
-
     if (@files > 0) {
         # Removing the first './' from the file names
         foreach (@files) { s!^\./!! }
-        $ENV{'HARNESS_PERL_SWITCHES'} .= ' -e "exec @ARGV"';
-        runtests @files;
+
+	if (NEW_HARNESS())
+        {
+          my %args = ( exec => [ ], verbosity => $opt_verbose );
+          my $harness = TAP::Harness->new( \%args );
+          $harness->runtests(@files);
+        }
+	else
+	{
+	  $ENV{'HARNESS_VERBOSE'} =  $opt_verbose;
+          $ENV{'HARNESS_PERL_SWITCHES'} .= ' -e "exec @ARGV"';
+          runtests(@files);
+        }
     }
 }
 


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20090923044045-pskiy7h7aayo25ko.bundle
Thread
bzr push into mysql-5.1-telco-7.1 branch (jonas:3022 to 3023)Jonas Oreland23 Sep