From afe0fef5c9344d51530a285f3814d37f50467094 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 27 Apr 2022 10:19:47 -0400 Subject: [PATCH] Fix error reporting in chip-tool. (#17760) The actual error message got lost in #17628. --- examples/chip-tool/commands/tests/TestCommand.cpp | 2 +- examples/placeholder/linux/include/TestCommand.h | 2 +- src/app/tests/suites/include/TestRunner.h | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 32f1ac00fa7cad..ad881b5d78c43d 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -77,7 +77,7 @@ void TestCommand::Exit(std::string message, CHIP_ERROR err) { mContinueProcessing = false; - LogEnd(err); + LogEnd(message, err); if (CHIP_NO_ERROR == err) { diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index 9696412568e708..6fd3655a22a70a 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -86,7 +86,7 @@ class TestCommand : public TestRunner, void Exit(std::string message, CHIP_ERROR err) override { - LogEnd(err); + LogEnd(message, err); SetCommandExitStatus(err); } diff --git a/src/app/tests/suites/include/TestRunner.h b/src/app/tests/suites/include/TestRunner.h index 57ed9500c6f2c0..05310351b2c425 100644 --- a/src/app/tests/suites/include/TestRunner.h +++ b/src/app/tests/suites/include/TestRunner.h @@ -33,15 +33,15 @@ class TestRunner ChipLogProgress(chipTool, " ***** Test Step %u : %s\n", stepNumber, stepName); } - void LogEnd(CHIP_ERROR err) + void LogEnd(std::string message, CHIP_ERROR err) { if (CHIP_NO_ERROR == err) { - ChipLogProgress(chipTool, " **** Test Complete: %s\n", mTestName); + ChipLogProgress(chipTool, " **** Test Complete: %s\n", message.c_str()); } else { - ChipLogError(chipTool, " ***** Test Failure: %s\n", mTestName); + ChipLogError(chipTool, " ***** Test Failure: %s\n", message.c_str()); } } @@ -59,7 +59,6 @@ class TestRunner if (mTestCount == mTestIndex) { - LogEnd(CHIP_NO_ERROR); Exit(mTestName, CHIP_NO_ERROR); return; }