2019-01-29 10:43:35 +00:00
|
|
|
#include <algorithm>
|
2019-01-25 18:35:16 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <limits>
|
|
|
|
#include <regex>
|
|
|
|
#include <thread>
|
2019-01-28 16:20:29 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2019-01-25 18:35:16 +00:00
|
|
|
#include <port/unistd.h>
|
2019-01-28 16:20:29 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2019-01-25 18:35:16 +00:00
|
|
|
#include <boost/filesystem.hpp>
|
|
|
|
#include <boost/program_options.hpp>
|
2019-01-28 16:20:29 +00:00
|
|
|
|
2019-02-04 17:37:55 +00:00
|
|
|
#include <Poco/AutoPtr.h>
|
2019-01-28 16:20:29 +00:00
|
|
|
#include <Poco/ConsoleChannel.h>
|
|
|
|
#include <Poco/FormattingChannel.h>
|
2019-02-04 17:37:55 +00:00
|
|
|
#include <Poco/Logger.h>
|
|
|
|
#include <Poco/Path.h>
|
2019-01-28 16:20:29 +00:00
|
|
|
#include <Poco/PatternFormatter.h>
|
2019-02-04 17:37:55 +00:00
|
|
|
#include <Poco/Util/XMLConfiguration.h>
|
2019-01-25 18:35:16 +00:00
|
|
|
|
2019-01-28 11:20:44 +00:00
|
|
|
#include <common/logger_useful.h>
|
2019-01-25 18:35:16 +00:00
|
|
|
#include <Client/Connection.h>
|
|
|
|
#include <Core/Types.h>
|
2019-01-28 16:20:29 +00:00
|
|
|
#include <Interpreters/Context.h>
|
2019-01-25 18:35:16 +00:00
|
|
|
#include <IO/ConnectionTimeouts.h>
|
|
|
|
#include <IO/UseSSL.h>
|
2019-03-22 12:08:30 +00:00
|
|
|
#include <Core/Settings.h>
|
2019-01-28 16:20:29 +00:00
|
|
|
#include <Common/Exception.h>
|
2019-01-25 18:35:16 +00:00
|
|
|
#include <Common/InterruptListener.h>
|
|
|
|
|
|
|
|
#include "TestStopConditions.h"
|
|
|
|
#include "TestStats.h"
|
|
|
|
#include "ConfigPreprocessor.h"
|
|
|
|
#include "PerformanceTest.h"
|
|
|
|
#include "ReportBuilder.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace fs = boost::filesystem;
|
2019-01-28 16:20:29 +00:00
|
|
|
namespace po = boost::program_options;
|
2019-01-25 18:35:16 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int BAD_ARGUMENTS;
|
|
|
|
extern const int FILE_DOESNT_EXIST;
|
|
|
|
}
|
|
|
|
|
2019-01-29 10:05:15 +00:00
|
|
|
/** Tests launcher for ClickHouse.
|
|
|
|
* The tool walks through given or default folder in order to find files with
|
|
|
|
* tests' descriptions and launches it.
|
|
|
|
*/
|
2019-01-28 16:20:29 +00:00
|
|
|
class PerformanceTestSuite
|
2019-01-25 18:35:16 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
PerformanceTestSuite(const std::string & host_,
|
2019-01-25 18:35:16 +00:00
|
|
|
const UInt16 port_,
|
|
|
|
const bool secure_,
|
2019-01-28 16:20:29 +00:00
|
|
|
const std::string & default_database_,
|
|
|
|
const std::string & user_,
|
|
|
|
const std::string & password_,
|
2019-04-25 14:08:20 +00:00
|
|
|
const Settings & cmd_settings,
|
2019-01-25 18:35:16 +00:00
|
|
|
const bool lite_output_,
|
2019-01-28 16:20:29 +00:00
|
|
|
const std::string & profiles_file_,
|
2019-01-25 18:35:16 +00:00
|
|
|
Strings && input_files_,
|
|
|
|
Strings && tests_tags_,
|
|
|
|
Strings && skip_tags_,
|
|
|
|
Strings && tests_names_,
|
|
|
|
Strings && skip_names_,
|
|
|
|
Strings && tests_names_regexp_,
|
|
|
|
Strings && skip_names_regexp_,
|
2019-02-04 17:37:55 +00:00
|
|
|
const std::unordered_map<std::string, std::vector<size_t>> query_indexes_,
|
2019-03-02 21:41:28 +00:00
|
|
|
const ConnectionTimeouts & timeouts_)
|
2019-01-28 16:20:29 +00:00
|
|
|
: connection(host_, port_, default_database_, user_,
|
2019-03-02 21:41:28 +00:00
|
|
|
password_, "performance-test", Protocol::Compression::Enable,
|
2019-01-28 16:20:29 +00:00
|
|
|
secure_ ? Protocol::Secure::Enable : Protocol::Secure::Disable)
|
2019-03-02 21:41:28 +00:00
|
|
|
, timeouts(timeouts_)
|
2019-01-28 16:20:29 +00:00
|
|
|
, tests_tags(std::move(tests_tags_))
|
|
|
|
, tests_names(std::move(tests_names_))
|
|
|
|
, tests_names_regexp(std::move(tests_names_regexp_))
|
|
|
|
, skip_tags(std::move(skip_tags_))
|
|
|
|
, skip_names(std::move(skip_names_))
|
|
|
|
, skip_names_regexp(std::move(skip_names_regexp_))
|
2019-02-04 17:37:55 +00:00
|
|
|
, query_indexes(query_indexes_)
|
2019-01-28 16:20:29 +00:00
|
|
|
, lite_output(lite_output_)
|
|
|
|
, profiles_file(profiles_file_)
|
|
|
|
, input_files(input_files_)
|
|
|
|
, log(&Poco::Logger::get("PerformanceTestSuite"))
|
2019-01-25 18:35:16 +00:00
|
|
|
{
|
2019-04-25 14:08:20 +00:00
|
|
|
global_context.getSettingsRef().copyChangesFrom(cmd_settings);
|
2019-01-25 18:35:16 +00:00
|
|
|
if (input_files.size() < 1)
|
2019-01-28 16:20:29 +00:00
|
|
|
throw Exception("No tests were specified", ErrorCodes::BAD_ARGUMENTS);
|
2019-01-25 18:35:16 +00:00
|
|
|
}
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
int run()
|
2019-01-25 18:35:16 +00:00
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
UInt64 version_major;
|
|
|
|
UInt64 version_minor;
|
|
|
|
UInt64 version_patch;
|
|
|
|
UInt64 version_revision;
|
2019-03-02 21:41:28 +00:00
|
|
|
connection.getServerVersion(timeouts, name, version_major, version_minor, version_patch, version_revision);
|
2019-01-25 18:35:16 +00:00
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
ss << version_major << "." << version_minor << "." << version_patch;
|
|
|
|
server_version = ss.str();
|
|
|
|
|
|
|
|
report_builder = std::make_shared<ReportBuilder>(server_version);
|
|
|
|
|
|
|
|
processTestsConfigurations(input_files);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2019-01-28 16:20:29 +00:00
|
|
|
Connection connection;
|
2019-03-02 21:41:28 +00:00
|
|
|
const ConnectionTimeouts & timeouts;
|
2019-01-28 16:20:29 +00:00
|
|
|
|
2019-01-25 18:35:16 +00:00
|
|
|
const Strings & tests_tags;
|
|
|
|
const Strings & tests_names;
|
|
|
|
const Strings & tests_names_regexp;
|
|
|
|
const Strings & skip_tags;
|
|
|
|
const Strings & skip_names;
|
|
|
|
const Strings & skip_names_regexp;
|
2019-02-04 17:37:55 +00:00
|
|
|
std::unordered_map<std::string, std::vector<size_t>> query_indexes;
|
2019-01-25 18:35:16 +00:00
|
|
|
|
2019-01-28 11:20:44 +00:00
|
|
|
Context global_context = Context::createGlobal();
|
2019-07-08 02:14:32 +00:00
|
|
|
global_context.makeGlobalContext();
|
2019-01-25 18:35:16 +00:00
|
|
|
std::shared_ptr<ReportBuilder> report_builder;
|
|
|
|
|
|
|
|
std::string server_version;
|
|
|
|
|
|
|
|
InterruptListener interrupt_listener;
|
|
|
|
|
|
|
|
using XMLConfiguration = Poco::Util::XMLConfiguration;
|
|
|
|
using XMLConfigurationPtr = Poco::AutoPtr<XMLConfiguration>;
|
|
|
|
|
|
|
|
bool lite_output;
|
2019-01-28 16:20:29 +00:00
|
|
|
std::string profiles_file;
|
2019-01-25 18:35:16 +00:00
|
|
|
|
|
|
|
Strings input_files;
|
|
|
|
std::vector<XMLConfigurationPtr> tests_configurations;
|
2019-01-28 16:20:29 +00:00
|
|
|
Poco::Logger * log;
|
2019-01-25 18:35:16 +00:00
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
void processTestsConfigurations(const Strings & paths)
|
2019-01-25 18:35:16 +00:00
|
|
|
{
|
2019-01-28 16:20:29 +00:00
|
|
|
LOG_INFO(log, "Preparing test configurations");
|
2019-01-25 18:35:16 +00:00
|
|
|
ConfigPreprocessor config_prep(paths);
|
|
|
|
tests_configurations = config_prep.processConfig(
|
|
|
|
tests_tags,
|
|
|
|
tests_names,
|
|
|
|
tests_names_regexp,
|
|
|
|
skip_tags,
|
|
|
|
skip_names,
|
|
|
|
skip_names_regexp);
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
LOG_INFO(log, "Test configurations prepared");
|
|
|
|
|
2019-01-25 18:35:16 +00:00
|
|
|
if (tests_configurations.size())
|
|
|
|
{
|
|
|
|
Strings outputs;
|
|
|
|
|
|
|
|
for (auto & test_config : tests_configurations)
|
|
|
|
{
|
2019-01-28 16:20:29 +00:00
|
|
|
auto [output, signal] = runTest(test_config);
|
2019-02-11 15:45:41 +00:00
|
|
|
if (!output.empty())
|
|
|
|
{
|
|
|
|
if (lite_output)
|
|
|
|
std::cout << output;
|
|
|
|
else
|
|
|
|
outputs.push_back(output);
|
|
|
|
}
|
2019-01-28 16:20:29 +00:00
|
|
|
if (signal)
|
|
|
|
break;
|
2019-01-25 18:35:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!lite_output && outputs.size())
|
|
|
|
{
|
|
|
|
std::cout << "[" << std::endl;
|
|
|
|
|
|
|
|
for (size_t i = 0; i != outputs.size(); ++i)
|
|
|
|
{
|
|
|
|
std::cout << outputs[i];
|
|
|
|
if (i != outputs.size() - 1)
|
|
|
|
std::cout << ",";
|
|
|
|
|
|
|
|
std::cout << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << "]" << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
std::pair<std::string, bool> runTest(XMLConfigurationPtr & test_config)
|
2019-01-25 18:35:16 +00:00
|
|
|
{
|
2019-02-18 15:43:58 +00:00
|
|
|
PerformanceTestInfo info(test_config, profiles_file, global_context.getSettingsRef());
|
2019-01-28 16:20:29 +00:00
|
|
|
LOG_INFO(log, "Config for test '" << info.test_name << "' parsed");
|
2019-03-02 21:41:28 +00:00
|
|
|
PerformanceTest current(test_config, connection, timeouts, interrupt_listener, info, global_context, query_indexes[info.path]);
|
2019-01-28 16:20:29 +00:00
|
|
|
|
2019-02-11 15:45:41 +00:00
|
|
|
if (current.checkPreconditions())
|
|
|
|
{
|
|
|
|
LOG_INFO(log, "Preconditions for test '" << info.test_name << "' are fullfilled");
|
|
|
|
LOG_INFO(
|
|
|
|
log,
|
2019-05-21 12:57:19 +00:00
|
|
|
"Preparing for run, have " << info.create_and_fill_queries.size() << " create and fill queries");
|
2019-02-11 15:45:41 +00:00
|
|
|
current.prepare();
|
|
|
|
LOG_INFO(log, "Prepared");
|
|
|
|
LOG_INFO(log, "Running test '" << info.test_name << "'");
|
|
|
|
auto result = current.execute();
|
|
|
|
LOG_INFO(log, "Test '" << info.test_name << "' finished");
|
|
|
|
|
|
|
|
LOG_INFO(log, "Running post run queries");
|
|
|
|
current.finish();
|
|
|
|
LOG_INFO(log, "Postqueries finished");
|
|
|
|
if (lite_output)
|
|
|
|
return {report_builder->buildCompactReport(info, result, query_indexes[info.path]), current.checkSIGINT()};
|
|
|
|
else
|
|
|
|
return {report_builder->buildFullReport(info, result, query_indexes[info.path]), current.checkSIGINT()};
|
|
|
|
}
|
2019-01-25 18:35:16 +00:00
|
|
|
else
|
2019-02-11 15:45:41 +00:00
|
|
|
LOG_INFO(log, "Preconditions for test '" << info.test_name << "' are not fullfilled, skip run");
|
2019-01-25 18:35:16 +00:00
|
|
|
|
2019-02-11 15:45:41 +00:00
|
|
|
return {"", current.checkSIGINT()};
|
|
|
|
}
|
2019-01-25 18:35:16 +00:00
|
|
|
};
|
2019-01-28 16:20:29 +00:00
|
|
|
|
2019-01-25 18:35:16 +00:00
|
|
|
}
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
static void getFilesFromDir(const fs::path & dir, std::vector<std::string> & input_files, const bool recursive = false)
|
2019-01-25 18:35:16 +00:00
|
|
|
{
|
2019-01-28 16:20:29 +00:00
|
|
|
Poco::Logger * log = &Poco::Logger::get("PerformanceTestSuite");
|
2019-01-25 18:35:16 +00:00
|
|
|
if (dir.extension().string() == ".xml")
|
2019-01-28 16:20:29 +00:00
|
|
|
LOG_WARNING(log, dir.string() + "' is a directory, but has .xml extension");
|
2019-01-25 18:35:16 +00:00
|
|
|
|
|
|
|
fs::directory_iterator end;
|
|
|
|
for (fs::directory_iterator it(dir); it != end; ++it)
|
|
|
|
{
|
|
|
|
const fs::path file = (*it);
|
|
|
|
if (recursive && fs::is_directory(file))
|
|
|
|
getFilesFromDir(file, input_files, recursive);
|
|
|
|
else if (!fs::is_directory(file) && file.extension().string() == ".xml")
|
|
|
|
input_files.push_back(file.string());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
static std::vector<std::string> getInputFiles(const po::variables_map & options, Poco::Logger * log)
|
2019-01-25 18:35:16 +00:00
|
|
|
{
|
2019-01-28 16:20:29 +00:00
|
|
|
std::vector<std::string> input_files;
|
2019-01-25 18:35:16 +00:00
|
|
|
bool recursive = options.count("recursive");
|
|
|
|
|
|
|
|
if (!options.count("input-files"))
|
|
|
|
{
|
2019-01-28 11:20:44 +00:00
|
|
|
LOG_INFO(log, "Trying to find test scenario files in the current folder...");
|
2019-01-25 18:35:16 +00:00
|
|
|
fs::path curr_dir(".");
|
|
|
|
|
|
|
|
getFilesFromDir(curr_dir, input_files, recursive);
|
|
|
|
|
|
|
|
if (input_files.empty())
|
|
|
|
throw DB::Exception("Did not find any xml files", DB::ErrorCodes::BAD_ARGUMENTS);
|
|
|
|
else
|
2019-01-28 16:20:29 +00:00
|
|
|
LOG_INFO(log, "Found " << input_files.size() << " files");
|
2019-01-25 18:35:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-01-28 16:20:29 +00:00
|
|
|
input_files = options["input-files"].as<std::vector<std::string>>();
|
2019-01-28 11:20:44 +00:00
|
|
|
LOG_INFO(log, "Found " + std::to_string(input_files.size()) + " input files");
|
2019-01-28 16:20:29 +00:00
|
|
|
std::vector<std::string> collected_files;
|
2019-01-25 18:35:16 +00:00
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
for (const std::string & filename : input_files)
|
2019-01-25 18:35:16 +00:00
|
|
|
{
|
|
|
|
fs::path file(filename);
|
|
|
|
|
|
|
|
if (!fs::exists(file))
|
|
|
|
throw DB::Exception("File '" + filename + "' does not exist", DB::ErrorCodes::FILE_DOESNT_EXIST);
|
|
|
|
|
|
|
|
if (fs::is_directory(file))
|
|
|
|
{
|
|
|
|
getFilesFromDir(file, collected_files, recursive);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (file.extension().string() != ".xml")
|
|
|
|
throw DB::Exception("File '" + filename + "' does not have .xml extension", DB::ErrorCodes::BAD_ARGUMENTS);
|
|
|
|
collected_files.push_back(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
input_files = std::move(collected_files);
|
|
|
|
}
|
2019-01-29 10:43:35 +00:00
|
|
|
std::sort(input_files.begin(), input_files.end());
|
2019-01-28 16:20:29 +00:00
|
|
|
return input_files;
|
|
|
|
}
|
|
|
|
|
2019-02-04 17:37:55 +00:00
|
|
|
std::unordered_map<std::string, std::vector<std::size_t>> getTestQueryIndexes(const po::basic_parsed_options<char> & parsed_opts)
|
|
|
|
{
|
|
|
|
std::unordered_map<std::string, std::vector<std::size_t>> result;
|
|
|
|
const auto & options = parsed_opts.options;
|
2019-04-23 14:02:26 +00:00
|
|
|
if (options.empty())
|
|
|
|
return result;
|
2019-02-04 17:37:55 +00:00
|
|
|
for (size_t i = 0; i < options.size() - 1; ++i)
|
|
|
|
{
|
|
|
|
const auto & opt = options[i];
|
|
|
|
if (opt.string_key == "input-files")
|
|
|
|
{
|
|
|
|
if (options[i + 1].string_key == "query-indexes")
|
|
|
|
{
|
|
|
|
const std::string & test_path = Poco::Path(opt.value[0]).absolute().toString();
|
|
|
|
for (const auto & query_num_str : options[i + 1].value)
|
|
|
|
{
|
|
|
|
size_t query_num = std::stoul(query_num_str);
|
|
|
|
result[test_path].push_back(query_num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
int mainEntryClickHousePerformanceTest(int argc, char ** argv)
|
|
|
|
try
|
|
|
|
{
|
|
|
|
using po::value;
|
|
|
|
using Strings = DB::Strings;
|
|
|
|
|
|
|
|
|
|
|
|
po::options_description desc("Allowed options");
|
|
|
|
desc.add_options()
|
|
|
|
("help", "produce help message")
|
|
|
|
("lite", "use lite version of output")
|
|
|
|
("profiles-file", value<std::string>()->default_value(""), "Specify a file with global profiles")
|
|
|
|
("host,h", value<std::string>()->default_value("localhost"), "")
|
|
|
|
("port", value<UInt16>()->default_value(9000), "")
|
|
|
|
("secure,s", "Use TLS connection")
|
|
|
|
("database", value<std::string>()->default_value("default"), "")
|
|
|
|
("user", value<std::string>()->default_value("default"), "")
|
|
|
|
("password", value<std::string>()->default_value(""), "")
|
|
|
|
("log-level", value<std::string>()->default_value("information"), "Set log level")
|
|
|
|
("tags", value<Strings>()->multitoken(), "Run only tests with tag")
|
|
|
|
("skip-tags", value<Strings>()->multitoken(), "Do not run tests with tag")
|
|
|
|
("names", value<Strings>()->multitoken(), "Run tests with specific name")
|
|
|
|
("skip-names", value<Strings>()->multitoken(), "Do not run tests with name")
|
|
|
|
("names-regexp", value<Strings>()->multitoken(), "Run tests with names matching regexp")
|
|
|
|
("skip-names-regexp", value<Strings>()->multitoken(), "Do not run tests with names matching regexp")
|
2019-02-04 17:37:55 +00:00
|
|
|
("input-files", value<Strings>()->multitoken(), "Input .xml files")
|
|
|
|
("query-indexes", value<std::vector<size_t>>()->multitoken(), "Input query indexes")
|
2019-02-18 15:43:58 +00:00
|
|
|
("recursive,r", "Recurse in directories to find all xml's")
|
2019-04-25 14:08:20 +00:00
|
|
|
;
|
2019-02-18 15:43:58 +00:00
|
|
|
|
2019-04-25 14:08:20 +00:00
|
|
|
DB::Settings cmd_settings;
|
|
|
|
cmd_settings.addProgramOptions(desc);
|
2019-01-28 16:20:29 +00:00
|
|
|
|
|
|
|
po::options_description cmdline_options;
|
2019-02-04 17:37:55 +00:00
|
|
|
cmdline_options.add(desc);
|
2019-01-28 16:20:29 +00:00
|
|
|
|
|
|
|
po::variables_map options;
|
2019-02-04 17:37:55 +00:00
|
|
|
po::basic_parsed_options<char> parsed = po::command_line_parser(argc, argv).options(cmdline_options).run();
|
|
|
|
auto queries_with_indexes = getTestQueryIndexes(parsed);
|
|
|
|
po::store(parsed, options);
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
po::notify(options);
|
|
|
|
|
|
|
|
Poco::AutoPtr<Poco::PatternFormatter> formatter(new Poco::PatternFormatter("%Y.%m.%d %H:%M:%S.%F <%p> %s: %t"));
|
|
|
|
Poco::AutoPtr<Poco::ConsoleChannel> console_chanel(new Poco::ConsoleChannel);
|
|
|
|
Poco::AutoPtr<Poco::FormattingChannel> channel(new Poco::FormattingChannel(formatter, console_chanel));
|
|
|
|
|
|
|
|
Poco::Logger::root().setLevel(options["log-level"].as<std::string>());
|
|
|
|
Poco::Logger::root().setChannel(channel);
|
|
|
|
|
|
|
|
Poco::Logger * log = &Poco::Logger::get("PerformanceTestSuite");
|
|
|
|
if (options.count("help"))
|
|
|
|
{
|
2019-05-16 10:52:41 +00:00
|
|
|
std::cout << "Usage: " << argv[0] << " [options]\n";
|
2019-01-28 16:20:29 +00:00
|
|
|
std::cout << desc << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Strings input_files = getInputFiles(options, log);
|
2019-01-25 18:35:16 +00:00
|
|
|
|
|
|
|
Strings tests_tags = options.count("tags") ? options["tags"].as<Strings>() : Strings({});
|
|
|
|
Strings skip_tags = options.count("skip-tags") ? options["skip-tags"].as<Strings>() : Strings({});
|
|
|
|
Strings tests_names = options.count("names") ? options["names"].as<Strings>() : Strings({});
|
|
|
|
Strings skip_names = options.count("skip-names") ? options["skip-names"].as<Strings>() : Strings({});
|
|
|
|
Strings tests_names_regexp = options.count("names-regexp") ? options["names-regexp"].as<Strings>() : Strings({});
|
|
|
|
Strings skip_names_regexp = options.count("skip-names-regexp") ? options["skip-names-regexp"].as<Strings>() : Strings({});
|
|
|
|
|
|
|
|
auto timeouts = DB::ConnectionTimeouts::getTCPTimeoutsWithoutFailover(DB::Settings());
|
|
|
|
|
|
|
|
DB::UseSSL use_ssl;
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
DB::PerformanceTestSuite performance_test_suite(
|
|
|
|
options["host"].as<std::string>(),
|
2019-01-25 18:35:16 +00:00
|
|
|
options["port"].as<UInt16>(),
|
|
|
|
options.count("secure"),
|
2019-01-28 16:20:29 +00:00
|
|
|
options["database"].as<std::string>(),
|
|
|
|
options["user"].as<std::string>(),
|
|
|
|
options["password"].as<std::string>(),
|
2019-04-25 14:08:20 +00:00
|
|
|
cmd_settings,
|
2019-01-25 18:35:16 +00:00
|
|
|
options.count("lite") > 0,
|
2019-01-28 16:20:29 +00:00
|
|
|
options["profiles-file"].as<std::string>(),
|
2019-01-25 18:35:16 +00:00
|
|
|
std::move(input_files),
|
|
|
|
std::move(tests_tags),
|
|
|
|
std::move(skip_tags),
|
|
|
|
std::move(tests_names),
|
|
|
|
std::move(skip_names),
|
|
|
|
std::move(tests_names_regexp),
|
|
|
|
std::move(skip_names_regexp),
|
2019-02-04 17:37:55 +00:00
|
|
|
queries_with_indexes,
|
2019-01-25 18:35:16 +00:00
|
|
|
timeouts);
|
2019-01-28 16:20:29 +00:00
|
|
|
return performance_test_suite.run();
|
2019-01-25 18:35:16 +00:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
std::cout << DB::getCurrentExceptionMessage(/*with stacktrace = */ true) << std::endl;
|
|
|
|
int code = DB::getCurrentExceptionCode();
|
|
|
|
return code ? code : 1;
|
|
|
|
}
|