Skip to content

Commit

Permalink
Correct library location in tests
Browse files Browse the repository at this point in the history
Re ECFLOW-1943
  • Loading branch information
marcosbento committed Feb 21, 2024
1 parent e1a48c6 commit 58bb200
Show file tree
Hide file tree
Showing 42 changed files with 126 additions and 123 deletions.
4 changes: 2 additions & 2 deletions libs/Client/test/TestCheckPtDefsCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(test_check_pt_defs_cmd) {
CtsApi::restartServer() << " should return 0 server not started, or connection refused\n"
<< theClient.errorMsg());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());

Expand Down Expand Up @@ -322,7 +322,7 @@ BOOST_AUTO_TEST_CASE(test_check_pt_edit_history) {
BOOST_REQUIRE_MESSAGE(theClient.restartServer() == 0,
CtsApi::restartServer() << " should return 0 server not started, or connection refused\n"
<< theClient.errorMsg());
std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");
BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());
BOOST_REQUIRE_MESSAGE(theClient.shutdownServer() == 0,
CtsApi::shutdownServer() << " should return 0\n"
Expand Down
6 changes: 3 additions & 3 deletions libs/Client/test/TestClientEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_SUITE(T_ClientEnvironment)
BOOST_AUTO_TEST_CASE(test_client_environment_host_file_parsing) {
std::cout << "Client:: ...test_client_environment_host_file_parsing" << endl;

std::string good_host_file = File::test_data("Client/test/data/good_hostfile", "Client");
std::string good_host_file = File::test_data("libs/client/test/data/good_hostfile", "libs/client");

// local host should be implicitly added to internal host list
std::string the_host = ClientEnvironment::hostSpecified();
Expand Down Expand Up @@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(test_client_environment_host_file_defaults) {
// config or environment. To test this correctly we need to specify a port
// other than the default

std::string good_host_file = File::test_data("Client/test/data/good_hostfile", "Client");
std::string good_host_file = File::test_data("libs/client/test/data/good_hostfile", "libs/client");

// local host should be implicitly added to internal host list
std::vector<std::pair<std::string, std::string>> expectedHost;
Expand Down Expand Up @@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(test_client_environment_host_file_defaults) {
BOOST_AUTO_TEST_CASE(test_client_environment_empty_host_file) {
std::cout << "Client:: ...test_client_environment_empty_host_file" << endl;

std::string empty_host_file = File::test_data("Client/test/data/empty_hostfile", "Client");
std::string empty_host_file = File::test_data("libs/client/test/data/empty_hostfile", "libs/client");

std::string errormsg;
BOOST_CHECK_MESSAGE(File::create(empty_host_file, "", errormsg), "Failed to create empty host file " << errormsg);
Expand Down
4 changes: 2 additions & 2 deletions libs/Client/test/TestClientInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ BOOST_AUTO_TEST_CASE(test_client_interface) {
CtsApi::to_string(CtsApi::run(paths, true)) << " should return 0\n"
<< theClient.errorMsg());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");
BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, " should return 0\n" << theClient.errorMsg());
BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path, true /*force*/) == 0, " should return 0\n" << theClient.errorMsg());
BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path, true /*force*/, true /*check_only*/) == 0,
Expand Down Expand Up @@ -408,7 +408,7 @@ BOOST_AUTO_TEST_CASE(test_client_interface) {
CtsApi::get_log_path() << " should return 0\n"
<< theClient.errorMsg());

std::string new_log_path = File::test_data("Client/test/data/new_log.log", "Client");
std::string new_log_path = File::test_data("libs/client/test/data/new_log.log", "libs/client");
BOOST_REQUIRE_MESSAGE(theClient.new_log(new_log_path) == 0, " should return 0\n" << theClient.errorMsg());
BOOST_REQUIRE_MESSAGE(theClient.new_log("") == 0, " should return 0\n" << theClient.errorMsg());
}
Expand Down
2 changes: 1 addition & 1 deletion libs/Client/test/TestGroupCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(test_client_group_lifecyle) {
{
// restart server, load lifecycle, and get the defs tree from the server
std::string groupRequest = "--restart; load=";
groupRequest += File::test_data("Client/test/data/lifecycle.txt", "Client");
groupRequest += File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");
groupRequest += "; get";

BOOST_REQUIRE_MESSAGE(theClient.group(groupRequest) == 0,
Expand Down
4 changes: 2 additions & 2 deletions libs/Client/test/TestJobGenOnly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ BOOST_AUTO_TEST_CASE(test_jobgenonly) {

// Define paths to ECF_HOME and location of the defs file

std::string defsFile = File::test_data("Client/test/data/jobgenonly.def", "Client");
std::string ecf_home = File::test_data("Client/test/data/ECF_HOME", "Client");
std::string defsFile = File::test_data("libs/client/test/data/jobgenonly.def", "libs/client");
std::string ecf_home = File::test_data("libs/client/test/data/ECF_HOME", "libs/client");

/// Remove existing job file if any.
/// Job file location may NOT be same as ecf file.
Expand Down
2 changes: 1 addition & 1 deletion libs/Client/test/TestLifeCycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(test_node_tree_lifecycle) {
TestLog test_log(
"test_node_tree_lifecycle.log"); // will create log file, and destroy log and remove file at end of scope

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

Defs defs;
std::string errorMsg, warningMsg;
Expand Down
8 changes: 4 additions & 4 deletions libs/Client/test/TestLoadDefsCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(test_load_defs_cmd_handleRequest) {
TestLog test_log("test_load_defs_cmd_handleRequest.log"); // will create log file, and destroy log and remove file
// at end of scope

std::string firstDef = File::test_data("Client/test/data/first.def", "Client");
std::string firstDef = File::test_data("libs/client/test/data/first.def", "libs/client");

// Load the FIRST file with a set of unresolved extrens
defs_ptr firstDefs = Defs::create();
Expand All @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(test_load_defs_cmd_handleRequest) {
size_t noOfSuites = firstDefs->suiteVec().size();

// load the SECOND file, which should resolve the externs
std::string secondDef = File::test_data("Client/test/data/second.def", "Client");
std::string secondDef = File::test_data("libs/client/test/data/second.def", "libs/client");
Defs secondDefs;
{
std::string errorMsg, warningMsg;
Expand Down Expand Up @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(test_load_defs_check_only) {
BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
"Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

// Do not load the defs do a check only
ClientInvoker theClient(invokeServer.host(), invokeServer.port());
Expand All @@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(test_load_defs_check_only) {
<< theClient.errorMsg());
}
// provide path to definition that should fail to parse
std::string path_bad_def = File::test_data("Client/test/data/bad.def", "Client");
std::string path_bad_def = File::test_data("libs/client/test/data/bad.def", "libs/client");
BOOST_REQUIRE_THROW(theClient.loadDefs(path_bad_def, false, true /* check only*/), std::runtime_error);
}

Expand Down
2 changes: 1 addition & 1 deletion libs/Client/test/TestLogAndCheckptErrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(test_log_and_checkpt_write_errors) {

if (debug_me)
cout << "->load a defs file to the server\n";
std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");
BOOST_CHECK_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());
if (debug_me) {
BOOST_CHECK_MESSAGE(theClient.sync_local() == 0, "sync_local failed \n" << theClient.errorMsg());
Expand Down
4 changes: 2 additions & 2 deletions libs/Client/test/TestPlugCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static void get_defs(Defs& defs) {
// trigger ../family1/a:myMeter >= 50 || ../family1/a:myEvent
// endfamily
// endsuite
std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");
std::string errorMsg, warningMsg;
bool parse = defs.restore(path, errorMsg, warningMsg);
if (!parse)
Expand Down Expand Up @@ -234,7 +234,7 @@ static void test_plug_on_multiple_server(const std::string& host1,

// std::cout << " LOAD the defs into FIRST server(" << host1 << ":" << port1 << ") There is NO DEFS in the second
// server." << endl;
std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");
BOOST_REQUIRE_MESSAGE(server1Client.loadDefs(path) == 0, "load defs failed \n" << server1Client.errorMsg());

// cout << " Test the ERROR conditions in MoveCmd" << endl;
Expand Down
2 changes: 1 addition & 1 deletion libs/Client/test/TestRtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BOOST_AUTO_TEST_SUITE(T_Rtt)
BOOST_AUTO_TEST_CASE(test_client_invoker_round_trip_times) {
cout << "Client:: ...test_client_invoker_round_trip_times" << endl;

std::string root_path = File::test_data("Client/test/data/", "Client");
std::string root_path = File::test_data("libs/client/test/data/", "libs/client");

/// Open file rtt.dat and compute average round trip times
std::string result = Rtt::analyis(root_path + "rtt.dat");
Expand Down
10 changes: 5 additions & 5 deletions libs/Client/test/TestServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(test_server_state_changes) {
BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
"Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

ClientInvoker theClient(invokeServer.host(), invokeServer.port());
BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());
Expand Down Expand Up @@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(test_server_state_changes_with_auto_sync) {
BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
"Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

ClientInvoker theClient(invokeServer.host(), invokeServer.port());
theClient.set_auto_sync(true);
Expand Down Expand Up @@ -235,7 +235,7 @@ BOOST_AUTO_TEST_CASE(test_server_stress_test) {
BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
"Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

ClientInvoker theClient(invokeServer.host(), invokeServer.port());
int load = 125;
Expand Down Expand Up @@ -332,7 +332,7 @@ BOOST_AUTO_TEST_CASE(test_server_group_stress_test) {
BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
"Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

boost::timer::cpu_timer
boost_timer; // measures CPU, replace with cpu_timer with boost > 1.51, measures cpu & elapsed
Expand Down Expand Up @@ -383,7 +383,7 @@ BOOST_AUTO_TEST_CASE(test_server_stress_test_2) {
BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
"Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

Zombie z(Child::USER,
ecf::Child::INIT,
Expand Down
2 changes: 1 addition & 1 deletion libs/Client/test/TestServerAndLifeCycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(test_client_lifecyle) {

// load the defs into the server
{
std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");
BOOST_REQUIRE_MESSAGE(theClient.delete_all() == 0,
CtsApi::to_string(CtsApi::delete_node()) << " should return 0\n"
<< theClient.errorMsg());
Expand Down
2 changes: 1 addition & 1 deletion libs/Client/test/TestSignalSIGTERM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE(test_signal_SIGTERM) {
CtsApi::restartServer() << " should return 0 server not started, or connection refused\n"
<< theClient.errorMsg());

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");
BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());

// Get the definition
Expand Down
2 changes: 1 addition & 1 deletion libs/Client/test/TestUrlCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_SUITE(T_UrlCmd)
BOOST_AUTO_TEST_CASE(test_url_cmd) {
cout << "Client:: ...test_url_cmd" << endl;

std::string path = File::test_data("Client/test/data/lifecycle.txt", "Client");
std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

defs_ptr defs = Defs::create();

Expand Down
5 changes: 3 additions & 2 deletions libs/attribute/test/TestMigration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ BOOST_AUTO_TEST_SUITE(T_Migration)
BOOST_AUTO_TEST_CASE(test_migration_restore_def_con) {
cout << "ANattr:: ...test_migration_restore_def_con\n";

std::string file_name = File::test_data("ANattr/test/data/migration/default_constructor_1_2_2/", "ANattr");
std::string file_name =
File::test_data("libs/attribute/test/data/migration/default_constructor_1_2_2/", "libs/attribute");
// BOOST_CHECK_MESSAGE(File::createDirectories(file_name ),"Could not create directory " << file_name);

// Create migration data
Expand Down Expand Up @@ -104,7 +105,7 @@ BOOST_AUTO_TEST_CASE(test_migration_restore_def_con) {
BOOST_AUTO_TEST_CASE(test_migration_restore) {
cout << "ANattr:: ...test_migration_restore\n";

std::string file_name = File::test_data("ANattr/test/data/migration/1_2_2/", "ANattr");
std::string file_name = File::test_data("libs/attribute/test/data/migration/1_2_2/", "libs/attribute");
// BOOST_CHECK_MESSAGE(File::createDirectories(file_name ),"Could not create directory " << file_name);

std::vector<std::string> theVec;
Expand Down
12 changes: 6 additions & 6 deletions libs/base/test/TestArchiveAndRestoreCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_suite) {

// We use Pid::unique_name, to allow multiple invocation of this test
Defs theDefs;
std::string ecf_home = File::test_data("Base/test", "Base");
std::string ecf_home = File::test_data("libs/base/test", "libs/base");
theDefs.set_server().add_or_update_user_variables(Str::ECF_HOME(), ecf_home);
suite_ptr suite = theDefs.add_suite(Pid::unique_name("test_archive_and_restore_suite"));
suite->add_family("f1")->add_task("t1");
Expand Down Expand Up @@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_family) {
// task t1

Defs theDefs;
std::string ecf_home = File::test_data("Base/test", "Base");
std::string ecf_home = File::test_data("libs/base/test", "libs/base");
theDefs.set_server().add_or_update_user_variables(Str::ECF_HOME(), ecf_home);
suite_ptr suite = theDefs.add_suite(Pid::unique_name("test_archive_and_restore_family"));
family_ptr f3 = suite->add_family("f1")->add_family("f2")->add_family("f3");
Expand Down Expand Up @@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_all) {

Defs theDefs;
{
std::string ecf_home = File::test_data("Base/test", "Base");
std::string ecf_home = File::test_data("libs/base/test", "libs/base");
theDefs.set_server().add_or_update_user_variables(Str::ECF_HOME(), ecf_home);
suite_ptr suite = theDefs.add_suite(Pid::unique_name("test_archive_and_restore_all"));
family_ptr f1 = suite->add_family("f1");
Expand Down Expand Up @@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_overlap) {
// task t1

Defs theDefs;
std::string ecf_home = File::test_data("Base/test", "Base");
std::string ecf_home = File::test_data("libs/base/test", "libs/base");
theDefs.set_server().add_or_update_user_variables(Str::ECF_HOME(), ecf_home);
suite_ptr suite = theDefs.add_suite(Pid::unique_name("test_archive_and_restore_overlap"));
std::string f1_abs_node_path;
Expand Down Expand Up @@ -288,7 +288,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_delete_suite) {

// We use Pid::unique_name, to allow multiple invocation of this test
Defs theDefs;
std::string ecf_home = File::test_data("Base/test", "Base");
std::string ecf_home = File::test_data("libs/base/test", "libs/base");
theDefs.set_server().add_or_update_user_variables(Str::ECF_HOME(), ecf_home);
suite_ptr suite = theDefs.add_suite(Pid::unique_name("test_archive_and_delete_suite"));
family_ptr family = suite->add_family("f1");
Expand Down Expand Up @@ -325,7 +325,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_errors) {

// We use Pid::unique_name, to allow multiple invocation of this test
Defs theDefs;
std::string ecf_home = File::test_data("Base/test", "Base");
std::string ecf_home = File::test_data("libs/base/test", "libs/base");
theDefs.set_server().add_or_update_user_variables(Str::ECF_HOME(), ecf_home);
suite_ptr suite = theDefs.add_suite(Pid::unique_name("test_archive_and_restore_errors"));
family_ptr f1 = suite->add_family("f1");
Expand Down
6 changes: 3 additions & 3 deletions libs/base/test/TestLogCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ BOOST_AUTO_TEST_CASE(test_log_cmd) {

// Create a new log file, equivalent --log=new .../Base/test/new_logfile.txt
// LogCmd::doHandleRequest needs log file to have been created first
std::string old_log_file = File::test_data("Base/test/old_logfile.txt", "Base");
std::string old_log_file = File::test_data("libs/base/test/old_logfile.txt", "libs/base");
Log::instance()->create(old_log_file);

std::string new_log_file =
File::test_data("Base/test/new_logfile.txt ", "Base"); // ECFLOW-377 note extra space at the end
std::string expected_new_log_file = File::test_data("Base/test/new_logfile.txt", "Base"); // space removed
File::test_data("libs/base/test/new_logfile.txt ", "libs/base"); // ECFLOW-377 note extra space at the end
std::string expected_new_log_file = File::test_data("libs/base/test/new_logfile.txt", "libs/base"); // space removed

// ECFLOW-376 --log=new <path> should be treated same as changing ECF_LOG from the gui. i.e added as a user
// variable. hence visible in GUI
Expand Down
4 changes: 2 additions & 2 deletions libs/base/test/TestRequeueNodeCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,10 @@ BOOST_AUTO_TEST_CASE(test_reque_with_repeat_and_defstatus_complete) {

// Create a log file with a unique name, to avoid problems when running in paralle
// This test relies on log file contents to be flushed.
std::string log_file = "Base/test/test_reque_with_repeat_and_defstatus_complete_";
std::string log_file = "libs/base/test/test_reque_with_repeat_and_defstatus_complete_";
log_file += Pid::getpid(); // can throw
log_file += ".log";
log_file = File::test_data(log_file, "Base");
log_file = File::test_data(log_file, "libs/base");

Log::create(log_file);

Expand Down
Loading

0 comments on commit 58bb200

Please sign in to comment.