[libcamera-devel] [PATCH 1/6] test: log: log_process: Log an error when failing due to incorrect message

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Dec 6 22:05:19 CET 2023


One of the error paths in the test returns without logging a message,
which makes failures difficult to debug. Fix it by adding an error
message.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 test/log/log_process.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/log/log_process.cpp b/test/log/log_process.cpp
index 966b80cf3af7..17af7d74a1d5 100644
--- a/test/log/log_process.cpp
+++ b/test/log/log_process.cpp
@@ -115,8 +115,11 @@ protected:
 		close(fd);
 
 		string str(buf);
-		if (str.find(message) == string::npos)
+		if (str.find(message) == string::npos) {
+			cerr << "Received message is not correct (received "
+			     << str.length() << " bytes)" << endl;
 			return TestFail;
+		}
 
 		return TestPass;
 	}
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list