List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:October 3 2011 8:48am
Subject:bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4565 to 4566)
View as plain text  
 4566 Jonas Oreland	2011-10-03
      ndb - 1) add search paths for atrt (since make install is different in 5.5) 2) ignore empty host names

    modified:
      storage/ndb/test/run-test/atrt.hpp
      storage/ndb/test/run-test/files.cpp
      storage/ndb/test/run-test/main.cpp
      storage/ndb/test/run-test/setup.cpp
 4565 Jonas Oreland	2011-10-03
      ndb - add missing Dbdict pool to list

    modified:
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
=== modified file 'storage/ndb/test/run-test/atrt.hpp'
--- a/storage/ndb/test/run-test/atrt.hpp	2011-06-30 15:59:25 +0000
+++ b/storage/ndb/test/run-test/atrt.hpp	2011-10-03 08:46:52 +0000
@@ -190,6 +190,19 @@ extern int          g_default_ports;
 
 extern const char * g_clusters;
 
+/**
+ * Since binaries move location between 5.1 and 5.5
+ *   we keep full path to them here
+ */
+char * find_bin_path(const char * basename);
+extern const char * g_ndb_mgmd_bin_path;
+extern const char * g_ndbd_bin_path;
+extern const char * g_ndbmtd_bin_path;
+extern const char * g_mysqld_bin_path;
+extern const char * g_mysql_install_db_bin_path;
+
+extern const char * g_search_path[];
+
 #ifdef _WIN32
 #include <direct.h>
 

=== modified file 'storage/ndb/test/run-test/files.cpp'
--- a/storage/ndb/test/run-test/files.cpp	2011-06-30 15:59:25 +0000
+++ b/storage/ndb/test/run-test/files.cpp	2011-10-03 08:46:52 +0000
@@ -179,8 +179,8 @@ setup_files(atrt_config& config, int set
 	  const char * val;
 	  require(proc.m_options.m_loaded.get("--datadir=", &val));
 	  BaseString tmp;
-	  tmp.assfmt("%s/bin/mysql_install_db --defaults-file=%s/my.cnf --datadir=%s > %s/mysql_install_db.log 2>&1",
-		     g_prefix, g_basedir, val, proc.m_proc.m_cwd.c_str());
+	  tmp.assfmt("%s --defaults-file=%s/my.cnf --datadir=%s > %s/mysql_install_db.log 2>&1",
+		     g_mysql_install_db_bin_path, g_basedir, val, proc.m_proc.m_cwd.c_str());
 
           to_fwd_slashes(tmp);
 	  if (sh(tmp.c_str()) != 0)
@@ -305,8 +305,13 @@ setup_files(atrt_config& config, int set
 	  }
 	  fprintf(fenv, "\"\nexport CMD\n");
 	}
-	
-	fprintf(fenv, "PATH=%s/bin:%s/libexec:$PATH\n", g_prefix, g_prefix);
+
+        fprintf(fenv, "PATH=");
+        for (int i = 0; g_search_path[i] != 0; i++)
+        {
+          fprintf(fenv, "%s/%s:", g_prefix, g_search_path[i]);
+        }
+        fprintf(fenv, "$PATH\n");
 	keys.push_back("PATH");
 	for (size_t k = 0; k<keys.size(); k++)
 	  fprintf(fenv, "export %s\n", keys[k].c_str());
@@ -314,7 +319,7 @@ setup_files(atrt_config& config, int set
 	fclose(fenv);
       }
       free(env);
-      
+
       {
         tmp.assfmt("%s/ssh-login.sh", proc.m_proc.m_cwd.c_str());
         FILE* fenv = fopen(tmp.c_str(), "w+");

=== modified file 'storage/ndb/test/run-test/main.cpp'
--- a/storage/ndb/test/run-test/main.cpp	2011-06-30 15:59:25 +0000
+++ b/storage/ndb/test/run-test/main.cpp	2011-10-03 08:46:52 +0000
@@ -80,6 +80,37 @@ const char * g_dummy;
 char * g_env_path = 0;
 const char* g_mysqld_host = 0;
 
+const char * g_ndb_mgmd_bin_path = 0;
+const char * g_ndbd_bin_path = 0;
+const char * g_ndbmtd_bin_path = 0;
+const char * g_mysqld_bin_path = 0;
+const char * g_mysql_install_db_bin_path = 0;
+
+static struct
+{
+  bool is_required;
+  const char * exe;
+  const char ** var;
+} g_binaries[] = {
+  { true,  "ndb_mgmd",         &g_ndb_mgmd_bin_path},
+  { true,  "ndbd",             &g_ndbd_bin_path },
+  { false, "ndbmtd",           &g_ndbmtd_bin_path },
+  { true,  "mysqld",           &g_mysqld_bin_path },
+  { true,  "mysql_install_db", &g_mysql_install_db_bin_path },
+  { true, 0, 0 }
+};
+
+const char *
+g_search_path[] =
+{
+  "bin",
+  "libexec",
+  "sbin",
+  "scripts",
+  0
+};
+static bool find_binaries();
+
 static struct my_option g_options[] =
 {
   { "help", '?', "Display this help and exit.", 
@@ -178,6 +209,12 @@ main(int argc, char ** argv)
   }
   
   g_logger.info("Starting...");
+
+  if (!find_binaries())
+  {
+    goto end;
+  }
+
   g_config.m_generated = false;
   g_config.m_replication = g_replicate;
   if (!setup_config(g_config, g_mysqld_host))
@@ -1261,11 +1298,14 @@ setup_test_case(atrt_config& config, con
        proc.m_type == atrt_process::AP_CLIENT)
     {
       BaseString cmd;
-      if (tc.m_command.c_str()[0] != '/')
+      char * p = find_bin_path(tc.m_command.c_str());
+      if (p == 0)
       {
-        cmd.appfmt("%s/bin/", g_prefix);
+        g_logger.critical("Failed to locate '%s'", tc.m_command.c_str());
+        return false;
       }
-      cmd.append(tc.m_command.c_str());
+      cmd.assign(p);
+      free(p);
 
       if (0) // valgrind
       {
@@ -1333,7 +1373,10 @@ setup_hosts(atrt_config& config){
     return false;
   }
 
-  for(size_t i = 0; i<config.m_hosts.size(); i++){
+  for(size_t i = 0; i<config.m_hosts.size(); i++)
+  {
+    if (config.m_hosts[i]->m_hostname.length() == 0)
+      continue;
     BaseString tmp = g_setup_progname;
     tmp.appfmt(" %s %s/ %s/", 
 	       config.m_hosts[i]->m_hostname.c_str(),
@@ -1509,6 +1552,35 @@ reset_config(atrt_config & config)
   return changed;
 }
 
+static
+bool
+find_binaries()
+{
+  g_logger.info("Locating binaries...");
+  bool ok = true;
+  for (int i = 0; g_binaries[i].exe != 0; i++)
+  {
+    const char * p = find_bin_path(g_binaries[i].exe);
+    if (p == 0)
+    {
+      if (g_binaries[i].is_required)
+      {
+        g_logger.critical("Failed to locate '%s'", g_binaries[i].exe);
+        ok = false;
+      }
+      else
+      {
+        g_logger.info("Failed to locate '%s'...ok", g_binaries[i].exe);
+      }
+    }
+    else
+    {
+      * g_binaries[i].var = p;
+    }
+  }
+  return ok;
+}
+
 template class Vector<Vector<SimpleCpcClient::Process> >;
 template class Vector<atrt_host*>;
 template class Vector<atrt_cluster*>;

=== modified file 'storage/ndb/test/run-test/setup.cpp'
--- a/storage/ndb/test/run-test/setup.cpp	2011-06-30 15:59:25 +0000
+++ b/storage/ndb/test/run-test/setup.cpp	2011-10-03 08:46:52 +0000
@@ -20,6 +20,7 @@
 #include <util/ndb_opts.h>
 #include <util/NdbOut.hpp>
 #include <util/BaseString.hpp>
+#include <util/File.hpp>
 
 extern int g_mt;
 extern int g_mt_rr;
@@ -321,7 +322,7 @@ load_process(atrt_config& config, atrt_c
   case atrt_process::AP_NDB_MGMD:
   {
     proc.m_proc.m_name.assfmt("%u-%s", proc_no, "ndb_mgmd");
-    proc.m_proc.m_path.assign(g_prefix).append("/libexec/ndb_mgmd");
+    proc.m_proc.m_path.assign(g_ndb_mgmd_bin_path);
     proc.m_proc.m_args.assfmt("--defaults-file=%s/my.cnf",
 			      proc.m_host->m_basedir.c_str());
     proc.m_proc.m_args.appfmt(" --defaults-group-suffix=%s",
@@ -336,13 +337,15 @@ load_process(atrt_config& config, atrt_c
   } 
   case atrt_process::AP_NDBD:
   {
-    if (g_mt == 0 || (g_mt == 1 && ((g_mt_rr++) & 1) == 0))
+    if (g_mt == 0 ||
+        (g_mt == 1 && ((g_mt_rr++) & 1) == 0) ||
+        g_ndbmtd_bin_path == 0)
     {
-      proc.m_proc.m_path.assign(g_prefix).append("/libexec/ndbd");
+      proc.m_proc.m_path.assign(g_ndbd_bin_path);
     }
     else
     {
-      proc.m_proc.m_path.assign(g_prefix).append("/libexec/ndbmtd");
+      proc.m_proc.m_path.assign(g_ndbmtd_bin_path);
     }
     
     proc.m_proc.m_name.assfmt("%u-%s", proc_no, "ndbd");
@@ -361,7 +364,7 @@ load_process(atrt_config& config, atrt_c
   case atrt_process::AP_MYSQLD:
   {
     proc.m_proc.m_name.assfmt("%u-%s", proc_no, "mysqld");
-    proc.m_proc.m_path.assign(g_prefix).append("/libexec/mysqld");
+    proc.m_proc.m_path.assign(g_mysqld_bin_path);
     proc.m_proc.m_args.assfmt("--defaults-file=%s/my.cnf",
 			      proc.m_host->m_basedir.c_str());
     proc.m_proc.m_args.appfmt(" --defaults-group-suffix=.%d%s",
@@ -1037,3 +1040,28 @@ operator<<(NdbOut& out, const atrt_proce
   return out;
 }
 
+char *
+find_bin_path(const char * exe)
+{
+  if (exe == 0)
+    return 0;
+
+  if (exe[0] == '/')
+  {
+    /**
+     * Trust that path is correct...
+     */
+    return strdup(exe);
+  }
+
+  for (int i = 0; g_search_path[i] != 0; i++)
+  {
+    BaseString p;
+    p.assfmt("%s/%s/%s", g_prefix, g_search_path[i], exe);
+    if (File_class::exists(p.c_str()))
+    {
+      return strdup(p.c_str());
+    }
+  }
+  return 0;
+}

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4565 to 4566) Jonas Oreland3 Oct