mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 14:58:53 +08:00
Syncing unit tests with spec changes
This commit is contained in:
@@ -74,10 +74,10 @@ public:
|
||||
* request interval [ms] = floor(5000 [ms] bootloader timeout / 123 nodes)
|
||||
* Which yields 40 ms.
|
||||
*
|
||||
* Given default service timeout 500 ms and the defined above request frequency 40 ms, the maximum number of
|
||||
* Given default service timeout 1000 ms and the defined above request frequency 40 ms, the maximum number of
|
||||
* concurrent requests will be:
|
||||
* max concurrent requests = ceil(500 [ms] timeout / 40 [ms] request interval)
|
||||
* Which yields 13 requests.
|
||||
* max concurrent requests = ceil(1000 [ms] timeout / 40 [ms] request interval)
|
||||
* Which yields 25 requests.
|
||||
*
|
||||
* Keep the above equations in mind when changing the default request interval.
|
||||
*
|
||||
|
||||
@@ -281,7 +281,7 @@ TEST(ServiceClient, ConcurrentCalls)
|
||||
ASSERT_LT(0, client.call(1, request, last_call_id));
|
||||
}
|
||||
|
||||
ASSERT_LT(0, client.call(99, root_ns_a::StringService::Request())); // Will timeout in 500 ms
|
||||
ASSERT_LT(0, client.call(99, root_ns_a::StringService::Request())); // Will timeout in 1000 ms
|
||||
|
||||
client.setRequestTimeout(uavcan::MonotonicDuration::fromMSec(100));
|
||||
|
||||
@@ -342,9 +342,9 @@ TEST(ServiceClient, ConcurrentCalls)
|
||||
ASSERT_TRUE(handler.match(ResultType::ErrorTimeout, 88, root_ns_a::StringService::Response()));
|
||||
|
||||
/*
|
||||
* Validating the 500 ms timeout
|
||||
* Validating the 1000 ms timeout
|
||||
*/
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(500));
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(1000));
|
||||
|
||||
ASSERT_FALSE(client.hasPendingCalls());
|
||||
ASSERT_EQ(0, client.getNumPendingCalls()); // All finished
|
||||
|
||||
@@ -136,7 +136,7 @@ TEST(dynamic_node_id_server_NodeDiscoverer, Basic)
|
||||
std::cout << "!!! Enabling discovery" << std::endl;
|
||||
handler.can_discover = true;
|
||||
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(650));
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(1150));
|
||||
|
||||
ASSERT_EQ(1, tracer.countEvents(TraceDiscoveryNewNodeFound));
|
||||
ASSERT_EQ(1, tracer.countEvents(TraceDiscoveryTimerStart));
|
||||
@@ -173,7 +173,7 @@ TEST(dynamic_node_id_server_NodeDiscoverer, Basic)
|
||||
get_node_info_server.response.hardware_version.unique_id[14] = 52;
|
||||
ASSERT_LE(0, get_node_info_server.start());
|
||||
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(500));
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(1000));
|
||||
|
||||
ASSERT_EQ(1, tracer.countEvents(TraceDiscoveryNewNodeFound));
|
||||
ASSERT_EQ(1, tracer.countEvents(TraceDiscoveryTimerStart));
|
||||
@@ -225,7 +225,7 @@ TEST(dynamic_node_id_server_NodeDiscoverer, RestartAndMaxAttempts)
|
||||
node_status.uptime_sec = 10; // Nonzero
|
||||
ASSERT_LE(0, node_status_pub.broadcast(node_status));
|
||||
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(1600));
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(3100));
|
||||
|
||||
ASSERT_EQ(1, tracer.countEvents(TraceDiscoveryNewNodeFound));
|
||||
ASSERT_EQ(1, tracer.countEvents(TraceDiscoveryTimerStart));
|
||||
@@ -242,7 +242,7 @@ TEST(dynamic_node_id_server_NodeDiscoverer, RestartAndMaxAttempts)
|
||||
node_status.uptime_sec = 9; // Less than previous
|
||||
ASSERT_LE(0, node_status_pub.broadcast(node_status));
|
||||
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(1600));
|
||||
nodes.spinBoth(uavcan::MonotonicDuration::fromMSec(3100));
|
||||
|
||||
ASSERT_EQ(1, tracer.countEvents(TraceDiscoveryNewNodeFound));
|
||||
ASSERT_EQ(1, tracer.countEvents(TraceDiscoveryTimerStart));
|
||||
|
||||
@@ -255,7 +255,7 @@ TEST(NodeInfoRetriever, MaxConcurrentRequests)
|
||||
|
||||
ASSERT_EQ(40, retr.getRequestInterval().toMSec());
|
||||
|
||||
const unsigned MaxPendingRequests = 14; // See class docs
|
||||
const unsigned MaxPendingRequests = 26; // See class docs
|
||||
const unsigned MinPendingRequestsAtFullLoad = 12;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user