Below is the list of changes that have just been committed into a local
5.0 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2165 06/05/26 14:27:24 jonas@eel.(none) +4 -0
ndb - wl2809 - new atrt features
* multiple clusters
* multiple mysqld
* deploy
* setup/configure
* sshx
ndb/test/run-test/setup.cpp
1.1 06/05/26 14:27:19 jonas@eel.(none) +969 -0
New BitKeeper file ``ndb/test/run-test/setup.cpp''
ndb/test/run-test/setup.cpp
1.0 06/05/26 14:27:19 jonas@eel.(none) +0 -0
BitKeeper file /home/jonas/src/50-atrt/ndb/test/run-test/setup.cpp
ndb/test/run-test/main.cpp
1.28 06/05/26 14:27:19 jonas@eel.(none) +543 -358
support for
* multiple clusters
* multiple mysqld
* deploy
* setup/configure
* sshx
ndb/test/run-test/atrt.hpp
1.8 06/05/26 14:27:19 jonas@eel.(none) +53 -16
support for
* multiple clusters
* multiple mysqld
* deploy
* setup/configure
* sshx
ndb/test/run-test/Makefile.am
1.24 06/05/26 14:27:19 jonas@eel.(none) +10 -1
new file
ndb/test/run-test/atrt.hpp
1.7 06/04/29 10:41:15 jonas@eel.(none) +0 -0
Rename: ndb/test/run-test/run-test.hpp -> ndb/test/run-test/atrt.hpp
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jonas
# Host: eel.(none)
# Root: /home/jonas/src/50-atrt
--- New file ---
+++ ndb/test/run-test/setup.cpp 06/05/26 14:27:19
#include "atrt.hpp"
#include <ndb_global.h>
#include <BaseString.hpp>
#include <NdbOut.hpp>
#include <Properties.hpp>
#include <NdbAutoPtr.hpp>
#include <my_sys.h>
#include <my_getopt.h>
#include "atrt.hpp"
#include <SysLogHandler.hpp>
#include <FileLogHandler.hpp>
#include <mgmapi.h>
#include <mgmapi_configuration.hpp>
#include <ConfigInfo.hpp>
#include "CpcClient.hpp"
#include <Config.hpp>
#include <sys/types.h>
#include <dirent.h>
#include <NdbOut.hpp>
static atrt_host * find(const char * hostname, Vector<atrt_host*>&);
static bool load_process(atrt_config&, atrt_cluster&, atrt_process::Type,
size_t idx, const char * hostname);
static
void
require(bool x)
{
if (!x)
abort();
}
static
NdbOut&
operator<<(NdbOut& out, const atrt_process& proc)
{
out << "[ atrt_process: ";
switch(proc.m_type){
case atrt_process::AP_NDB_MGMD:
out << "ndb_mgmd";
break;
case atrt_process::AP_NDBD:
out << "ndbd";
break;
case atrt_process::AP_MYSQLD:
out << "mysqld";
break;
case atrt_process::AP_NDB_API:
out << "ndbapi";
break;
case atrt_process::AP_MYSQL_CLIENT:
out << "client";
break;
default:
out << "<unknown: " << (int)proc.m_type << " >";
}
out << " cluster: " << proc.m_cluster->m_name.c_str()
<< " host: " << proc.m_host->m_hostname.c_str()
<< endl << " cwd: " << proc.m_proc.m_cwd.c_str()
<< endl << " path: " << proc.m_proc.m_path.c_str()
<< endl << " args: " << proc.m_proc.m_args.c_str()
<< endl << " env: " << proc.m_proc.m_env.c_str() << endl;
proc.m_generated.print(stdout, "generated: ");
out << " ]";
#if 0
proc.m_index = 0; //idx;
proc.m_host = host_ptr;
proc.m_cluster = cluster;
proc.m_proc.m_id = -1;
proc.m_proc.m_type = "temporary";
proc.m_proc.m_owner = "atrt";
proc.m_proc.m_group = cluster->m_name.c_str();
proc.m_proc.m_cwd.assign(dir).append("/atrt/").append(cluster->m_dir);
proc.m_proc.m_stdout = "log.out";
proc.m_proc.m_stderr = "2>&1";
proc.m_proc.m_runas = proc.m_host->m_user;
proc.m_proc.m_ulimit = "c:unlimited";
proc.m_proc.m_env.assfmt("MYSQL_BASE_DIR=%s", dir);
proc.m_proc.m_shutdown_options = "";
#endif
return out;
}
static struct
{
const char * name;
int type;
int required;
} f_options[] = {
{ "--datadir=", atrt_process::AP_MYSQLD, 0 } // 0
,{ "--socket=", atrt_process::AP_MYSQLD, 0 } // 1
,{ "--port=", atrt_process::AP_MYSQLD, 0 } // 2
,{ "--server-id=", atrt_process::AP_MYSQLD, 1 } // 3
,{ "--ndb-connectstring=", 0, 0 } // 4
//,{ "--master-host=", atrt_process::AP_MYSQLD, 1 } // 5
//,{ "--master-port=", atrt_process::AP_MYSQLD, 1 } // 6
,{ "--FileSystemPath=", atrt_process::AP_NDBD, 0 } // 7
,{ "--PortNumber=", atrt_process::AP_NDB_MGMD, 0 } // 8
,{ 0, 0, 0 }
};
bool
setup_config(atrt_config& config)
{
BaseString tmp(g_clusters);
Vector<BaseString> clusters;
tmp.split(clusters, ",");
size_t j,k;
for (size_t i = 0; i<clusters.size(); i++)
{
struct atrt_cluster *cluster = new atrt_cluster;
config.m_clusters.push_back(cluster);
cluster->m_name = clusters[i];
cluster->m_dir.assfmt("cluster%s/", clusters[i].c_str());
int argc = 1;
const char * argv[] = { "atrt", 0, 0 };
BaseString buf;
buf.assfmt("--defaults-group-suffix=%s", clusters[i].c_str());
argv[argc++] = buf.c_str();
char ** tmp = (char**)argv;
const char *groups[] = { "cluster_config", "mysql_cluster", 0 };
int ret = load_defaults(g_my_cnf, groups, &argc, &tmp);
if (ret)
{
g_logger.error("Unable to load defaults for cluster: %s",
clusters[i].c_str());
return false;
}
struct
{
atrt_process::Type type;
const char * name;
const char * value;
} proc_args[] = {
{ atrt_process::AP_NDB_MGMD, "--ndb_mgmd=", 0 },
{ atrt_process::AP_NDBD, "--ndbd=", 0 },
{ atrt_process::AP_NDB_API, "--ndbapi=", 0 },
{ atrt_process::AP_MYSQLD, "--mysqld=", 0 },
{ atrt_process::AP_ALL, 0, 0}
};
/**
* Find all processes...
*/
for (j = 0; j<(size_t)argc; j++)
{
for (k = 0; proc_args[k].name; k++)
{
if(!strncmp(tmp[j], proc_args[k].name, strlen(proc_args[k].name)))
{
proc_args[k].value = tmp[j] + strlen(proc_args[k].name);
break;
}
}
}
for (j = 0; j<(size_t)argc; j++)
{
for (k = 0; f_options[k].name; k++)
{
const size_t len = strlen(f_options[k].name);
if (f_options[k].type == 0 &&
strncmp(tmp[j], f_options[k].name, len) == 0)
{
cluster->m_options.put(f_options[k].name, tmp[j]+len, true);
break;
}
}
}
for (j = 0; proc_args[j].name; j++)
{
if (proc_args[j].value)
{
BaseString tmp(proc_args[j].value);
Vector<BaseString> list;
tmp.split(list, ",");
for (k = 0; k<list.size(); k++)
if (!load_process(config, *cluster, proc_args[j].type,
k + 1, list[k].c_str()))
return false;
}
}
}
return true;
}
static
atrt_host *
find(const char * hostname, Vector<atrt_host*> & hosts){
for(size_t i = 0; i<hosts.size(); i++){
if(hosts[i]->m_hostname == hostname){
return hosts[i];
}
}
atrt_host* host = new atrt_host;
host->m_index = hosts.size();
host->m_cpcd = new SimpleCpcClient(hostname, 1234);
host->m_basedir = g_basedir;
host->m_user = g_user;
host->m_hostname = hostname;
hosts.push_back(host);
return host;
}
static
bool
load_process(atrt_config& config, atrt_cluster& cluster,
atrt_process::Type type,
size_t idx,
const char * hostname)
{
atrt_host * host_ptr = find(hostname, config.m_hosts);
atrt_process *proc_ptr = new atrt_process;
config.m_processes.push_back(proc_ptr);
atrt_process& proc = *proc_ptr;
const char * dir = host_ptr->m_basedir.c_str();
proc.m_index = idx;
proc.m_type = type;
proc.m_host = host_ptr;
proc.m_cluster = &cluster;
proc.m_proc.m_id = -1;
proc.m_proc.m_type = "temporary";
proc.m_proc.m_owner = "atrt";
proc.m_proc.m_group = cluster.m_name.c_str();
proc.m_proc.m_stdout = "log.out";
proc.m_proc.m_stderr = "2>&1";
proc.m_proc.m_runas = proc.m_host->m_user;
proc.m_proc.m_ulimit = "c:unlimited";
proc.m_proc.m_env.assfmt("MYSQL_BASE_DIR=%s", dir);
proc.m_proc.m_shutdown_options = "";
int argc = 1;
const char * argv[] = { "atrt", 0, 0 };
BaseString buf[10];
char ** tmp = (char**)argv;
const char *groups[] = { 0, 0, 0, 0 };
switch(type){
case atrt_process::AP_NDB_MGMD:
groups[0] = "cluster_config";
buf[1].assfmt("cluster_config.ndb_mgmd.%d", idx);
groups[1] = buf[1].c_str();
buf[0].assfmt("--defaults-group-suffix=%s", cluster.m_name.c_str());
argv[argc++] = buf[0].c_str();
break;
case atrt_process::AP_NDBD:
groups[0] = "cluster_config";
buf[1].assfmt("cluster_config.ndbd.%d", idx);
groups[1] = buf[1].c_str();
buf[0].assfmt("--defaults-group-suffix=%s", cluster.m_name.c_str());
argv[argc++] = buf[0].c_str();
break;
case atrt_process::AP_MYSQLD:
groups[0] = "mysqld";
groups[1] = "mysql_cluster";
buf[0].assfmt("--defaults-group-suffix=.%d%s",idx,cluster.m_name.c_str());
argv[argc++] = buf[0].c_str();
break;
case atrt_process::AP_NDB_API:
break;
default:
g_logger.critical("Unhandled process type: %d", type);
return false;
}
int ret = load_defaults(g_my_cnf, groups, &argc, &tmp);
if (ret)
{
g_logger.error("Unable to load defaults for cluster: %s",
cluster.m_name.c_str());
return false;
}
for (int i = 0; i<argc; i++)
{
for (int j = 0; f_options[j].name; j++)
{
const size_t len = strlen(f_options[j].name);
if(strncmp(tmp[i], f_options[j].name, len) == 0 &&
((((f_options[j].type & (int)type)) != 0) ||
(f_options[j].type == 0)))
{
proc.m_options.put(f_options[j].name, tmp[i]+len, true);
break;
}
}
}
host_ptr->m_processes.push_back(proc_ptr);
cluster.m_processes.push_back(proc_ptr);
return true;
}
static
bool
do_configure(int step, const char *name, Properties& ctx, atrt_process& proc)
{
if (proc.m_type == atrt_process::AP_NDB_API ||
proc.m_type == atrt_process::AP_MYSQL_CLIENT)
return true;
if (strcmp(name, "--port=") == 0 ||
strcmp(name, "--PortNumber=") == 0)
{
Uint32 val = g_baseport;
ctx.get("--PortNumber=", &val);
char buf[255];
snprintf(buf, sizeof(buf), "%u", val);
proc.m_options.put(name, buf);
proc.m_generated.put(name, buf);
ctx.put("--PortNumber=", (val + 1), true);
return true;
}
else if (strcmp(name, "--datadir=") == 0 ||
strcmp(name, "--FileSystemPath=") == 0)
{
proc.m_options.put(name, proc.m_proc.m_cwd.c_str());
proc.m_generated.put(name, proc.m_proc.m_cwd.c_str());
return true;
}
else if (strcmp(name, "--socket=") == 0)
{
BaseString tmp;
tmp.appfmt("%s/mysql.sock", proc.m_proc.m_cwd.c_str());
proc.m_options.put(name, tmp.c_str());
proc.m_generated.put(name, tmp.c_str());
return true;
}
else if (strcmp(name, "--server-id=") == 0)
{
Uint32 val = 1;
ctx.get(name, &val);
char buf[255];
snprintf(buf, sizeof(buf), "%u", val);
proc.m_options.put(name, buf);
proc.m_generated.put(name, buf);
ctx.put(name, (val + 1), true);
return true;
}
if (step == 0)
{
return true;
}
if (strcmp(name, "--ndb-connectstring=") == 0)
{
const char * val;
BaseString key;
key.assfmt("%s%s", name, proc.m_cluster->m_name.c_str());
if (ctx.get(key.c_str(), &val))
{
proc.m_options.put(name, val);
proc.m_generated.put(name, val);
return true;
}
g_logger.warning("Failed to get %s", key.c_str());
}
g_logger.warning("Unknown parameter: %s", name);
return true;
}
static
bool
do_configure(int step, const char*name, Properties& ctx, atrt_cluster& cluster)
{
if (strcmp(name, "--ndb-connectstring=") == 0)
{
const char * val;
BaseString key;
key.assfmt("%s%s", name, cluster.m_name.c_str());
if (!ctx.get(key.c_str(), &val))
{
/**
* Construct connect string for this cluster
*/
BaseString str;
for (size_t i = 0; i<cluster.m_processes.size(); i++)
{
atrt_process* tmp = cluster.m_processes[i];
if (tmp->m_type == atrt_process::AP_NDB_MGMD)
{
if (str.length())
{
str.append(";");
}
const char * port;
tmp->m_options.get("--PortNumber=", &port);
str.appfmt("%s:%s", tmp->m_host->m_hostname.c_str(), port);
}
}
ctx.put(key.c_str(), str.c_str());
ctx.get(key.c_str(), &val);
}
cluster.m_options.put(name, val);
cluster.m_generated.put(name, val);
for (size_t i = 0; i<cluster.m_processes.size(); i++)
{
cluster.m_processes[i]->m_proc.m_env.appfmt(" NDB_CONNECTSTRING=%s",
val);
}
return true;
}
g_logger.warning("Unknown parameter: %s", name);
return true;
}
static
bool
do_validate(atrt_process& proc)
{
if (proc.m_type == atrt_process::AP_NDB_API ||
proc.m_type == atrt_process::AP_MYSQL_CLIENT)
return true;
bool ok = true;
for (size_t i = 0; f_options[i].name; i++)
{
if (f_options[i].type & (int)proc.m_type)
{
if (!proc.m_options.contains(f_options[i].name))
{
ok = false;
g_logger.error("Missing parameter: %s for %s",
f_options[i].name,
proc.m_proc.m_cwd.c_str());
}
}
}
return ok;
}
bool
configure(atrt_config& config, bool generate)
{
bool ok = true;
bool fqpn = config.m_clusters.size() > 1 || g_fqpn;
Properties ctx;
for (size_t i = 0; i < config.m_clusters.size(); i++)
{
atrt_cluster& cluster = *config.m_clusters[i];
if (fqpn)
{
cluster.m_dir.assfmt("cluster%s/", cluster.m_name.c_str());
}
else
{
cluster.m_dir = "";
}
for (size_t j = 0; j<cluster.m_processes.size(); j++)
{
atrt_process& proc = *cluster.m_processes[j];
BaseString dir;
dir.assfmt("%s/%s",
proc.m_host->m_basedir.c_str(),
cluster.m_dir.c_str());
switch(proc.m_type){
case atrt_process::AP_NDB_MGMD:
{
proc.m_proc.m_name.assfmt("%d-%s", j+1, "ndb_mgmd");
proc.m_proc.m_path.assign(g_prefix).append("/libexec/ndb_mgmd");
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",
cluster.m_name.c_str());
proc.m_proc.m_args.append(" --nodaemon --mycnf");
proc.m_proc.m_cwd.assfmt("%sndb_mgmd.%d", dir.c_str(), proc.m_index);
proc.m_proc.m_env.assfmt("MYSQL_GROUP_SUFFIX=%s ",
cluster.m_name.c_str());
break;
}
case atrt_process::AP_NDBD:
{
proc.m_proc.m_name.assfmt("%d-%s", j+1, "ndbd");
proc.m_proc.m_path.assign(g_prefix).append("/libexec/ndbd");
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",
cluster.m_name.c_str());
proc.m_proc.m_args.append(" --initial --nodaemon -n");
proc.m_proc.m_cwd.assfmt("%sndbd.%d", dir.c_str(), proc.m_index);
proc.m_proc.m_env.assfmt("MYSQL_GROUP_SUFFIX=%s ",
cluster.m_name.c_str());
break;
}
case atrt_process::AP_MYSQLD:
{
proc.m_proc.m_name.assfmt("%d-%s", j+1, "mysqld");
proc.m_proc.m_path.assign(g_prefix).append("/libexec/mysqld");
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",
proc.m_index,
cluster.m_name.c_str());
proc.m_proc.m_args.append(" --core-file --ndbcluster");
proc.m_proc.m_cwd.appfmt("%smysqld.%d", dir.c_str(), proc.m_index);
proc.m_proc.m_shutdown_options = "SIGKILL"; // not nice
proc.m_proc.m_env.assfmt("MYSQL_GROUP_SUFFIX=.%d%s ",
proc.m_index,
cluster.m_name.c_str());
break;
}
case atrt_process::AP_NDB_API:
{
proc.m_proc.m_name.assfmt("%d-%s", j+1, "ndb_api");
proc.m_proc.m_path = "";
proc.m_proc.m_args = "";
proc.m_proc.m_cwd.appfmt("%sndb_api.%d", dir.c_str(), proc.m_index);
proc.m_proc.m_env.assfmt("MYSQL_GROUP_SUFFIX=%s ",
cluster.m_name.c_str());
break;
}
case atrt_process::AP_MYSQL_CLIENT:
{
proc.m_proc.m_name.assfmt("%d-%s", j+1, "mysql");
proc.m_proc.m_path = "";
proc.m_proc.m_args = "";
proc.m_proc.m_cwd.appfmt("%s/mysql.%d", dir.c_str(), proc.m_index);
proc.m_proc.m_env.assfmt("MYSQL_GROUP_SUFFIX=.%d%s ",
proc.m_index,
cluster.m_name.c_str());
}
default:
g_logger.critical("Unhandled process type: %d", proc.m_type);
return false;
}
for (size_t k = 0; f_options[k].name; k++)
{
if (f_options[k].type & proc.m_type)
{
const char * val;
if (!proc.m_options.get(f_options[k].name, &val) && generate)
{
if (!do_configure(0, f_options[k].name, ctx, proc))
ok = false;
if (proc.m_options.get(f_options[k].name, &val))
config.m_generated = true;
}
}
}
if (proc.m_proc.m_path.length())
{
proc.m_proc.m_env.appfmt("CMD=\"%s", proc.m_proc.m_path.c_str());
if (proc.m_proc.m_args.length())
proc.m_proc.m_env.append(" ");
proc.m_proc.m_env.append(proc.m_proc.m_args);
proc.m_proc.m_env.append("\" ");
}
}
}
// Step 1 - cluster properties
for (size_t i = 0; i < config.m_clusters.size(); i++)
{
atrt_cluster& cluster = *config.m_clusters[i];
for (size_t k = 0; f_options[k].name; k++)
{
if (f_options[k].type == 0)
{
const char * val;
if (!cluster.m_options.get(f_options[k].name, &val))
{
if (generate)
{
if (!do_configure(1, f_options[k].name, ctx, cluster))
ok = false;
if (cluster.m_options.get(f_options[k].name, &val))
config.m_generated = true;
}
}
}
}
}
// Step 2
for (size_t i = 0; i < config.m_clusters.size(); i++)
{
atrt_cluster& cluster = *config.m_clusters[i];
for (size_t j = 0; j<cluster.m_processes.size(); j++)
{
atrt_process& proc = *cluster.m_processes[j];
for (size_t k = 0; f_options[k].name; k++)
{
if ((f_options[k].type & proc.m_type) ||
(proc.m_type == atrt_process::AP_MYSQLD && f_options[k].type == 0))
{
const char * val;
if (!proc.m_options.get(f_options[k].name, &val))
{
if (generate)
{
if (!do_configure(2, f_options[k].name, ctx, proc))
ok = false;
if (proc.m_options.get(f_options[k].name, &val))
config.m_generated = true;
}
}
}
}
}
}
if (ok)
{
for (size_t i = 0; i < config.m_clusters.size(); i++)
{
atrt_cluster& cluster = *config.m_clusters[i];
for (size_t j = 0; j<cluster.m_processes.size(); j++)
{
if (!do_validate(*cluster.m_processes[j]))
{
ok = false;
}
//ndbout << *cluster.m_processes[j] << endl;
}
}
}
return ok;
}
static
bool
create_directory(const char * path)
{
BaseString tmp(path);
Vector<BaseString> list;
if (tmp.split(list, "/") == 0)
{
g_logger.error("Failed to create directory: %s", tmp.c_str());
return false;
}
BaseString cwd = "/";
for (size_t i = 0; i < list.size(); i++)
{
cwd.append(list[i].c_str());
cwd.append("/");
mkdir(cwd.c_str(), S_IRUSR | S_IWUSR | S_IXUSR | S_IXGRP | S_IRGRP);
}
struct stat sbuf;
if (lstat(path, &sbuf) != 0 ||
!S_ISDIR(sbuf.st_mode))
{
g_logger.error("Failed to create directory: %s (%s)",
tmp.c_str(),
cwd.c_str());
return false;
}
return true;
}
bool
setup_directories(atrt_config& config, int setup)
{
/**
* 0 = validate
* 1 = setup
* 2 = setup+clean
* 3 = setup+clean-force
*/
for (size_t i = 0; i < config.m_clusters.size(); i++)
{
atrt_cluster& cluster = *config.m_clusters[i];
for (size_t j = 0; j<cluster.m_processes.size(); j++)
{
atrt_process& proc = *cluster.m_processes[j];
const char * dir = proc.m_proc.m_cwd.c_str();
struct stat sbuf;
int exists = 0;
if (lstat(dir, &sbuf) == 0)
{
if (S_ISDIR(sbuf.st_mode))
exists = 1;
else
exists = -1;
}
switch(setup){
case 0:
switch(exists){
case 0:
g_logger.error("Could not find directory: %s", dir);
abort();
return false;
case -1:
g_logger.error("%s is not a directory!", dir);
return false;
}
break;
case 1:
if (exists == -1)
{
g_logger.error("%s is not a directory!", dir);
return false;
}
break;
case 3:
if (exists == -1)
{
if (unlink(dir) != 0)
{
g_logger.error("Failed to remove: %s", dir);
return false;
}
exists = 0;
break;
}
case 2:
if (exists == 1)
{
if (!remove_dir(dir))
{
g_logger.error("Failed to remove %s!", dir);
return false;
}
exists = 0;
break;
}
}
if (exists != 1)
{
if (!create_directory(dir))
{
return false;
}
}
}
}
return true;
}
bool
setup_files(atrt_config& config, int setup, int sshx)
{
/**
* 0 = validate
* 1 = setup
* 2 = setup+clean
* 3 = setup+clean-force
*/
BaseString mycnf;
mycnf.assfmt("%s/my.cnf", g_basedir);
if (mycnf == g_my_cnf)
{
setup = 1;
}
else
{
struct stat sbuf;
int ret = lstat(mycnf.c_str(), &sbuf);
if (ret == 0)
{
if (setup < 2)
{
g_logger.error("Found existing my.cnf!");
return false;
}
if (unlink(mycnf.c_str()) != 0)
{
g_logger.error("Failed to remove %s", mycnf.c_str());
return false;
}
}
BaseString cp = "cp ";
cp.appfmt("%s %s", g_my_cnf, mycnf.c_str());
if (system(cp.c_str()) != 0)
{
g_logger.error("Failed to '%s'", cp.c_str());
return false;
}
setup = 2;
}
if (setup == 2)
{
/**
* Do mysql_install_db
*/
for (size_t i = 0; i < config.m_clusters.size(); i++)
{
atrt_cluster& cluster = *config.m_clusters[i];
for (size_t j = 0; j<cluster.m_processes.size(); j++)
{
atrt_process& proc = *cluster.m_processes[j];
if (proc.m_type == atrt_process::AP_MYSQLD)
{
const char * val;
require(proc.m_options.get("--datadir=", &val));
BaseString tmp;
tmp.assfmt("%s/bin/mysql_install_db --datadir=%s > /dev/null 2>&1",
g_prefix, val);
if (system(tmp.c_str()) != 0)
{
g_logger.error("Failed to mysql_install_db for %s",
proc.m_proc.m_cwd.c_str());
}
else
{
g_logger.info("mysql_install_db for %s",
proc.m_proc.m_cwd.c_str());
}
}
}
}
}
FILE * out = NULL;
if (config.m_generated == false)
{
g_logger.info("Nothing configured...");
}
else
{
out = fopen(mycnf.c_str(), "a+");
if (out == 0)
{
g_logger.error("Failed to open %s for append", mycnf.c_str());
return false;
}
time_t now = time(0);
fprintf(out, "#\n# Generated by atrt\n");
fprintf(out, "# %s\n", ctime(&now));
}
for (size_t i = 0; i < config.m_clusters.size(); i++)
{
atrt_cluster& cluster = *config.m_clusters[i];
Properties::Iterator it(&cluster.m_generated);
const char * name = it.first();
if (name)
{
fprintf(out, "[mysql_cluster%s]\n", cluster.m_name.c_str());
for (; name; name = it.next())
{
const char* val;
cluster.m_generated.get(name, &val);
fprintf(out, "%s %s\n", name + 2, val);
}
fprintf(out, "\n");
fflush(out);
}
for (size_t j = 0; j<cluster.m_processes.size(); j++)
{
atrt_process& proc = *cluster.m_processes[j];
Properties::Iterator it(&proc.m_generated);
const char * name = it.first();
if (name)
{
switch(proc.m_type){
case atrt_process::AP_NDB_MGMD:
fprintf(out, "[cluster_config.ndb_mgmd.%d%s]\n",
proc.m_index, proc.m_cluster->m_name.c_str());
break;
case atrt_process::AP_NDBD:
fprintf(out, "[cluster_config.ndbd.%d%s]\n",
proc.m_index, proc.m_cluster->m_name.c_str());
break;
case atrt_process::AP_MYSQLD:
fprintf(out, "[mysqld.%d%s]\n",
proc.m_index, proc.m_cluster->m_name.c_str());
break;
case atrt_process::AP_NDB_API:
case atrt_process::AP_MYSQL_CLIENT:
name = 0;
break;
}
if (name)
{
for (; name; name = it.next())
{
const char* val;
proc.m_generated.get(name, &val);
fprintf(out, "%s %s\n", name + 2, val);
}
fprintf(out, "\n");
fflush(out);
}
}
/**
* Create env.sh
*/
BaseString tmp;
tmp.assfmt("%s/env.sh", proc.m_proc.m_cwd.c_str());
char **env = BaseString::argify(0, proc.m_proc.m_env.c_str());
if (env[0])
{
Vector<BaseString> keys;
FILE *fenv = fopen(tmp.c_str(), "w+");
for (size_t k = 0; env[k]; k++)
{
tmp = env[k];
int pos = tmp.indexOf('=');
require(pos > 0);
env[k][pos] = 0;
fprintf(fenv, "%s=\"%s\"\n", env[k], env[k]+pos+1);
keys.push_back(env[k]);
free(env[k]);
}
fprintf(fenv, "PATH=%s/bin:%s/libexec:$PATH\n", g_prefix, g_prefix);
keys.push_back("PATH");
for (size_t k = 0; k<keys.size(); k++)
fprintf(fenv, "export %s\n", keys[k].c_str());
fflush(fenv);
fclose(fenv);
}
free(env);
if (sshx)
{
tmp.assfmt("%s/ssh-login.sh", proc.m_proc.m_cwd.c_str());
FILE* fenv = fopen(tmp.c_str(), "w+");
fprintf(fenv, "#!/bin/sh\n");
fprintf(fenv, "cd %s\n", proc.m_proc.m_cwd.c_str());
fprintf(fenv, "[ -f /etc/profile ] && . /etc/profile\n");
fprintf(fenv, ". env.sh\n");
fprintf(fenv, "ulimit -Sc unlimited\n");
fprintf(fenv, "bash -i");
fflush(fenv);
fclose(fenv);
}
}
}
if (out)
fclose(out);
return true;
}
--- 1.27/ndb/test/run-test/main.cpp 2005-05-06 19:23:09 +02:00
+++ 1.28/ndb/test/run-test/main.cpp 2006-05-26 14:27:19 +02:00
@@ -16,19 +16,29 @@
#include <ndb_global.h>
-#include <getarg.h>
#include <BaseString.hpp>
-#include <Parser.hpp>
#include <NdbOut.hpp>
#include <Properties.hpp>
#include <NdbAutoPtr.hpp>
+#include <my_sys.h>
+#include <my_getopt.h>
-#include "run-test.hpp"
+#include "atrt.hpp"
#include <SysLogHandler.hpp>
#include <FileLogHandler.hpp>
#include <mgmapi.h>
+#include <mgmapi_configuration.hpp>
+#include <ConfigInfo.hpp>
#include "CpcClient.hpp"
+#include <Config.hpp>
+
+#include <sys/types.h>
+#include <dirent.h>
+
+#include <NdbSleep.h>
+
+#define PATH_SEPARATOR "/"
/** Global variables */
static const char progname[] = "ndb_atrt";
@@ -37,57 +47,105 @@
static const char * g_clear_progname = "atrt-clear-result.sh";
static const char * g_setup_progname = "atrt-setup.sh";
-static const char * g_setup_path = 0;
-static const char * g_process_config_filename = "d.txt";
static const char * g_log_filename = 0;
static const char * g_test_case_filename = 0;
static const char * g_report_filename = 0;
-static const char * g_default_user = 0;
-static const char * g_default_base_dir = 0;
-static int g_default_base_port = 0;
-static int g_mysqld_use_base = 1;
+static int g_do_setup = 0;
+static int g_do_deploy = 0;
+static int g_do_sshx = 0;
static int g_report = 0;
-static int g_verbosity = 0;
+static int g_verbosity = 1;
static FILE * g_report_file = 0;
static FILE * g_test_case_file = stdin;
-
-Logger g_logger;
-atrt_config g_config;
-
static int g_mode_bench = 0;
static int g_mode_regression = 0;
static int g_mode_interactive = 0;
-static int g_mode = 0;
-static
-struct getargs args[] = {
- { "process-config", 0, arg_string, &g_process_config_filename, 0, 0 },
- { "setup-path", 0, arg_string, &g_setup_path, 0, 0 },
- { 0, 'v', arg_counter, &g_verbosity, 0, 0 },
- { "log-file", 0, arg_string, &g_log_filename, 0, 0 },
- { "testcase-file", 'f', arg_string, &g_test_case_filename, 0, 0 },
- { 0, 'R', arg_flag, &g_report, 0, 0 },
- { "report-file", 0, arg_string, &g_report_filename, 0, 0 },
- { "interactive", 'i', arg_flag, &g_mode_interactive, 0, 0 },
- { "regression", 'r', arg_flag, &g_mode_regression, 0, 0 },
- { "bench", 'b', arg_flag, &g_mode_bench, 0, 0 },
+Logger g_logger;
+atrt_config g_config;
+const char * g_user = 0;
+int g_baseport = 0;
+int g_fqpn = 0;
+
+const char * g_cwd = 0;
+const char * g_basedir = 0;
+const char * g_my_cnf = 0;
+const char * g_prefix = 0;
+const char * g_clusters = 0;
+const char *save_file = 0;
+char *save_extra_file = 0;
+const char *save_group_suffix = 0;
+
+/** Dummy, extern declared in ndb_opts.h */
+int g_print_full_config = 0, opt_ndb_shm;
+my_bool opt_core;
+
+static struct my_option g_options[] =
+{
+ { "usage", '?', "Display this help and exit.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "help", '?', "Display this help and exit.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "version", 'V', "Output version information and exit.", 0, 0, 0,
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "clusters", 'c', "Cluster",
+ (gptr*) &g_clusters, (gptr*) &g_clusters,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "log-file", 'c', "log-file",
+ (gptr*) &g_log_filename, (gptr*) &g_log_filename,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "testcase-file", 'f', "testcase-file",
+ (gptr*) &g_test_case_filename, (gptr*) &g_test_case_filename,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "report", 'R', "Produce report",
+ (gptr*) &g_report, (gptr*) &g_report,
+ 0, GET_BOOL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "report-file", 'r', "report-file",
+ (gptr*) &g_report_filename, (gptr*) &g_report_filename,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "basedir", 256, "Base path",
+ (gptr*) &g_basedir, (gptr*) &g_basedir,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "baseport", 256, "Base port",
+ (gptr*) &g_baseport, (gptr*) &g_baseport,
+ 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "prefix", 256, "mysql install dir",
+ (gptr*) &g_prefix, (gptr*) &g_prefix,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "verbose", 'v', "Verbosity",
+ (gptr*) &g_verbosity, (gptr*) &g_verbosity,
+ 0, GET_INT, REQUIRED_ARG, g_verbosity, 0, 0, 0, 0, 0},
+ { "setup", 256, "setup",
+ (gptr*) &g_do_setup, (gptr*) &g_do_setup,
+ 0, GET_INT, REQUIRED_ARG, g_do_setup, 0, 0, 0, 0, 0 },
+ { "deploy", 256, "deploy",
+ (gptr*) &g_do_deploy, (gptr*) &g_do_deploy,
+ 0, GET_INT, REQUIRED_ARG, g_do_deploy, 0, 0, 0, 0, 0 },
+ { "sshx", 256, "sshx",
+ (gptr*) &g_do_sshx, (gptr*) &g_do_sshx,
+ 0, GET_INT, REQUIRED_ARG, g_do_sshx, 0, 0, 0, 0, 0 },
+ { "fqpn", 256, "Fully qualified path-names ",
+ (gptr*) &g_fqpn, (gptr*) &g_fqpn,
+ 0, GET_INT, REQUIRED_ARG, g_fqpn, 0, 0, 0, 0, 0 },
+
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-const int arg_count = 10;
int
-main(int argc, const char ** argv){
+main(int argc, char ** argv)
+{
ndb_init();
bool restart = true;
int lineno = 1;
int test_no = 1;
- const int p_ndb = atrt_process::NDB_MGM | atrt_process::NDB_DB;
- const int p_servers = atrt_process::MYSQL_SERVER | atrt_process::NDB_REP;
- const int p_clients = atrt_process::MYSQL_CLIENT | atrt_process::NDB_API;
+ const int p_ndb = atrt_process::AP_NDB_MGMD | atrt_process::AP_NDBD;
+ const int p_servers = atrt_process::AP_MYSQLD;
+ const int p_clients = atrt_process::AP_MYSQL_CLIENT | atrt_process::AP_NDB_API;
g_logger.setCategory(progname);
g_logger.enable(Logger::LL_ALL);
@@ -95,18 +153,54 @@
if(!parse_args(argc, argv))
goto end;
-
+
g_logger.info("Starting...");
- if(!setup_config(g_config))
+ g_config.m_generated = false;
+ if (!setup_config(g_config))
+ goto end;
+
+ if (!configure(g_config, g_do_setup))
goto end;
- g_logger.info("Connecting to hosts");
- if(!connect_hosts(g_config))
+ g_logger.info("Setting up directories");
+ if (!setup_directories(g_config, g_do_setup))
goto end;
+ if (g_do_setup)
+ {
+ g_logger.info("Setting up files");
+ if (!setup_files(g_config, g_do_setup, g_do_sshx))
+ goto end;
+ }
+
+ if (g_do_deploy)
+ {
+ g_logger.info("rsyncing %s", g_prefix);
+ if (!deploy(g_config))
+ goto end;
+ }
+
if(!setup_hosts(g_config))
goto end;
+ if (g_do_sshx)
+ {
+ g_logger.info("Starting xterm-ssh");
+ if (!sshx(g_config))
+ goto end;
+
+ g_logger.info("Done...sleeping");
+ while(true)
+ {
+ NdbSleep_SecSleep(1);
+ }
+ goto end;
+ }
+
+ g_logger.info("Connecting to hosts");
+ if(!connect_hosts(g_config))
+ goto end;
+
/**
* Main loop
*/
@@ -119,14 +213,14 @@
if(!stop_processes(g_config, ~0))
goto end;
- if(!start_processes(g_config, atrt_process::NDB_MGM))
+ if(!start_processes(g_config, atrt_process::AP_NDB_MGMD))
goto end;
if(!connect_ndb_mgm(g_config)){
goto end;
}
- if(!start_processes(g_config, atrt_process::NDB_DB))
+ if(!start_processes(g_config, atrt_process::AP_NDBD))
goto end;
if(!wait_ndb(g_config, NDB_MGM_NODE_STATUS_NOT_STARTED))
@@ -166,7 +260,7 @@
const time_t start = time(0);
time_t now = start;
do {
- if(!update_status(g_config, atrt_process::ALL))
+ if(!update_status(g_config, atrt_process::AP_ALL))
goto end;
int count = 0;
@@ -190,7 +284,7 @@
result = ERR_MAX_TIME_ELAPSED;
break;
}
- sleep(1);
+ NdbSleep_SecSleep(1);
} while(true);
const time_t elapsed = time(0) - start;
@@ -248,23 +342,102 @@
g_test_case_file = 0;
}
- stop_processes(g_config, atrt_process::ALL);
+ stop_processes(g_config, atrt_process::AP_ALL);
+ return 0;
+}
+
+static
+my_bool
+get_one_option(int, const struct my_option * opt, char * value)
+{
return 0;
}
bool
-parse_args(int argc, const char** argv){
- int optind = 0;
- if(getarg(args, arg_count, argc, argv, &optind)) {
- arg_printusage(args, arg_count, progname, "");
+parse_args(int argc, char** argv)
+{
+ char buf[2048];
+ if (getcwd(buf, sizeof(buf)) == 0)
+ {
+ g_logger.error("Unable to get current working directory");
+ return false;
+ }
+ g_cwd = strdup(buf);
+
+ struct stat sbuf;
+ BaseString mycnf;
+ if (argc > 1 && lstat(argv[argc-1], &sbuf) == 0)
+ {
+ mycnf.append(g_cwd);
+ mycnf.append(PATH_SEPARATOR);
+ mycnf.append(argv[argc-1]);
+ }
+ else
+ {
+ mycnf.append(g_cwd);
+ mycnf.append(PATH_SEPARATOR);
+ mycnf.append("my.cnf");
+ if (lstat(mycnf.c_str(), &sbuf) != 0)
+ {
+ g_logger.error("Unable to stat %s", mycnf.c_str());
+ return false;
+ }
+ }
+
+ g_logger.info("Bootstrapping using %s", mycnf.c_str());
+
+ const char *groups[] = { "atrt", 0 };
+ int ret = load_defaults(mycnf.c_str(), groups, &argc, &argv);
+
+ save_file = defaults_file;
+ save_extra_file = defaults_extra_file;
+ save_group_suffix = defaults_group_suffix;
+
+ if (save_extra_file)
+ {
+ g_logger.error("--defaults-extra-file(%s) is not supported...",
+ save_extra_file);
+ return false;
+ }
+
+ if (ret || handle_options(&argc, &argv, g_options, get_one_option))
+ {
+ g_logger.error("Failed to load defaults/handle_options");
return false;
}
- if(g_log_filename != 0){
+ if (argc >= 2)
+ {
+ const char * arg = argv[argc-2];
+ while(* arg)
+ {
+ switch(* arg){
+ case 's':
+ g_do_setup = (g_do_setup == 0) ? 1 : g_do_setup;
+ break;
+ case 'S':
+ g_do_setup = 2;
+ break;
+ case 'd':
+ g_do_deploy = 1;
+ break;
+ case 'x':
+ g_do_sshx = 1;
+ break;
+ case 'f':
+ g_fqpn = 1;
+ break;
+ }
+ arg++;
+ }
+ }
+
+ if(g_log_filename != 0)
+ {
g_logger.removeConsoleHandler();
g_logger.addHandler(new FileLogHandler(g_log_filename));
}
-
+
{
int tmp = Logger::LL_WARNING - g_verbosity;
tmp = (tmp < Logger::LL_DEBUG ? Logger::LL_DEBUG : tmp);
@@ -272,252 +445,172 @@
g_logger.enable(Logger::LL_ON);
g_logger.enable((Logger::LoggerLevel)tmp, Logger::LL_ALERT);
}
-
-
-
- if(!g_process_config_filename){
- g_logger.critical("Process config not specified!");
- return false;
- }
- if(!g_setup_path){
- char buf[1024];
- if(getcwd(buf, sizeof(buf))){
- g_setup_path = strdup(buf);
- g_logger.info("Setup path not specified, using %s", buf);
- } else {
- g_logger.critical("Setup path not specified!\n");
- return false;
+ if(!g_basedir)
+ {
+ g_basedir = g_cwd;
+ g_my_cnf = strdup(mycnf.c_str());
+ g_logger.info("Setup path not specified, using %s", g_basedir);
+ }
+ else
+ {
+ if (g_do_setup >= 2)
+ {
+ if (!remove_dir(g_basedir))
+ {
+ g_logger.error("Failed to remove directory: %s",
+ g_basedir);
+ return false;
+ }
+ g_my_cnf = strdup(mycnf.c_str());
+ }
+ else
+ {
+ BaseString tmp;
+ tmp.append(g_basedir);
+ tmp.append(PATH_SEPARATOR);
+ tmp.append("my.cnf");
+ if (lstat(tmp.c_str(), &sbuf) != 0)
+ {
+ if (g_do_setup == 0)
+ {
+ g_logger.error("Unable to stat %s", tmp.c_str());
+ return false;
+ }
+ else
+ {
+ g_my_cnf = strdup(mycnf.c_str());
+ g_logger.info("Using %s", tmp.c_str());
+ }
+ }
+ else
+ {
+ g_my_cnf = strdup(tmp.c_str());
+ g_logger.info("Using %s", tmp.c_str());
+ }
}
}
- if(g_report & !g_report_filename){
+ if (!g_prefix)
+ {
+ g_prefix = DEFAULT_PREFIX;
+ }
+
+ g_logger.info("Using --prefix=\"%s\"", g_prefix);
+
+ if(g_report & !g_report_filename)
+ {
g_report_filename = "report.txt";
}
- if(g_report_filename){
+ if(g_report_filename)
+ {
g_report_file = fopen(g_report_filename, "w");
- if(g_report_file == 0){
+ if(g_report_file == 0)
+ {
g_logger.critical("Unable to create report file: %s", g_report_filename);
return false;
}
}
-
- if(g_test_case_filename){
+
+ if(g_test_case_filename)
+ {
g_test_case_file = fopen(g_test_case_filename, "r");
- if(g_test_case_file == 0){
+ if(g_test_case_file == 0)
+ {
g_logger.critical("Unable to open file: %s", g_test_case_filename);
return false;
}
}
+
+ if (g_clusters == 0)
+ {
+ g_logger.critical("No clusters specified");
+ return false;
+ }
int sum = g_mode_interactive + g_mode_regression + g_mode_bench;
- if(sum == 0){
+ if(sum == 0)
+ {
g_mode_interactive = 1;
}
- if(sum > 1){
+ if(sum > 1)
+ {
g_logger.critical
("Only one of bench/regression/interactive can be specified");
return false;
}
-
- g_default_user = strdup(getenv("LOGNAME"));
+ g_user = strdup(getenv("LOGNAME"));
+
return true;
}
-
-static
-atrt_host *
-find(const BaseString& host, Vector<atrt_host> & hosts){
- for(size_t i = 0; i<hosts.size(); i++){
- if(hosts[i].m_hostname == host){
- return &hosts[i];
- }
- }
- return 0;
-}
-
bool
-setup_config(atrt_config& config){
-
- FILE * f = fopen(g_process_config_filename, "r");
- if(!f){
- g_logger.critical("Failed to open process config file: %s",
- g_process_config_filename);
- return false;
- }
- bool result = true;
-
- int lineno = 0;
- char buf[2048];
- BaseString connect_string;
- int mysql_port_offset = 0;
- while(fgets(buf, 2048, f)){
- lineno++;
+remove_dir(const char * path, bool inclusive)
+{
+ DIR* dirp = opendir(path);
- BaseString tmp(buf);
- tmp.trim(" \t\n\r");
-
- if(tmp.length() == 0 || tmp == "" || tmp.c_str()[0] == '#')
- continue;
-
- Vector<BaseString> split1;
- if(tmp.split(split1, ":", 2) != 2){
- g_logger.warning("Invalid line %d in %s - ignoring",
- lineno, g_process_config_filename);
- continue;
- }
-
- if(split1[0].trim() == "basedir"){
- g_default_base_dir = strdup(split1[1].trim().c_str());
- continue;
- }
-
- if(split1[0].trim() == "baseport"){
- g_default_base_port = atoi(split1[1].trim().c_str());
- continue;
- }
-
- if(split1[0].trim() == "user"){
- g_default_user = strdup(split1[1].trim().c_str());
- continue;
- }
-
- if(split1[0].trim() == "mysqld-use-base" && split1[1].trim() == "no"){
- g_mysqld_use_base = 0;
- continue;
+ if (dirp == 0)
+ {
+ if(errno != ENOENT)
+ {
+ g_logger.error("Failed to remove >%s< errno: %d %s",
+ path, errno, strerror(errno));
+ return false;
}
-
- Vector<BaseString> hosts;
- if(split1[1].trim().split(hosts) <= 0){
- g_logger.warning("Invalid line %d in %s - ignoring",
- lineno, g_process_config_filename);
- }
-
- // 1 - Check hosts
- for(size_t i = 0; i<hosts.size(); i++){
- Vector<BaseString> tmp;
- hosts[i].split(tmp, ":");
- BaseString hostname = tmp[0].trim();
- BaseString base_dir;
- if(tmp.size() >= 2)
- base_dir = tmp[1];
- else if(g_default_base_dir == 0){
- g_logger.critical("Basedir not specified...");
- return false;
- }
-
- atrt_host * host_ptr;
- if((host_ptr = find(hostname, config.m_hosts)) == 0){
- atrt_host host;
- host.m_index = config.m_hosts.size();
- host.m_cpcd = new SimpleCpcClient(hostname.c_str(), 1234);
- host.m_base_dir = (base_dir.empty() ? g_default_base_dir : base_dir);
- host.m_user = g_default_user;
- host.m_hostname = hostname.c_str();
- config.m_hosts.push_back(host);
- } else {
- if(!base_dir.empty() && (base_dir == host_ptr->m_base_dir)){
- g_logger.critical("Inconsistent base dir definition for host %s"
- ", \"%s\" != \"%s\"", hostname.c_str(),
- base_dir.c_str(), host_ptr->m_base_dir.c_str());
- return false;
- }
- }
- }
-
- for(size_t i = 0; i<hosts.size(); i++){
- BaseString & tmp = hosts[i];
- atrt_host * host = find(tmp, config.m_hosts);
- BaseString & dir = host->m_base_dir;
-
- const int index = config.m_processes.size() + 1;
-
- atrt_process proc;
- proc.m_index = index;
- proc.m_host = host;
- proc.m_proc.m_id = -1;
- proc.m_proc.m_type = "temporary";
- proc.m_proc.m_owner = "atrt";
- proc.m_proc.m_group = "group";
- proc.m_proc.m_cwd.assign(dir).append("/run/");
- proc.m_proc.m_stdout = "log.out";
- proc.m_proc.m_stderr = "2>&1";
- proc.m_proc.m_runas = proc.m_host->m_user;
- proc.m_proc.m_ulimit = "c:unlimited";
- proc.m_proc.m_env.assfmt("MYSQL_BASE_DIR=%s", dir.c_str());
- proc.m_proc.m_shutdown_options = "";
- proc.m_hostname = proc.m_host->m_hostname;
- proc.m_ndb_mgm_port = g_default_base_port;
- if(split1[0] == "mgm"){
- proc.m_type = atrt_process::NDB_MGM;
- proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgmd");
- proc.m_proc.m_path.assign(dir).append("/libexec/ndb_mgmd");
- proc.m_proc.m_args = "--nodaemon -f config.ini";
- proc.m_proc.m_cwd.appfmt("%d.ndb_mgmd", index);
- connect_string.appfmt("host=%s:%d;",
- proc.m_hostname.c_str(), proc.m_ndb_mgm_port);
- } else if(split1[0] == "ndb"){
- proc.m_type = atrt_process::NDB_DB;
- proc.m_proc.m_name.assfmt("%d-%s", index, "ndbd");
- proc.m_proc.m_path.assign(dir).append("/libexec/ndbd");
- proc.m_proc.m_args = "--initial --nodaemon -n";
- proc.m_proc.m_cwd.appfmt("%d.ndbd", index);
- } else if(split1[0] == "mysqld"){
- proc.m_type = atrt_process::MYSQL_SERVER;
- proc.m_proc.m_name.assfmt("%d-%s", index, "mysqld");
- proc.m_proc.m_path.assign(dir).append("/libexec/mysqld");
- proc.m_proc.m_args = "--core-file --ndbcluster";
- proc.m_proc.m_cwd.appfmt("%d.mysqld", index);
- proc.m_proc.m_shutdown_options = "SIGKILL"; // not nice
- } else if(split1[0] == "api"){
- proc.m_type = atrt_process::NDB_API;
- proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api");
- proc.m_proc.m_path = "";
- proc.m_proc.m_args = "";
- proc.m_proc.m_cwd.appfmt("%d.ndb_api", index);
- } else if(split1[0] == "mysql"){
- proc.m_type = atrt_process::MYSQL_CLIENT;
- proc.m_proc.m_name.assfmt("%d-%s", index, "mysql");
- proc.m_proc.m_path = "";
- proc.m_proc.m_args = "";
- proc.m_proc.m_cwd.appfmt("%d.mysql", index);
- } else {
- g_logger.critical("%s:%d: Unhandled process type: %s",
- g_process_config_filename, lineno,
- split1[0].c_str());
- result = false;
- goto end;
+ return true;
+ }
+
+ struct dirent * dp;
+ BaseString name = path;
+ name.append("/");
+ while ((dp = readdir(dirp)) != NULL)
+ {
+ if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0))
+ {
+ BaseString tmp = name;
+ tmp.append(dp->d_name);
+
+ if (remove(tmp.c_str()) == 0)
+ {
+ continue;
+ }
+
+ if (!remove_dir(tmp.c_str()))
+ {
+ closedir(dirp);
+ return false;
}
- config.m_processes.push_back(proc);
}
}
- // Setup connect string
- for(size_t i = 0; i<config.m_processes.size(); i++){
- config.m_processes[i].m_proc.m_env.appfmt(" NDB_CONNECTSTRING=%s",
- connect_string.c_str());
+ closedir(dirp);
+ if (inclusive)
+ {
+ if (rmdir(path) != 0)
+ {
+ g_logger.error("Failed to remove >%s< errno: %d %s",
+ path, errno, strerror(errno));
+ return false;
+ }
}
-
- end:
- fclose(f);
- return result;
+ return true;
}
bool
connect_hosts(atrt_config& config){
for(size_t i = 0; i<config.m_hosts.size(); i++){
- if(config.m_hosts[i].m_cpcd->connect() != 0){
+ if(config.m_hosts[i]->m_cpcd->connect() != 0){
g_logger.error("Unable to connect to cpc %s:%d",
- config.m_hosts[i].m_cpcd->getHost(),
- config.m_hosts[i].m_cpcd->getPort());
+ config.m_hosts[i]->m_cpcd->getHost(),
+ config.m_hosts[i]->m_cpcd->getPort());
return false;
}
g_logger.debug("Connected to %s:%d",
- config.m_hosts[i].m_cpcd->getHost(),
- config.m_hosts[i].m_cpcd->getPort());
+ config.m_hosts[i]->m_cpcd->getHost(),
+ config.m_hosts[i]->m_cpcd->getPort());
}
return true;
@@ -530,8 +623,10 @@
g_logger.critical("Unable to create mgm handle");
return false;
}
- BaseString tmp = proc.m_hostname;
- tmp.appfmt(":%d", proc.m_ndb_mgm_port);
+ BaseString tmp = proc.m_host->m_hostname;
+ const char * val;
+ proc.m_options.get("--PortNumber=", &val);
+ tmp.appfmt(":%s", val);
if (ndb_mgm_set_connectstring(handle,tmp.c_str()))
{
@@ -552,8 +647,8 @@
bool
connect_ndb_mgm(atrt_config& config){
for(size_t i = 0; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
- if((proc.m_type & atrt_process::NDB_MGM) != 0){
+ atrt_process & proc = *config.m_processes[i];
+ if((proc.m_type & atrt_process::AP_NDB_MGMD) != 0){
if(!connect_ndb_mgm(proc)){
return false;
}
@@ -574,100 +669,110 @@
goal = remap(goal);
-
- /**
- * Get mgm handle for cluster
- */
- NdbMgmHandle handle = 0;
- for(size_t i = 0; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
- if((proc.m_type & atrt_process::NDB_MGM) != 0){
- handle = proc.m_ndb_mgm_handle;
- break;
- }
- }
- if(handle == 0){
- g_logger.critical("Unable to find mgm handle");
- return false;
- }
-
- if(goal == NDB_MGM_NODE_STATUS_STARTED){
+ size_t cnt = 0;
+ for (size_t i = 0; i<config.m_clusters.size(); i++)
+ {
+ atrt_cluster* cluster = config.m_clusters[i];
/**
- * 1) wait NOT_STARTED
- * 2) send start
- * 3) wait STARTED
+ * Get mgm handle for cluster
*/
- if(!wait_ndb(config, NDB_MGM_NODE_STATUS_NOT_STARTED))
+ NdbMgmHandle handle = 0;
+ for(size_t j = 0; j<cluster->m_processes.size(); j++){
+ atrt_process & proc = *cluster->m_processes[j];
+ if((proc.m_type & atrt_process::AP_NDB_MGMD) != 0){
+ handle = proc.m_ndb_mgm_handle;
+ break;
+ }
+ }
+
+ if(handle == 0){
+ g_logger.critical("Unable to find mgm handle");
return false;
+ }
- ndb_mgm_start(handle, 0, 0);
- }
-
- struct ndb_mgm_cluster_state * state;
-
- time_t now = time(0);
- time_t end = now + 360;
- int min = remap(NDB_MGM_NODE_STATUS_NO_CONTACT);
- int min2 = goal;
-
- while(now < end){
- /**
- * 1) retreive current state
- */
- state = 0;
- do {
- state = ndb_mgm_get_status(handle);
- if(state == 0){
- const int err = ndb_mgm_get_latest_error(handle);
- g_logger.error("Unable to poll db state: %d %s %s",
- ndb_mgm_get_latest_error(handle),
- ndb_mgm_get_latest_error_msg(handle),
- ndb_mgm_get_latest_error_desc(handle));
- if(err == NDB_MGM_SERVER_NOT_CONNECTED && connect_ndb_mgm(config)){
- g_logger.error("Reconnected...");
- continue;
- }
+ if(goal == NDB_MGM_NODE_STATUS_STARTED){
+ /**
+ * 1) wait NOT_STARTED
+ * 2) send start
+ * 3) wait STARTED
+ */
+ if(!wait_ndb(config, NDB_MGM_NODE_STATUS_NOT_STARTED))
return false;
- }
- } while(state == 0);
- NdbAutoPtr<void> tmp(state);
+
+ ndb_mgm_start(handle, 0, 0);
+ }
+
+ struct ndb_mgm_cluster_state * state;
- min2 = goal;
- for(int i = 0; i<state->no_of_nodes; i++){
- if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_NDB){
- const int s = remap(state->node_states[i].node_status);
- min2 = (min2 < s ? min2 : s );
-
- if(s < remap(NDB_MGM_NODE_STATUS_NO_CONTACT) ||
- s > NDB_MGM_NODE_STATUS_STARTED){
- g_logger.critical("Strange DB status during start: %d %d", i, min2);
+ time_t now = time(0);
+ time_t end = now + 360;
+ int min = remap(NDB_MGM_NODE_STATUS_NO_CONTACT);
+ int min2 = goal;
+
+ while(now < end){
+ /**
+ * 1) retreive current state
+ */
+ state = 0;
+ do {
+ state = ndb_mgm_get_status(handle);
+ if(state == 0){
+ const int err = ndb_mgm_get_latest_error(handle);
+ g_logger.error("Unable to poll db state: %d %s %s",
+ ndb_mgm_get_latest_error(handle),
+ ndb_mgm_get_latest_error_msg(handle),
+ ndb_mgm_get_latest_error_desc(handle));
+ if(err == NDB_MGM_SERVER_NOT_CONNECTED && connect_ndb_mgm(config)){
+ g_logger.error("Reconnected...");
+ continue;
+ }
return false;
}
-
- if(min2 < min){
- g_logger.critical("wait ndb failed node: %d %d %d %d",
- state->node_states[i].node_id, min, min2, goal);
+ } while(state == 0);
+ NdbAutoPtr<void> tmp(state);
+
+ min2 = goal;
+ for(int j = 0; j<state->no_of_nodes; j++){
+ if(state->node_states[j].node_type == NDB_MGM_NODE_TYPE_NDB){
+ const int s = remap(state->node_states[j].node_status);
+ min2 = (min2 < s ? min2 : s );
+
+ if(s < remap(NDB_MGM_NODE_STATUS_NO_CONTACT) ||
+ s > NDB_MGM_NODE_STATUS_STARTED){
+ g_logger.critical("Strange DB status during start: %d %d",
+ j, min2);
+ return false;
+ }
+
+ if(min2 < min){
+ g_logger.critical("wait ndb failed node: %d %d %d %d",
+ state->node_states[j].node_id, min, min2, goal);
+ }
}
}
+
+ if(min2 < min){
+ g_logger.critical("wait ndb failed %d %d %d", min, min2, goal);
+ return false;
+ }
+
+ if(min2 == goal){
+ cnt++;
+ goto next;
+ }
+
+ min = min2;
+ now = time(0);
}
- if(min2 < min){
- g_logger.critical("wait ndb failed %d %d %d", min, min2, goal);
- return false;
- }
-
- if(min2 == goal){
- return true;
- break;
- }
-
- min = min2;
- now = time(0);
+ g_logger.critical("wait ndb timed out %d %d %d", min, min2, goal);
+ break;
+
+next:
+ ;
}
-
- g_logger.critical("wait ndb timed out %d %d %d", min, min2, goal);
-
- return false;
+
+ return cnt == config.m_clusters.size();
}
bool
@@ -677,21 +782,19 @@
return false;
}
- BaseString path = proc.m_proc.m_cwd.substr(proc.m_host->m_base_dir.length()+BaseString("/run").length());
-
BaseString tmp = g_setup_progname;
- tmp.appfmt(" %s %s/%s/ %s",
+ tmp.appfmt(" %s %s/ %s",
proc.m_host->m_hostname.c_str(),
- g_setup_path,
- path.c_str(),
+ proc.m_proc.m_cwd.c_str(),
proc.m_proc.m_cwd.c_str());
-
+
+ g_logger.debug("system(%s)", tmp.c_str());
const int r1 = system(tmp.c_str());
if(r1 != 0){
g_logger.critical("Failed to setup process");
return false;
}
-
+
{
Properties reply;
if(proc.m_host->m_cpcd->define_process(proc.m_proc, reply) != 0){
@@ -716,7 +819,7 @@
bool
start_processes(atrt_config& config, int types){
for(size_t i = 0; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
+ atrt_process & proc = *config.m_processes[i];
if((types & proc.m_type) != 0 && proc.m_proc.m_path != ""){
if(!start_process(proc)){
return false;
@@ -761,7 +864,7 @@
bool
stop_processes(atrt_config& config, int types){
for(size_t i = 0; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
+ atrt_process & proc = *config.m_processes[i];
if((types & proc.m_type) != 0){
if(!stop_process(proc)){
return false;
@@ -780,11 +883,11 @@
m_procs.fill(config.m_hosts.size(), dummy);
for(size_t i = 0; i<config.m_hosts.size(); i++){
Properties p;
- config.m_hosts[i].m_cpcd->list_processes(m_procs[i], p);
+ config.m_hosts[i]->m_cpcd->list_processes(m_procs[i], p);
}
for(size_t i = 0; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
+ atrt_process & proc = *config.m_processes[i];
if(proc.m_proc.m_id != -1){
Vector<SimpleCpcClient::Process> &h_procs= m_procs[proc.m_host->m_index];
bool found = false;
@@ -799,7 +902,7 @@
g_logger.error("update_status: not found");
g_logger.error("id: %d host: %s cmd: %s",
proc.m_proc.m_id,
- proc.m_hostname.c_str(),
+ proc.m_host->m_hostname.c_str(),
proc.m_proc.m_path.c_str());
for(size_t j = 0; j<h_procs.size(); j++){
g_logger.error("found: %d %s", h_procs[j].m_id,
@@ -816,7 +919,7 @@
is_running(atrt_config& config, int types){
int found = 0, running = 0;
for(size_t i = 0; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
+ atrt_process & proc = *config.m_processes[i];
if((types & proc.m_type) != 0){
found++;
if(proc.m_proc.m_status == "running")
@@ -917,6 +1020,7 @@
bool
setup_test_case(atrt_config& config, const atrt_testcase& tc){
+ g_logger.debug("system(%s)", g_clear_progname);
const int r1 = system(g_clear_progname);
if(r1 != 0){
g_logger.critical("Failed to clear result");
@@ -925,9 +1029,9 @@
size_t i = 0;
for(; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
- if(proc.m_type == atrt_process::NDB_API || proc.m_type == atrt_process::MYSQL_CLIENT){
- proc.m_proc.m_path.assfmt("%s/bin/%s", proc.m_host->m_base_dir.c_str(),
+ atrt_process & proc = *config.m_processes[i];
+ if(proc.m_type == atrt_process::AP_NDB_API || proc.m_type == atrt_process::AP_MYSQL_CLIENT){
+ proc.m_proc.m_path.assfmt("%s/bin/%s", proc.m_host->m_basedir.c_str(),
tc.m_command.c_str());
proc.m_proc.m_args.assign(tc.m_args);
if(!tc.m_run_all)
@@ -935,8 +1039,8 @@
}
}
for(i++; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
- if(proc.m_type == atrt_process::NDB_API || proc.m_type == atrt_process::MYSQL_CLIENT){
+ atrt_process & proc = *config.m_processes[i];
+ if(proc.m_type == atrt_process::AP_NDB_API || proc.m_type == atrt_process::AP_MYSQL_CLIENT){
proc.m_proc.m_path.assign("");
proc.m_proc.m_args.assign("");
}
@@ -948,20 +1052,22 @@
gather_result(atrt_config& config, int * result){
BaseString tmp = g_gather_progname;
for(size_t i = 0; i<config.m_processes.size(); i++){
- atrt_process & proc = config.m_processes[i];
+ atrt_process & proc = *config.m_processes[i];
if(proc.m_proc.m_path != ""){
tmp.appfmt(" %s:%s",
- proc.m_hostname.c_str(),
+ proc.m_host->m_hostname.c_str(),
proc.m_proc.m_cwd.c_str());
}
}
+ g_logger.debug("system(%s)", tmp.c_str());
const int r1 = system(tmp.c_str());
if(r1 != 0){
g_logger.critical("Failed to gather result");
return false;
}
+ g_logger.debug("system(%s)", g_analyze_progname);
const int r2 = system(g_analyze_progname);
if(r2 == -1 || r2 == (127 << 8)){
@@ -975,6 +1081,7 @@
bool
setup_hosts(atrt_config& config){
+ g_logger.debug("system(%s)", g_clear_progname);
const int r1 = system(g_clear_progname);
if(r1 != 0){
g_logger.critical("Failed to clear result");
@@ -983,21 +1090,99 @@
for(size_t i = 0; i<config.m_hosts.size(); i++){
BaseString tmp = g_setup_progname;
- tmp.appfmt(" %s %s/ %s/run",
- config.m_hosts[i].m_hostname.c_str(),
- g_setup_path,
- config.m_hosts[i].m_base_dir.c_str());
+ tmp.appfmt(" %s %s/ %s/",
+ config.m_hosts[i]->m_hostname.c_str(),
+ g_basedir,
+ config.m_hosts[i]->m_basedir.c_str());
+ g_logger.debug("system(%s)", tmp.c_str());
const int r1 = system(tmp.c_str());
if(r1 != 0){
g_logger.critical("Failed to setup %s",
- config.m_hosts[i].m_hostname.c_str());
+ config.m_hosts[i]->m_hostname.c_str());
+ return false;
+ }
+ }
+ return true;
+}
+
+bool
+deploy(atrt_config & config)
+{
+ for (size_t i = 0; i<config.m_hosts.size(); i++)
+ {
+ BaseString tmp = g_setup_progname;
+ tmp.appfmt(" %s %s/ %s",
+ config.m_hosts[i]->m_hostname.c_str(),
+ g_prefix,
+ g_prefix);
+
+ g_logger.debug("system(%s)", tmp.c_str());
+ const int r1 = system(tmp.c_str());
+ if(r1 != 0)
+ {
+ g_logger.critical("Failed to rsync %s to %s",
+ g_prefix,
+ config.m_hosts[i]->m_hostname.c_str());
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool
+sshx(atrt_config & config)
+{
+ for (size_t i = 0; i<config.m_processes.size(); i++)
+ {
+ atrt_process & proc = *config.m_processes[i];
+
+ BaseString tmp;
+ const char * type;
+ switch(proc.m_type){
+ case atrt_process::AP_NDB_MGMD:
+ type = "ndb_mgmd";
+ break;
+ case atrt_process::AP_NDBD:
+ type = "ndbd";
+ break;
+ case atrt_process::AP_MYSQLD:
+ type = "mysqld";
+ break;
+ case atrt_process::AP_NDB_API:
+ type = "ndbapi";
+ break;
+ case atrt_process::AP_MYSQL_CLIENT:
+ type = "client";
+ break;
+ default:
+ type = "<unknown>";
+ }
+
+ tmp.appfmt("xterm -fg black -title \"%s(%s) on %s\""
+ " -e 'ssh -t -X %s sh %s/ssh-login.sh' &",
+ type,
+ proc.m_cluster->m_name.c_str(),
+ proc.m_host->m_hostname.c_str(),
+ proc.m_host->m_hostname.c_str(),
+ proc.m_proc.m_cwd.c_str());
+
+ g_logger.debug("system(%s)", tmp.c_str());
+ const int r1 = system(tmp.c_str());
+ if(r1 != 0)
+ {
+ g_logger.critical("Failed sshx (%s)",
+ tmp.c_str());
return false;
}
+ NdbSleep_MilliSleep(300); // To prevent xlock problem
}
+
return true;
}
template class Vector<Vector<SimpleCpcClient::Process> >;
-template class Vector<atrt_host>;
-template class Vector<atrt_process>;
+template class Vector<atrt_host*>;
+template class Vector<atrt_cluster*>;
+template class Vector<atrt_process*>;
--- 1.6/ndb/test/run-test/run-test.hpp 2005-05-06 14:47:34 +02:00
+++ 1.8/ndb/test/run-test/atrt.hpp 2006-05-26 14:27:19 +02:00
@@ -17,15 +17,12 @@
#ifndef atrt_config_hpp
#define atrt_config_hpp
-#include <getarg.h>
#include <Vector.hpp>
#include <BaseString.hpp>
#include <Logger.hpp>
#include <mgmapi.h>
#include <CpcClient.hpp>
-#undef MYSQL_CLIENT
-
enum ErrorCodes {
ERR_OK = 0,
ERR_NDB_FAILED = 101,
@@ -36,35 +33,47 @@
struct atrt_host {
size_t m_index;
BaseString m_user;
- BaseString m_base_dir;
+ BaseString m_basedir;
BaseString m_hostname;
SimpleCpcClient * m_cpcd;
+ Vector<struct atrt_process*> m_processes;
};
struct atrt_process {
size_t m_index;
- BaseString m_hostname;
struct atrt_host * m_host;
+ struct atrt_cluster * m_cluster;
enum Type {
- ALL = 255,
- NDB_DB = 1,
- NDB_API = 2,
- NDB_MGM = 4,
- NDB_REP = 8,
- MYSQL_SERVER = 16,
- MYSQL_CLIENT = 32
+ AP_ALL = 255,
+ AP_NDBD = 1,
+ AP_NDB_API = 2,
+ AP_NDB_MGMD = 4,
+ AP_MYSQLD = 16,
+ AP_MYSQL_CLIENT = 32
} m_type;
SimpleCpcClient::Process m_proc;
- short m_ndb_mgm_port;
NdbMgmHandle m_ndb_mgm_handle; // if type == ndb_mgm
+ Properties m_options;
+ Properties m_generated;
+};
+
+struct atrt_cluster
+{
+ BaseString m_name;
+ BaseString m_dir;
+ Vector<atrt_process*> m_processes;
+ Properties m_options;
+ Properties m_generated;
};
struct atrt_config {
+ bool m_generated;
BaseString m_key;
- Vector<atrt_host> m_hosts;
- Vector<atrt_process> m_processes;
+ Vector<atrt_host*> m_hosts;
+ Vector<atrt_cluster*> m_clusters;
+ Vector<atrt_process*> m_processes;
};
struct atrt_testcase {
@@ -77,8 +86,16 @@
extern Logger g_logger;
-bool parse_args(int argc, const char** argv);
+bool parse_args(int argc, char** argv);
bool setup_config(atrt_config&);
+bool configure(atrt_config&, bool generate);
+bool setup_directories(atrt_config&, int setup);
+bool setup_files(atrt_config&, int setup, int sshx);
+
+bool deploy(atrt_config&);
+bool sshx(atrt_config&);
+
+bool remove_dir(const char *, bool incl = true);
bool connect_hosts(atrt_config&);
bool connect_ndb_mgm(atrt_config&);
bool wait_ndb(atrt_config&, int ndb_mgm_node_status);
@@ -92,5 +109,25 @@
bool setup_test_case(atrt_config&, const atrt_testcase&);
bool setup_hosts(atrt_config&);
+
+/**
+ * Global variables...
+ */
+extern Logger g_logger;
+extern atrt_config g_config;
+
+extern const char * g_cwd;
+extern const char * g_my_cnf;
+extern const char * g_user;
+extern const char * g_basedir;
+extern const char * g_prefix;
+extern int g_baseport;
+extern int g_fqpn;
+
+extern const char * g_clusters;
+
+extern const char *save_file;
+extern const char *save_group_suffix;
+extern char *save_extra_file;
#endif
--- 1.23/ndb/test/run-test/Makefile.am 2006-03-22 15:10:35 +01:00
+++ 1.24/ndb/test/run-test/Makefile.am 2006-05-26 14:27:19 +02:00
@@ -4,6 +4,7 @@
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am
include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
+include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am
test_PROGRAMS = atrt
test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-tests.txt \
@@ -14,13 +15,21 @@
test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh
-atrt_SOURCES = main.cpp run-test.hpp
+atrt_SOURCES = main.cpp setup.cpp
+
INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include
LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+
+atrt_CXXFLAGS = -I$(top_srcdir)/ndb/src/mgmapi \
+ -I$(top_srcdir)/ndb/src/mgmsrv \
+ -I$(top_srcdir)/ndb/include/mgmcommon \
+ -DMYSQLCLUSTERDIR="\"\"" \
+ -DDEFAULT_PREFIX="\"$(prefix)\""
+
wrappersdir=$(prefix)/bin
wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run
| Thread |
|---|
| • bk commit into 5.0 tree (jonas:1.2165) | jonas | 29 May |