diff --git a/examples/chip-tool/commands/tests/Commands.h b/examples/chip-tool/commands/tests/Commands.h index 37d9ffdfd8a335..807a9bbe4e4f37 100644 --- a/examples/chip-tool/commands/tests/Commands.h +++ b/examples/chip-tool/commands/tests/Commands.h @@ -31,6 +31,12 @@ class TestCluster : public TestCommand { CHIP_ERROR err = CHIP_NO_ERROR; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, "TestCluster: Test complete"); + SetCommandExitStatus(true); + } + switch (mTestIndex) { case 0: @@ -51,10 +57,10 @@ class TestCluster : public TestCommand } mTestIndex++; - if (mTestCount == mTestIndex || CHIP_NO_ERROR != err) + if (CHIP_NO_ERROR != err) { ChipLogProgress(chipTool, "TestCluster: %s", chip::ErrorStr(err)); - SetCommandExitStatus(CHIP_NO_ERROR == err); + SetCommandExitStatus(false); } return err; @@ -438,6 +444,12 @@ class OnOffCluster : public TestCommand { CHIP_ERROR err = CHIP_NO_ERROR; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, "OnOffCluster: Test complete"); + SetCommandExitStatus(true); + } + switch (mTestIndex) { case 0: @@ -458,10 +470,10 @@ class OnOffCluster : public TestCommand } mTestIndex++; - if (mTestCount == mTestIndex || CHIP_NO_ERROR != err) + if (CHIP_NO_ERROR != err) { ChipLogProgress(chipTool, "OnOffCluster: %s", chip::ErrorStr(err)); - SetCommandExitStatus(CHIP_NO_ERROR == err); + SetCommandExitStatus(false); } return err; diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index e8393319139364..2a201787bb4525 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -9,6 +9,12 @@ class {{asCamelCased filename false}}: public TestCommand { CHIP_ERROR err = CHIP_NO_ERROR; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, "{{filename}}: Test complete"); + SetCommandExitStatus(true); + } + switch (mTestIndex) { {{#chip_tests_items}} @@ -19,10 +25,10 @@ class {{asCamelCased filename false}}: public TestCommand } mTestIndex++; - if (mTestCount == mTestIndex || CHIP_NO_ERROR != err) + if (CHIP_NO_ERROR != err) { ChipLogProgress(chipTool, "{{filename}}: %s", chip::ErrorStr(err)); - SetCommandExitStatus(CHIP_NO_ERROR == err); + SetCommandExitStatus(false); } return err;