Skip to content

Commit

Permalink
improved CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
randaz81 committed Nov 7, 2023
1 parent 2cb915c commit 8029300
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TEST_CASE("dev::RemoteControlBoardTest", "[yarp::dev]")
REQUIRE(result_att);
}

yarp::os::Time::delay(0.1);
yarp::os::Time::delay(0.9);

//open the nwc
{
Expand Down Expand Up @@ -139,7 +139,7 @@ TEST_CASE("dev::RemoteControlBoardTest", "[yarp::dev]")
REQUIRE(result_att);
}

yarp::os::Time::delay(0.1);
yarp::os::Time::delay(0.9);

//open the nwc
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,23 @@ static void checkRemapper(yarp::dev::PolyDriver & ddRemapper, int rand, size_t n
{
IPositionControl *pos = nullptr;
REQUIRE(ddRemapper.view(pos)); // interface position correctly opened
REQUIRE(pos);

int axes = 0;
CHECK(pos->getAxes(&axes)); // getAxes returned correctly
CHECK((size_t) axes == nrOfRemappedAxes); // remapper seems functional

IPositionDirect *posdir = nullptr;
REQUIRE(ddRemapper.view(posdir)); // direct position interface correctly opened
REQUIRE(posdir);

IEncoders * encs = nullptr;
REQUIRE(ddRemapper.view(encs)); // encoders interface correctly opened
REQUIRE(encs);

IControlMode *ctrlmode = nullptr;
REQUIRE(ddRemapper.view(ctrlmode)); // control mode interface correctly opened
REQUIRE(ctrlmode);

// Vector used for setting/getting data from the controlboard
std::vector<double> setPosition(nrOfRemappedAxes,-10),
Expand All @@ -94,7 +99,7 @@ static void checkRemapper(yarp::dev::PolyDriver & ddRemapper, int rand, size_t n

CHECK(ctrlmode->setControlModes(settedControlMode.data())); // setControlModes correctly called

// Check that the readed control mode is actually position direct
// Check that the read control mode is actually position direct
// Let's try 10 times because if the remapper is using some remotecontrolboards,
// it is possible that this return false if it is called before the first message
// has been received from the controlboard_nws_yarp
Expand Down Expand Up @@ -148,10 +153,9 @@ static void checkRemapper(yarp::dev::PolyDriver & ddRemapper, int rand, size_t n
TEST_CASE("dev::ControlBoardRemapperTest", "[yarp::dev]")
{
YARP_REQUIRE_PLUGIN("fakeMotionControl", "device");

#if defined(DISABLE_FAILING_TESTS)
YARP_SKIP_TEST("Skipping failing tests")
#endif
YARP_REQUIRE_PLUGIN("controlboardremapper", "device");
YARP_REQUIRE_PLUGIN("controlBoard_nws_yarp", "device");
YARP_REQUIRE_PLUGIN("remotecontrolboardremapper", "device");

Network::setLocalMode(true);

Expand Down Expand Up @@ -194,6 +198,8 @@ TEST_CASE("dev::ControlBoardRemapperTest", "[yarp::dev]")

IPositionControl *pos = nullptr;
REQUIRE(fmcbs[i]->view(pos)); // interface position correctly opened
REQUIRE(pos);

int axes = 0;
pos->getAxes(&axes);
CHECK(axes == fmcbsSizes[i]); // fakeMotionControlBoard seems functional
Expand All @@ -209,6 +215,7 @@ TEST_CASE("dev::ControlBoardRemapperTest", "[yarp::dev]")

yarp::dev::IMultipleWrapper *iwrap = nullptr;
REQUIRE(wrappers[i]->view(iwrap)); // interface for multiple wrapper correctly opened for the controlBoard_nws_yarp
REQUIRE(iwrap);

PolyDriverList pdList;
pdList.push(fmcbs[i],wrapperNetworks[i].c_str());
Expand Down Expand Up @@ -243,7 +250,7 @@ TEST_CASE("dev::ControlBoardRemapperTest", "[yarp::dev]")

yarp::dev::IMultipleWrapper *imultwrapWN = nullptr;
REQUIRE(ddRemapperWN.view(imultwrapWN)); // interface for multiple wrapper with wrong names correctly opened

REQUIRE(imultwrapWN);

CHECK_FALSE(imultwrapWN->attachAll(fmcList)); // attachAll for controlboardremapper with wrong names successful

Expand All @@ -269,6 +276,7 @@ TEST_CASE("dev::ControlBoardRemapperTest", "[yarp::dev]")

yarp::dev::IMultipleWrapper *imultwrap = nullptr;
REQUIRE(ddRemapper.view(imultwrap)); // interface for multiple wrapper correctly opened
REQUIRE(imultwrap);

CHECK(imultwrap->attachAll(fmcList)); // attachAll for controlboardremapper successful

Expand Down
2 changes: 2 additions & 0 deletions src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <yarp/dev/IVelocityControl.h>
#include <yarp/dev/IControlMode.h>
#include <yarp/os/Time.h>
#include <catch2/catch_amalgamated.hpp>

using namespace yarp::dev;
Expand Down Expand Up @@ -43,6 +44,7 @@ namespace yarp::dev::tests

b = ivel->velocityMove(0, ref_test);
CHECK(b);
yarp::os::Time::delay(0.050);
b = ivel->getRefVelocity(0,&ref);
CHECK(b);
CHECK(fabs(ref - ref_test) < 0.001);
Expand Down
14 changes: 10 additions & 4 deletions src/libYARP_os/tests/TimeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,16 @@ void test_yarp_delay(double target, double limit, bool strict_test)

TEST_CASE("os::TimeTest", "[yarp::os]")
{
#if defined(DISABLE_FAILING_TESTS)
const bool mandatory_enabled = false;
#else
const bool mandatory_enabled = true;
#endif

SECTION("testing delay using YARP (there will be a short pause)...")
{
//the original test (till yarp 3.6)
test_yarp_delay ( 3.000, 2.000, true);
test_yarp_delay ( 3.000, 2.000, mandatory_enabled);

//additional tests which do not generate an error but just prints
test_yarp_delay ( 3.000, 0.010, false);
Expand All @@ -90,8 +96,8 @@ TEST_CASE("os::TimeTest", "[yarp::os]")

SECTION("testing delay using C++ (there will be a short pause)...")
{
test_os_delay(3.000, 0.010, true);
test_os_delay(0.300, 0.010, true);
test_os_delay(0.030, 0.010, true);
test_os_delay(3.000, 0.010, mandatory_enabled);
test_os_delay(0.300, 0.010, mandatory_enabled);
test_os_delay(0.030, 0.010, mandatory_enabled);
}
}

0 comments on commit 8029300

Please sign in to comment.