diff options
author | Lei YU <mine260309@gmail.com> | 2017-11-30 16:03:50 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2017-12-12 17:09:02 +0800 |
commit | 41470e56e5dce5d9d138fd2a136f0010571bc613 (patch) | |
tree | e414217104ad36ec1000dfe8a6fb7e6dd107c438 /test | |
parent | 482e31ff8e43e0fefbd697b1985795c4d35eec74 (diff) | |
download | openpower-occ-control-41470e56e5dce5d9d138fd2a136f0010571bc613.tar.gz openpower-occ-control-41470e56e5dce5d9d138fd2a136f0010571bc613.zip |
Powercap: add p8 support
P8 uses i2c-occ and powercap is not created.
Add P8 support by creating powercap object with i2c device name.
Fixes openbmc/openbmc#2688
Change-Id: Ia63070d63f4392cc4b084ab628cdbdcf4206c883
Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/TestI2cOcc.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/TestI2cOcc.cpp b/test/TestI2cOcc.cpp index c92da5b..bf976d7 100644 --- a/test/TestI2cOcc.cpp +++ b/test/TestI2cOcc.cpp @@ -28,6 +28,7 @@ const auto I2C_5_0051 = BASE + STR_5_0051; const auto I2C_6_0056 = BASE + STR_6_0056; const auto I2C_7_0057 = BASE + STR_7_0057; const auto NAME = "/name"; +const auto OCC_MASTER_NAME = "/occ_master"; const auto P8_OCC_HWMON = "p8-occ-hwmon"; const auto OTHER_STRING = "SomeOtherString123"s; @@ -69,14 +70,26 @@ public: ofs << "p8-occ-hwmon\n"; // 4-0050/name is p8-occ-hwmon ofs.close(); + ofs.open(I2C_4_0050 + OCC_MASTER_NAME); + ofs << "0\n"; // Make 4-0050 the slave occ + ofs.close(); + ofs.open(I2C_5_0051 + NAME); ofs << "p8-occ-hwmon\n"; // 5-0051/name is p8-occ-hwmon ofs.close(); + ofs.open(I2C_5_0051 + OCC_MASTER_NAME); + ofs << "0\n"; // Make 5-0051 the slave occ + ofs.close(); + ofs.open(I2C_6_0056 + NAME); ofs << "p8-occ-hwmon\n"; // 6-0056/name is p8-occ-hwmon ofs.close(); + ofs.open(I2C_6_0056 + OCC_MASTER_NAME); + ofs << "1\n"; // Make 6-0056 the master occ + ofs.close(); + ofs.open(I2C_7_0057 + NAME); ofs << "p8-occ-hwmon\n"; // 7-0057/name is p8-occ-hwmon ofs.close(); @@ -94,9 +107,11 @@ TEST_F(TestUtilGetOccHwmonDevices, getDevicesOK) // With test env, it shall find all the 4 p8-occ-hwmon devices auto ret = getOccHwmonDevices(BASE.c_str()); EXPECT_EQ(4u, ret.size()); - EXPECT_EQ(STR_4_0050, ret[0]); - EXPECT_EQ(STR_5_0051, ret[1]); - EXPECT_EQ(STR_6_0056, ret[2]); + // The first one shall be master occ + EXPECT_EQ(STR_6_0056, ret[0]); + // The left is sorted + EXPECT_EQ(STR_4_0050, ret[1]); + EXPECT_EQ(STR_5_0051, ret[2]); EXPECT_EQ(STR_7_0057, ret[3]); } |