From d6e4364ef435320a3cd8971f67a2a094b51212cd Mon Sep 17 00:00:00 2001 From: Cecille Freeman Date: Sat, 5 Mar 2022 11:28:52 -0500 Subject: [PATCH] Add timeout argument to test command The test cluster command in particular is very long and the time required to run it varies greatly depending on the network setup. On the M5, we are timing out with the already increased default value, whereas with a linux device this entire test completes in less than 10s. Rather than forcing every platform to use the same default, make the default settable on the command line. Test: added a log to ensure that the returned GetWaitDuration returns the value from the command line. It does, log is removed. --- examples/chip-tool/commands/tests/TestCommand.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index 482efe609be436..1b57908a6a621d 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -47,14 +47,17 @@ class TestCommand : public CHIPCommand, { AddArgument("delayInMs", 0, UINT64_MAX, &mDelayInMs); AddArgument("PICS", &mPICSFilePath); + AddArgument("testTimeoutInS", 0, UINT16_MAX, &mTimeout); } ~TestCommand(){}; /////////// CHIPCommand Interface ///////// CHIP_ERROR RunCommand() override; - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(kTimeoutInSeconds); } - + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } virtual void NextTest() = 0; protected: