diff options
author | Wei Wang <wvw@google.com> | 2018-04-16 20:30:36 -0700 |
---|---|---|
committer | Wei Wang <wvw@google.com> | 2018-06-06 11:31:59 -0700 |
commit | 55b9d6d40eb7f7458cf142a3cbe9946cf0b8bd81 (patch) | |
tree | 24341f2fdc9fbb35275883e8c895b87da1c04d15 /libperfmgr/tests | |
parent | 6ac764eb3737a90442caa78e833c8889471316e6 (diff) | |
download | extras-55b9d6d40eb7f7458cf142a3cbe9946cf0b8bd81.tar.gz |
libperfmgr: change to use Value directly in config
Using Value directly is more clear and intuitive than using an index of
Values.
Bug: 77282526
Test: libperfmgr_test and boot wahoo
(cherry picked from commit 4ea001c2d3dc3f5c8421a5e86098272b295b213e)
Change-Id: Id6bd284c431d347e36ba8ce2bb4c82a7a4924852
Diffstat (limited to 'libperfmgr/tests')
-rw-r--r-- | libperfmgr/tests/HintManagerTest.cc | 17 | ||||
-rw-r--r-- | libperfmgr/tests/NodeLooperThreadTest.cc | 3 | ||||
-rw-r--r-- | libperfmgr/tests/NodeTest.cc | 7 |
3 files changed, 16 insertions, 11 deletions
diff --git a/libperfmgr/tests/HintManagerTest.cc b/libperfmgr/tests/HintManagerTest.cc index 0630fe7f..2355b8ff 100644 --- a/libperfmgr/tests/HintManagerTest.cc +++ b/libperfmgr/tests/HintManagerTest.cc @@ -61,19 +61,19 @@ constexpr auto kSLEEP_TOLERANCE_MS = 50ms; // { // "PowerHint": "INTERACTION", // "Node": "CPUCluster1MinFreq", -// "ValueIndex": 1, +// "Value": "1134000", // "Duration": 800 // }, // { // "PowerHint": "LAUNCH", // "Node": "CPUCluster0MinFreq", -// "ValueIndex": 1, +// "Value": "1134000", // "Duration": 500 // }, // { // "PowerHint": "LAUNCH", // "Node": "CPUCluster1MinFreq", -// "ValueIndex": 0, +// "Value": "1512000", // "Duration": 2000 // } // ] @@ -86,10 +86,12 @@ constexpr char kJSON_RAW[] = "\"Path\":\"/sys/devices/system/cpu/cpu4/cpufreq/" "scaling_min_freq\",\"Values\":[\"1512000\",\"1134000\",\"384000\"]," "\"HoldFd\":true}],\"Actions\":[{\"PowerHint\":\"INTERACTION\",\"Node\":" - "\"CPUCluster1MinFreq\",\"ValueIndex\":1,\"Duration\":800},{\"PowerHint\":" - "\"LAUNCH\",\"Node\":\"CPUCluster0MinFreq\",\"ValueIndex\":1,\"Duration\":" + "\"CPUCluster1MinFreq\",\"Value\":\"1134000\",\"Duration\":800},{" + "\"PowerHint\":" + "\"LAUNCH\",\"Node\":\"CPUCluster0MinFreq\",\"Value\":\"1134000\"," + "\"Duration\":" "500},{\"PowerHint\":\"LAUNCH\",\"Node\":\"CPUCluster1MinFreq\"," - "\"ValueIndex\":0,\"Duration\":2000}]}"; + "\"Value\":\"1512000\",\"Duration\":2000}]}"; class HintManagerTest : public ::testing::Test, public HintManager { protected: @@ -150,7 +152,8 @@ class HintManagerTest : public ::testing::Test, public HintManager { std::string json_doc_; }; -static inline void _VerifyPathValue(const std::string& path, const std::string& value) { +static inline void _VerifyPathValue(const std::string& path, + const std::string& value) { std::string s; EXPECT_TRUE(android::base::ReadFileToString(path, &s)) << strerror(errno); EXPECT_EQ(value, s); diff --git a/libperfmgr/tests/NodeLooperThreadTest.cc b/libperfmgr/tests/NodeLooperThreadTest.cc index 6f96cf8f..24659cf7 100644 --- a/libperfmgr/tests/NodeLooperThreadTest.cc +++ b/libperfmgr/tests/NodeLooperThreadTest.cc @@ -54,7 +54,8 @@ class NodeLooperThreadTest : public ::testing::Test { std::vector<std::unique_ptr<TemporaryFile>> files_; }; -static inline void _VerifyPathValue(const std::string& path, const std::string& value) { +static inline void _VerifyPathValue(const std::string& path, + const std::string& value) { std::string s; EXPECT_TRUE(android::base::ReadFileToString(path, &s)) << strerror(errno); EXPECT_EQ(value, s); diff --git a/libperfmgr/tests/NodeTest.cc b/libperfmgr/tests/NodeTest.cc index 2e37a4d5..02429ccd 100644 --- a/libperfmgr/tests/NodeTest.cc +++ b/libperfmgr/tests/NodeTest.cc @@ -33,7 +33,8 @@ using namespace std::chrono_literals; constexpr double kTIMING_TOLERANCE_MS = std::chrono::milliseconds(25).count(); constexpr auto kSLEEP_TOLERANCE_MS = 2ms; -static inline void _VerifyPathValue(const std::string& path, const std::string& value) { +static inline void _VerifyPathValue(const std::string& path, + const std::string& value) { std::string s; EXPECT_TRUE(android::base::ReadFileToString(path, &s)) << strerror(errno); EXPECT_EQ(value, s); @@ -63,8 +64,8 @@ TEST(NodeTest, DumpToFdTest) { TemporaryFile dumptf; t.DumpToFd(dumptf.fd); fsync(dumptf.fd); - std::string buf(android::base::StringPrintf("test_dump\t%s\t1\tvalue1\n", - tf.path)); + std::string buf( + android::base::StringPrintf("test_dump\t%s\t1\tvalue1\n", tf.path)); _VerifyPathValue(dumptf.path, buf); } |