diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-08-25 01:42:34 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-08-25 01:42:34 +0000 |
commit | f493b45950af67328acd3fa8c1bce931890148e0 (patch) | |
tree | 70fa4c8237740ce52381cea346544cc7f85d0792 | |
parent | 8e7e89e68b62d8bfa1a0ff6532fa93f27388986a (diff) | |
parent | 95e85404f59fb5f6fa3331a2b41ef324bfca6f1e (diff) | |
download | extras-f493b45950af67328acd3fa8c1bce931890148e0.tar.gz |
Merge "perfprofd: fix test PerfProfdTest.ConfigFileParsing."
-rw-r--r-- | perfprofd/configreader.cc | 1 | ||||
-rw-r--r-- | perfprofd/tests/perfprofd_test.cc | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/perfprofd/configreader.cc b/perfprofd/configreader.cc index 44111943..1c2e7c02 100644 --- a/perfprofd/configreader.cc +++ b/perfprofd/configreader.cc @@ -268,6 +268,7 @@ bool ConfigReader::parseLine(const std::string& key, uint64_t conv; if (!android::base::ParseUint(value, &conv)) { *error_msg = StringPrintf("line %u: value %s cannot be parsed", linecount, value.c_str()); + return false; } Data::values vals; auto iit = data_->u_info.find(key); diff --git a/perfprofd/tests/perfprofd_test.cc b/perfprofd/tests/perfprofd_test.cc index a26694c7..3748f3af 100644 --- a/perfprofd/tests/perfprofd_test.cc +++ b/perfprofd/tests/perfprofd_test.cc @@ -618,6 +618,7 @@ TEST_F(PerfProfdTest, ConfigFileParsing) // assorted bad syntax runner.addToConfig("collection_interval=-1"); + runner.addToConfig("collection_interval=18446744073709551615"); runner.addToConfig("nonexistent_key=something"); runner.addToConfig("no_equals_stmt"); @@ -629,9 +630,10 @@ TEST_F(PerfProfdTest, ConfigFileParsing) // Verify log contents const std::string expected = RAW_RESULT( - W: line 6: specified value 18446744073709551615 for 'collection_interval' outside permitted range [0 4294967295] - W: line 7: unknown option 'nonexistent_key' - W: line 8: line malformed (no '=' found) + W: line 6: value -1 cannot be parsed + W: line 7: specified value 18446744073709551615 for 'collection_interval' outside permitted range [0 4294967295] + W: line 8: unknown option 'nonexistent_key' + W: line 9: line malformed (no '=' found) ); // check to make sure log excerpt matches |