1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/*
* Copyright 2009- ECMWF.
*
* This software is licensed under the terms of the Apache Licence version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation
* nor does it submit to any jurisdiction.
*/
#include <boost/test/unit_test.hpp>
#include "TestHelper.hpp"
#include "ecflow/base/cts/user/PathsCmd.hpp"
#include "ecflow/node/Defs.hpp"
#include "ecflow/node/Family.hpp"
#include "ecflow/node/Suite.hpp"
#include "ecflow/node/System.hpp"
#include "ecflow/test/scaffold/Naming.hpp"
using namespace std;
using namespace ecf;
BOOST_AUTO_TEST_SUITE(U_Base)
BOOST_AUTO_TEST_SUITE(T_SpecificIssues)
static defs_ptr create_defs() {
// suite s1
// family f1
// trigger f2 == complete
// task t1
// task t2
// endfamily
// family f2
// task t1
// task t2
// endfamily
// endsuite
defs_ptr theDefs = Defs::create();
suite_ptr suite = theDefs->add_suite("s1");
family_ptr f1 = suite->add_family("f1");
family_ptr f2 = suite->add_family("f2");
f1->add_trigger("f2 == complete");
f1->add_task("t1");
f1->add_task("t2");
f2->add_task("t1");
f2->add_task("t2");
return theDefs;
}
BOOST_AUTO_TEST_CASE(test_ECFLOW_189) {
ECF_NAME_THIS_TEST();
TestLog test_log("test_ECFLOW_189.log"); // will create log file, and destroy log and remove file at end of scope
defs_ptr the_defs = create_defs();
the_defs->beginAll();
node_ptr t1 = the_defs->findAbsNode("/s1/f1/t1");
node_ptr t2 = the_defs->findAbsNode("/s1/f1/t2");
TestHelper::invokeRequest(the_defs.get(), Cmd_ptr(new PathsCmd(PathsCmd::SUSPEND, t1->absNodePath())));
TestHelper::invokeRequest(the_defs.get(), Cmd_ptr(new PathsCmd(PathsCmd::SUSPEND, t2->absNodePath())));
TestHelper::test_state(t1, DState::SUSPENDED);
TestHelper::test_state(t2, DState::SUSPENDED);
// Now resume /s1/f1/t1 and /s1/f1/t2
TestHelper::invokeRequest(the_defs.get(), Cmd_ptr(new PathsCmd(PathsCmd::RESUME, t1->absNodePath())));
// We expect state to be queued since the trigger on /s1/f1 should prevent jobs from running
// If we find submitted or aborted(i.e it was free to run, but could not generate the jobs), then its an error
TestHelper::test_state(t1, NState::QUEUED);
TestHelper::test_state(t2, NState::QUEUED);
/// Destroy System singleton to avoid valgrind from complaining
System::destroy();
}
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
|