From 0f5371162863adf9909abbab740ab7436abd9758 Mon Sep 17 00:00:00 2001 From: Martin Hierholzer <martin.hierholzer@desy.de> Date: Tue, 14 Apr 2020 14:05:28 +0200 Subject: [PATCH] wip #129: fix test after slight behavior change Initially, devices are closed and hence there is an error message. It goes away shortly when the device got opened. The new behavior is according to specification. --- .../executables_src/testExceptionHandling.cc | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/tests/executables_src/testExceptionHandling.cc b/tests/executables_src/testExceptionHandling.cc index 59737523..636b1b1a 100644 --- a/tests/executables_src/testExceptionHandling.cc +++ b/tests/executables_src/testExceptionHandling.cc @@ -193,14 +193,25 @@ BOOST_AUTO_TEST_CASE(testExceptionHandlingRead) { dev1.write<int>("MyModule/readBack.DUMMY_WRITEABLE", 42); dev2.write<int>("MyModule/readBack.DUMMY_WRITEABLE", 52); - // initially there should be no error set + // initially, devices are not opened but errors should be cleared once they are opened trigger.write(); + + do { + message1.readLatest(); + status1.readLatest(); + } while(status1 != 0 || std::string(message1) != ""); BOOST_CHECK(!message1.readLatest()); BOOST_CHECK(!status1.readLatest()); + + do { + message2.readLatest(); + status2.readLatest(); + } while(status2 != 0 || std::string(message2) != ""); + BOOST_CHECK(!message2.readLatest()); + BOOST_CHECK(!status2.readLatest()); + CHECK_TIMEOUT(readback1.readLatest(), 10000); CHECK_TIMEOUT(readback2.readLatest(), 10000); - BOOST_CHECK(static_cast<std::string>(message1) == ""); - BOOST_CHECK(status1 == 0); BOOST_CHECK_EQUAL(readback1, 42); BOOST_CHECK_EQUAL(readback2, 52); @@ -295,7 +306,21 @@ BOOST_AUTO_TEST_CASE(testExceptionHandlingWrite) { auto trigger = test.getScalar<int>("trigger"); - // initially there should be no error set + // initially, devices are not opened but errors should be cleared once they are opened + do { + message1.readLatest(); + status1.readLatest(); + } while(status1 != 0 || std::string(message1) != ""); + BOOST_CHECK(!message1.readLatest()); + BOOST_CHECK(!status1.readLatest()); + + do { + message2.readLatest(); + status2.readLatest(); + } while(status2 != 0 || std::string(message2) != ""); + BOOST_CHECK(!message2.readLatest()); + BOOST_CHECK(!status2.readLatest()); + actuator1 = 29; actuator1.write(); actuator2 = 39; -- GitLab