Partially fix up windows unit tests. Try out the Visual Studio Test Manager

This commit is contained in:
Eric Harding committed 2017-10-20 18:27:27 -04:00
1 parent dfdcbd5c85
commit da1a36bf11
9 files changed
+33 -55

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
using bts.api;
using bts.api;
using bts.api.core;
using bts.api.test;
using NUnit.Framework;
@@ -31,7 +31,7 @@ namespace mbts.api.Test {
[TearDown]
public void teardown() {
ApiTestsNativeMethods.apitest_stop_apitest_service(_native_server);
_managed_server.Dispose();
Disposable.dispose(ref _managed_server);
Disposable.dispose(ref _context);
}
+1 -1
View File
@@ -45,7 +45,7 @@ namespace mbts.ui
component_catalog.Catalogs.Add(new AssemblyCatalog(typeof(ShellModel).Assembly));
// Add plugin path
string plugin_path = Configuration.get<bts.config.System>().installation_specific_data_path + "/plugins/";
string plugin_path = Configuration.get<bts.config.System>().data_path + "/plugins/";
if (Directory.Exists(plugin_path)) {
component_catalog.Catalogs.Add(new DirectoryCatalog(plugin_path));
}
@@ -110,7 +110,7 @@ namespace mbts.ui.shell
private static string local_workspace_path() {
var system = Configuration.get<bts.config.System>();
return @"{0}/{1}/{2}".fmt(system.installation_specific_data_path, WORKSPACE_NAMESPACE, "recover_workspace");
return @"{0}/{1}/{2}".fmt(system.data_path, WORKSPACE_NAMESPACE, "recover_workspace");
}
private static void save_workspace_locally(WorkspaceDefinition workspace) {
string path = local_workspace_path();
+5 -5
View File
@@ -22,7 +22,7 @@ struct ApiServerCore {
qbus::RPCServer rpc;
};
BTS_EXPORT ApiServerCore* api_server_create(Quickbus* pbus, const char* type_name, const char* service_qualifier, raw_rpc_request_callback cb, void* extra) {
CAPI ApiServerCore* api_server_create(Quickbus* pbus, const char* type_name, const char* service_qualifier, raw_rpc_request_callback cb, void* extra) {
bts_assert(pbus);
// Invalid characters in qualifier: +
for (auto ch : { '+', '_' }) {
@@ -38,7 +38,7 @@ BTS_EXPORT ApiServerCore* api_server_create(Quickbus* pbus, const char* type_nam
});
}
BTS_EXPORT void api_server_call_callback(ReplyHandler** ppvhandler, const uint8_t* buffer, int length) {
CAPI void api_server_call_callback(ReplyHandler** ppvhandler, const uint8_t* buffer, int length) {
bts_assert(ppvhandler);
bts_assert(*ppvhandler);
LOG(Api,Diag,"Send rpc reply: {}",reinterpret_cast<intptr_t>(*ppvhandler));
@@ -50,14 +50,14 @@ BTS_EXPORT void api_server_call_callback(ReplyHandler** ppvhandler, const uint8_
*pphandler = nullptr;
}
BTS_EXPORT TableHandle api_server_create_table(ApiServerCore* pserver, const char* method_and_qualifier) {
CAPI TableHandle api_server_create_table(ApiServerCore* pserver, const char* method_and_qualifier) {
bts_assert(pserver);
auto topic = stream_topic(pserver->topic, method_and_qualifier);
LOG(Api,Info,"Create table: {}",topic.value());
return new qbus::TablePublisher(pserver->qbus, topic);
}
BTS_EXPORT void api_server_update_table(TableHandle htable, StreamUpdate* raw_changes, int change_count) {
CAPI void api_server_update_table(TableHandle htable, StreamUpdate* raw_changes, int change_count) {
if (change_count > 0) {
bts_assert(htable);
qbus::TablePublisher* ptable = reinterpret_cast<qbus::TablePublisher*>(htable);
@@ -72,7 +72,7 @@ BTS_EXPORT void api_server_update_table(TableHandle htable, StreamUpdate* raw_ch
}
}
BTS_EXPORT void api_server_destroy_table(qbus::TablePublisher* ptable) {
CAPI void api_server_destroy_table(qbus::TablePublisher* ptable) {
if (ptable) {
ptable->disconnect();
delete ptable;
+4 -5
View File
@@ -5,15 +5,14 @@ namespace bts {
namespace api {
struct ApiServerCore;
//struct ReplyHandler;
typedef void ReplyHandler;
typedef void(*raw_rpc_request_callback)(const uint8_t* buffer, size_t length, ReplyHandler* callback, void* extra);
BTS_EXPORT ApiServerCore* api_server_create(Quickbus* pbus, const char* type_name, const char* service_qualifier, raw_rpc_request_callback reply, void* extra);
CAPI ApiServerCore* api_server_create(Quickbus* pbus, const char* type_name, const char* service_qualifier, raw_rpc_request_callback reply, void* extra);
BTS_EXPORT void api_server_call_callback(ReplyHandler** pphandler, const uint8_t* buffer, int length);
CAPI void api_server_call_callback(ReplyHandler** pphandler, const uint8_t* buffer, int length);
typedef void* TableHandle;
BTS_EXPORT TableHandle api_server_create_table(ApiServerCore* pserver, const char* method_and_qualifier);
BTS_EXPORT void api_server_update_table(TableHandle htable, StreamUpdate* raw_changes, int change_count);
CAPI TableHandle api_server_create_table(ApiServerCore* pserver, const char* method_and_qualifier);
CAPI void api_server_update_table(TableHandle htable, StreamUpdate* raw_changes, int change_count);
}}//namespace
+1 -21
View File
@@ -171,37 +171,17 @@ void ConfigurationState::initialize_defaults()
_is_initialized = true;
}
std::string get_installation(const std::string& path)
{
// "Installation" is defined as the directory where we are installed
// "bin" is special cased to "" as a backwards compatibility for developers
bts_assert(!path.empty());
std::string parent_path = boost::filesystem::path(path).parent_path().string();
size_t last = parent_path.find_last_of("/\\");
if (last + 1 >= parent_path.size())
return "";
std::string installation = parent_path.substr(last + 1, parent_path.size() - last);
if (installation == "bin")
return "";
return installation;
}
void ConfigurationState::initialize_builtins()
{
System sys;
sys.set_host_name(os::host_name());
sys.set_process_name(os::get_application_name());
sys.set_process_path(os::get_application_path());
sys.set_directory(os::get_install_path());
sys.set_platform(os::platform_name());
sys.set_qualifier(os::get_qualifier());
sys.set_unittest_environment(utils::internal::is_unittest_environment());
sys.set_data_path(os::bts_data_path());
sys.set_installation(get_installation(sys.process_path()));
sys.set_installation_specific_data_path(sys.data_path() + sys.installation() + "/");
// sys.set_build_number(BUILD_NUMBER);
sys.set_build_number(0);
sys.set_os_user(os::username());
#ifndef NDEBUG
sys.set_build_type("debug");
+2 -4
View File
@@ -6,16 +6,14 @@ message System
{
required string host_name = 1;
required string process_name = 3;
required string process_path = 4;
required string directory = 4;
required string platform = 5;
required string qualifier = 6;
required bool unittest_environment = 7;
required string data_path = 8;
optional string version = 9 [default = "private"];
repeated string cmd_args = 10;
required string installation = 11;
required string installation_specific_data_path = 12;
required int32 build_number = 13 [default = 0];
// 11,12,13
required string build_type = 14 [default = "release"];
required string config_host = 15;
required string config_ip = 16 [default = "127.0.0.1"];
+17 -15
View File
@@ -3,6 +3,7 @@
#include "lib/utils/bts_debugger.h"
#include "lib/config/config.h"
#include "lib/utils/bts_array_size.h"
#include "lib/utils/helper_macros.h"
#include <boost/asio.hpp>
#include <boost/algorithm/string/replace.hpp>
@@ -450,21 +451,13 @@ std::string host_name ()
return std::string (buffer);
}
std::string get_install_path()
{
auto result = get_application_path();
// Trim the filename
size_t last = result.find_last_of("/\\");
result.erase(last);
return result;
}
std::string get_application_path()
std::string get_application_path(const char* module_name)
{
char buffer[1024];
#ifdef _WIN32
int bytes = GetModuleFileName(NULL, buffer, sizeof(buffer));
int bytes = GetModuleFileName(GetModuleHandle(module_name), buffer, sizeof(buffer));
#elif __linux__
UNUSED(module_name);
// I'm not completely happy with this solution but there doesn't seem to be anything
// more standard.
char temp[32];
@@ -485,9 +478,19 @@ std::string get_application_path()
}
}
std::string get_install_path()
{
// The install path is the location of spark_lib (on Windows) since there may be an api client or other entry point (nunit?)
auto result = get_application_path("spark_lib");
// Trim the filename
size_t last = result.find_last_of("/\\");
result.erase(last);
return result;
}
std::string get_application_name()
{
std::string app_path = get_application_path();
std::string app_path = get_application_path(nullptr);
size_t last = app_path.find_last_of("/\\");
if (last + 1 >= app_path.size())
return "";
@@ -714,14 +717,13 @@ std::string bts_system_path()
std::string bts_data_path()
{
std::string path =
bts_user_path() + "data/";
std::string path = bts_user_path() + "data/";
if (!boost::filesystem::is_directory(path))
{
boost::filesystem::create_directories(path);
}
return path;
return normalize_path(path);
}
std::string username() {
-1
View File
@@ -53,7 +53,6 @@ BTS_EXPORT std::string default_host_ip ();
BTS_EXPORT std::string host_ip (std::string const &interface_name);
BTS_EXPORT std::map<std::string,std::string> host_ips ();
BTS_EXPORT uint64_t tick_count ();
BTS_EXPORT std::string get_application_path();
BTS_EXPORT std::string get_install_path();
BTS_EXPORT std::string get_application_name();
BTS_EXPORT std::string get_cwd();