Use AIDL_ERROR instead of std::cout or std::cerr
AIDL checks to make sure an error is emitted if there is a failure
somewhere. If we log the error with without AIDL_ERROR, the log is not
tracked.
Test: aidl_parser_fuzzer int_parse_failure
Bug: 168785519
Change-Id: Id6b1d3f6b20fef0a0a7efb3b85b6736d6eed477a
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index f367826..04303c8 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -874,7 +874,7 @@
TEST_P(AidlTest, FailOnMalformedConstHexValue) {
AidlError error;
const string expected_stderr =
- "ERROR: Could not parse hexvalue: 0xffffffffffffffffff at p/IFoo.aidl:3.50-70.\n";
+ "ERROR: p/IFoo.aidl:3.50-71: Could not parse hexvalue: 0xffffffffffffffffff\n";
CaptureStderr();
EXPECT_EQ(nullptr, Parse("p/IFoo.aidl",
R"(package p;
@@ -2500,7 +2500,7 @@
TEST_P(AidlTest, FailOnOutOfBoundsInt64MaxConstInt) {
AidlError error;
const string expected_stderr =
- "ERROR: Could not parse integer: 21474836509999999999999999 at p/IFoo.aidl:3.59-85.\n";
+ "ERROR: p/IFoo.aidl:3.59-86: Could not parse integer: 21474836509999999999999999\n";
CaptureStderr();
EXPECT_EQ(nullptr, Parse("p/IFoo.aidl",
R"(package p;
@@ -2516,7 +2516,7 @@
TEST_P(AidlTest, FailOnOutOfBoundsInt64MinConstInt) {
AidlError error;
const string expected_stderr =
- "ERROR: Could not parse integer: 21474836509999999999999999 at p/IFoo.aidl:3.61-86.\n";
+ "ERROR: p/IFoo.aidl:3.61-87: Could not parse integer: 21474836509999999999999999\n";
CaptureStderr();
EXPECT_EQ(nullptr, Parse("p/IFoo.aidl",
R"(package p;