Do not use regex to parse /proc/config.gz.

During boot, a compatibility check is performed and
/proc/config.gz is parsed. /proc/config.gz has
a well defined format:

    # CONFIG_FOO is not set
    CONFIG_BAR=y

with no trailing / leading spaces, spaces around
'=', or trailing comments. Using regex is slow
and unnecessary, hence a normal string search
is performed instead.

On the other hand, for assemble_vintf that needs to parse
android-base.cfg, because the file is maintained by
humans, free format is accepted, and regex is used.

Test: boots (boot time compat check passes)
Test: boot time regression no longer happens (~120ms vs. ~90ms)
Test: libvintf_test
Bug: 63537988
Change-Id: If6ab207d40459689386aaf40cd835effc5597886
diff --git a/test/main.cpp b/test/main.cpp
index b3b8a59..8dc5ddb 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -1310,8 +1310,9 @@
     EXPECT_EQ(matrix.getXmlSchemaPath("media_profile", {2, 0}), "");
 }
 
-std::pair<KernelConfigParser, status_t> processData(const std::string& data, bool processComments) {
-    KernelConfigParser parser(processComments);
+std::pair<KernelConfigParser, status_t> processData(const std::string& data, bool processComments,
+                                                    bool relaxedFormat = false) {
+    KernelConfigParser parser(processComments, relaxedFormat);
     const char* p = data.c_str();
     size_t n = 0;
     size_t chunkSize;
@@ -1378,7 +1379,7 @@
         "CONFIG_WORLD=hello world!       \n"
         "CONFIG_GOOD   =   good morning!  #comments here\n"
         "    CONFIG_MORNING   =   good morning!  \n";
-    auto pair = processData(data, true /* processComments */);
+    auto pair = processData(data, true /* processComments */, true /* relaxedFormat */);
     ASSERT_EQ(OK, pair.second) << pair.first.error();
     const auto& configs = pair.first.configs();
 
@@ -1403,7 +1404,7 @@
 
 TEST_P(KernelConfigParserInvalidTest, NonSet1) {
     const std::string data = "# CONFIG_NOT_EXIST is not sat\n";
-    auto pair = processData(data, GetParam() /* processComments */);
+    auto pair = processData(data, GetParam() /* processComments */, true /* relaxedFormat */);
     ASSERT_EQ(OK, pair.second) << pair.first.error();
     const auto& configs = pair.first.configs();
     EXPECT_EQ(configs.find("CONFIG_NOT_EXIST"), configs.end())
@@ -1412,12 +1413,14 @@
 
 TEST_P(KernelConfigParserInvalidTest, InvalidLine1) {
     const std::string data = "FOO_CONFIG=foo\n";
-    ASSERT_NE(OK, processData(data, GetParam() /* processComments */).second);
+    ASSERT_NE(OK,
+              processData(data, GetParam() /* processComments */, true /* relaxedFormat */).second);
 }
 
 TEST_P(KernelConfigParserInvalidTest, InvalidLine2) {
     const std::string data = "CONFIG_BAR-BAZ=foo\n";
-    ASSERT_NE(OK, processData(data, GetParam() /* processComments */).second);
+    ASSERT_NE(OK,
+              processData(data, GetParam() /* processComments */, true /* relaxedFormat */).second);
 }
 
 INSTANTIATE_TEST_CASE_P(KernelConfigParser, KernelConfigParserInvalidTest, ::testing::Bool());