Fix --apimapping with unstructured parcelables
This fix consists of several related smaller fixes:
- --apimapping accepts positions arguments as inputs.
- --apimapping is a top-level command in HELP MSG.
- FOUND_PARCELABLE is handled as error consistently when -b is set.
- typo in aidl_parser_fuzzer.dict
Previously, FOUND_PARCELABLE error was returned from
load_and_validate_aidl and handled by callers. Treating it as error or
success was not consistent in various places.
Now, FOUND_PARCELABLE is returned only if -b is turned on and it is
always treated as an error by callers.
This fixes the crash that happens when --apimapping is called with
unstructured parcelables.
Bug: 196686928
Test: aidl_unittests
Test: m
Change-Id: I95cc9cc556825dc78f975d1f092b6420ec5399f8
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index cfa5d4a..672a25f 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -1143,6 +1143,15 @@
EXPECT_NE(nullptr, parse_result);
}
+TEST_F(AidlTest, ApiMappingAcceptsUnstructuredParcelables) {
+ io_delegate_.SetFileContents("p/Foo.aidl", "package p; parcelable Foo;");
+
+ Options options1 = Options::From("aidl --apimapping mapping.txt p/Foo.aidl");
+ CaptureStderr();
+ EXPECT_EQ(0, aidl_entry(options1, io_delegate_));
+ EXPECT_EQ("", GetCapturedStderr());
+}
+
TEST_F(AidlTest, FailOnParcelable) {
const string expected_foo_stderr =
"ERROR: p/IFoo.aidl:1.22-27: Refusing to generate code with unstructured parcelables. "