Skip to content

Commit

Permalink
Format tests under test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosbento committed Sep 19, 2024
1 parent 93b355f commit aa2d32b
Show file tree
Hide file tree
Showing 30 changed files with 196 additions and 100 deletions.
2 changes: 2 additions & 0 deletions libs/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ if (ENABLE_ALL_TESTS)
LIBS
libharness
$<$<BOOL:${OPENSSL_FOUND}>:OpenSSL::SSL>
test_support
TEST_DEPENDS
s_client
)
Expand All @@ -98,6 +99,7 @@ if (ENABLE_ALL_TESTS)
LIBS
libharness
$<$<BOOL:${OPENSSL_FOUND}>:OpenSSL::SSL>
test_support
TEST_DEPENDS
s_test
)
Expand Down
4 changes: 3 additions & 1 deletion libs/test/TestAbortCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/DurationTimer.hpp"
#include "ecflow/node/Defs.hpp"
Expand All @@ -35,8 +36,9 @@ BOOST_AUTO_TEST_SUITE(T_AbortCmd)
// is defined. Then providing its value is less the the task's try number
// we should do an immediate job submission.
BOOST_AUTO_TEST_CASE(test_abort_cmd) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_abort_cmd " << flush;
TestClean clean_at_start_and_end;

// Create the defs file corresponding to the text below
Expand Down
4 changes: 3 additions & 1 deletion libs/test/TestAlias.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/base/cts/user/CFileCmd.hpp"
#include "ecflow/core/AssertTimer.hpp"
Expand Down Expand Up @@ -63,8 +64,9 @@ void wait_for_alias_to_complete(const std::string& alias_path) {
}

BOOST_AUTO_TEST_CASE(test_alias) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_alias " << flush;
TestClean clean_at_start_and_end;

// Create the defs file corresponding to the text below
Expand Down
7 changes: 5 additions & 2 deletions libs/test/TestClkSync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/DurationTimer.hpp"
#include "ecflow/core/PrintStyle.hpp"
Expand All @@ -35,6 +36,8 @@ BOOST_AUTO_TEST_SUITE(S_Test)
BOOST_AUTO_TEST_SUITE(T_ClkSync)

BOOST_AUTO_TEST_CASE(test_clk_sync) {
ECF_NAME_THIS_TEST();

// This test is used to test sync'ing of the suite calendars
// The default clock type is *real*. We will create a suite with a hybrid clock attribute
// For the suite calendar, we do not persist the clock type(hybrid/real), since this can be
Expand All @@ -47,7 +50,6 @@ BOOST_AUTO_TEST_CASE(test_clk_sync) {
// This is done in ServerTestHarness via invariant checking.

DurationTimer timer;
cout << "Test:: ...test_clk_sync " << flush;
TestClean clean_at_start_and_end;

// Create the defs file corresponding to the text below
Expand Down Expand Up @@ -80,8 +82,9 @@ BOOST_AUTO_TEST_CASE(test_clk_sync) {
}

BOOST_AUTO_TEST_CASE(test_suite_calendar_sync) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_suite_calendar_sync " << flush;
TestClean clean_at_start_and_end;

// When using ECF_SSL sync is to slow.
Expand Down
10 changes: 7 additions & 3 deletions libs/test/TestComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <boost/test/unit_test.hpp>

#include "ServerTestHarness.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/DurationTimer.hpp"
#include "ecflow/node/Defs.hpp"
Expand Down Expand Up @@ -45,8 +46,9 @@ BOOST_AUTO_TEST_SUITE(T_Complete)
// hierarchically
// **************************************************************************
BOOST_AUTO_TEST_CASE(test_complete) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_complete " << flush;
TestClean clean_at_start_and_end;

// Create the defs file corresponding to the text below
Expand Down Expand Up @@ -100,8 +102,9 @@ BOOST_AUTO_TEST_CASE(test_complete) {
}

BOOST_AUTO_TEST_CASE(test_complete_does_not_hold) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_complete_does_not_hold " << flush;

/// This test shows that a complete expression should not hold a node
/// A complete should complete a node, and not hold it
Expand Down Expand Up @@ -135,8 +138,9 @@ BOOST_AUTO_TEST_CASE(test_complete_does_not_hold) {
}

BOOST_AUTO_TEST_CASE(test_complete_with_empty_family) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_complete_with_empty_family " << flush;

// Test a family with a complete expression and that has no children

Expand Down
4 changes: 3 additions & 1 deletion libs/test/TestCron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/AssertTimer.hpp"
#include "ecflow/core/DurationTimer.hpp"
Expand Down Expand Up @@ -69,8 +70,9 @@ static void wait_for_cron(int max_time_to_wait, const std::string& path) {
}

BOOST_AUTO_TEST_CASE(test_cron_time_series) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_cron_time_series " << flush;
TestClean clean_at_start_and_end;

// SLOW SYSTEMS
Expand Down
10 changes: 7 additions & 3 deletions libs/test/TestCtsWaitCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/AssertTimer.hpp"
#include "ecflow/core/DurationTimer.hpp"
Expand Down Expand Up @@ -100,8 +101,9 @@ static bool wait_for_state(std::vector<std::pair<std::string, NState::State>>& p
// In this case the job associated with task 'wait' should block until the expression evaluates
// to true, which should be after the completion of all other tasks
BOOST_AUTO_TEST_CASE(test_wait_cmd) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_wait_cmd " << flush;
TestClean clean_at_start_and_end;

Defs theDefs;
Expand Down Expand Up @@ -130,8 +132,9 @@ BOOST_AUTO_TEST_CASE(test_wait_cmd) {
}

BOOST_AUTO_TEST_CASE(test_wait_cmd_parse_fail) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_wait_cmd_parse_fail " << flush;

// This time we add a wait expression that
// should fail to parse, and we should return an error
Expand Down Expand Up @@ -175,8 +178,9 @@ BOOST_AUTO_TEST_CASE(test_wait_cmd_parse_fail) {
}

BOOST_AUTO_TEST_CASE(test_wait_cmd_non_existant_paths) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_wait_cmd_non_existant_paths " << flush;

// This time we add a wait expression that should fail
// because the paths referenced in the expression don't exist
Expand Down
7 changes: 5 additions & 2 deletions libs/test/TestDayDate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <boost/test/unit_test.hpp>

#include "ServerTestHarness.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/DurationTimer.hpp"
#include "ecflow/node/Defs.hpp"
Expand All @@ -33,9 +34,10 @@ BOOST_AUTO_TEST_SUITE(S_Test)
BOOST_AUTO_TEST_SUITE(T_DayDate)

BOOST_AUTO_TEST_CASE(test_day_at_midnight) {
ECF_NAME_THIS_TEST();

// See ECFLOW-337 versus ECFLOW-1550
DurationTimer timer;
cout << "Test:: ...test_day_at_midnight " << flush;
TestClean clean_at_start_and_end;

// SLOW SYSTEMS
Expand Down Expand Up @@ -88,9 +90,10 @@ BOOST_AUTO_TEST_CASE(test_day_at_midnight) {
}

BOOST_AUTO_TEST_CASE(test_date_at_midnight) {
ECF_NAME_THIS_TEST();

// See ECFLOW-337 versus ECFLOW-1550
DurationTimer timer;
cout << "Test:: ...test_date_at_midnight " << flush;
TestClean clean_at_start_and_end;

// # Note: we have to use relative paths, since these tests are relocatable
Expand Down
4 changes: 3 additions & 1 deletion libs/test/TestEcfNoScriptCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <boost/test/unit_test.hpp>

#include "ServerTestHarness.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/DurationTimer.hpp"
#include "ecflow/node/Defs.hpp"
Expand All @@ -30,14 +31,15 @@ BOOST_AUTO_TEST_SUITE(S_Test)
BOOST_AUTO_TEST_SUITE(T_EcfNoScriptCmd)

BOOST_AUTO_TEST_CASE(test_ecf_no_script) {
ECF_NAME_THIS_TEST();

// This test is used to case where we ONLY want to execute ECF_JOB_CMD WITHOUT processing .ecf script.
// For this ECF_NO_SCRIPT must be set to any value.
// The ECF_JOB_CMD must then encompass ecflow_client --init/complete and the environment settings
// Additionally the user can see the output by directing the word done to ECF_JOBOUT
// Although ServerTestHarness creates the .ecf file, they are ignored when ECF_NO_SCRIPT is specified.

DurationTimer timer;
cout << "Test:: ...test_ecf_no_script " << flush;
TestClean clean_at_start_and_end;

// Create the defs file corresponding to the text below
Expand Down
4 changes: 3 additions & 1 deletion libs/test/TestEcfScriptCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/DurationTimer.hpp"
#include "ecflow/core/File.hpp"
Expand All @@ -32,8 +33,9 @@ BOOST_AUTO_TEST_SUITE(S_Test)
BOOST_AUTO_TEST_SUITE(T_EcfScriptCmd)

BOOST_AUTO_TEST_CASE(test_ECF_SCRIPT_CMD) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_ECF_SCRIPT_CMD " << flush;
TestClean clean_at_start_and_end;

// Create the defs file corresponding to the text below
Expand Down
4 changes: 3 additions & 1 deletion libs/test/TestEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/DurationTimer.hpp"
#include "ecflow/node/Defs.hpp"
Expand All @@ -36,8 +37,9 @@ BOOST_AUTO_TEST_SUITE(T_Events)
// This test does not have any time dependencies in the def file.

BOOST_AUTO_TEST_CASE(test_event_and_query) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_event_and_query " << flush;
TestClean clean_at_start_and_end;

// Create the defs file corresponding to the text below
Expand Down
4 changes: 3 additions & 1 deletion libs/test/TestFileCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/base/cts/user/CFileCmd.hpp"
#include "ecflow/core/Converter.hpp"
Expand All @@ -37,8 +38,9 @@ BOOST_AUTO_TEST_SUITE(S_Test)
BOOST_AUTO_TEST_SUITE(T_FileCmd)

BOOST_AUTO_TEST_CASE(test_file_cmd) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_file_cmd " << flush;
TestClean clean_at_start_and_end;

// Create the defs file corresponding to the text below
Expand Down
10 changes: 7 additions & 3 deletions libs/test/TestHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/base/cts/ClientToServerCmd.hpp"
#include "ecflow/core/AssertTimer.hpp"
Expand All @@ -42,8 +43,9 @@ BOOST_AUTO_TEST_SUITE(S_Test)
BOOST_AUTO_TEST_SUITE(T_Handle)

BOOST_AUTO_TEST_CASE(test_handle) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_handle " << flush;
TestClean clean_at_start_and_end;

Defs theDefs;
Expand Down Expand Up @@ -195,8 +197,9 @@ BOOST_AUTO_TEST_CASE(test_handle) {
}

BOOST_AUTO_TEST_CASE(test_handle_sync) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_handle_sync " << flush;
TestClean clean_at_start_and_end;

Defs theDefs;
Expand Down Expand Up @@ -333,8 +336,9 @@ BOOST_AUTO_TEST_CASE(test_handle_sync) {
}

BOOST_AUTO_TEST_CASE(test_handle_add_remove_add) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_handle_add_remove_add " << flush;
TestClean clean_at_start_and_end;

defs_ptr theDefs = Defs::create();
Expand Down
4 changes: 3 additions & 1 deletion libs/test/TestInitAddVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/core/Converter.hpp"
#include "ecflow/core/DurationTimer.hpp"
Expand All @@ -35,14 +36,15 @@ BOOST_AUTO_TEST_SUITE(T_InitAddVariable)
// The data is created dynamically so that we can stress test the server
// This test does not have any time dependencies in the def file.
BOOST_AUTO_TEST_CASE(test_init_add_variable) {
ECF_NAME_THIS_TEST();

// Added since in 5.2.0 (only 5.2.0 server supports this behaviour)
if (getenv("ECF_DISABLE_TEST_FOR_OLD_SERVERS")) {
std::cout << "\n Disable test_init_add_variable for old server , re-enable when 5.2.0 is minimum version\n";
return;
}

DurationTimer timer;
cout << "Test:: ...test_init_add_variable " << flush;
TestClean clean_at_start_and_end;

// # Note: we have to use relative paths, since these tests are relocatable
Expand Down
7 changes: 5 additions & 2 deletions libs/test/TestKillCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "ServerTestHarness.hpp"
#include "TestFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/base/cts/ClientToServerCmd.hpp"
#include "ecflow/core/AssertTimer.hpp"
Expand Down Expand Up @@ -45,16 +46,18 @@ static bool waitForTaskState(NState::State state, int max_time_to_wait);
// test:: test the kill command. Create a task that runs a long time
// The associated job is then killed. This should leave task in aborted state
BOOST_AUTO_TEST_CASE(test_kill_cmd) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_kill_cmd " << flush;
TestClean clean_at_start_and_end;
BOOST_REQUIRE_MESSAGE(kill_cmd(true), " kill of task '/test_kill_cmd/family/t0' failed");
cout << timer.duration() << "\n";
}

BOOST_AUTO_TEST_CASE(test_hierarchical_kill_cmd) {
ECF_NAME_THIS_TEST();

DurationTimer timer;
cout << "Test:: ...test_hierarchical_kill_cmd " << flush;
TestClean clean_at_start_and_end;
BOOST_REQUIRE_MESSAGE(kill_cmd(false), "kill of suite '/test_kill_cmd' failed");
cout << timer.duration() << "\n";
Expand Down
Loading

0 comments on commit aa2d32b

Please sign in to comment.