psu-ng: Fix failing CI tests due to IBM_VPD
When c12c53b985b9ac12c3c83df47371e7c2c70ae21b merged, the CI tests for
the phosphor-power repository started intermittently failing.
The expected calls for updateInventory() do not apply if the
ibm-vpd=false, which is the default.
Add #if IBM_VPD check around test calls that are only expected if that
is enabled.
Tested:
x86sdk
$ meson --reconfigure ... -Dibm-vpd=false ... x86build
$ ninja -C x86build
$ ./x86build/phosphor-power-supply/test/phosphor-power-supply-tests
Verify no tests FAILED.
x86sdk
$ meson --reconfigure ... -Dibm-vpd=true ... x86build
$ ninja -C x86build
$ ./x86build/phosphor-power-supply/test/phosphor-power-supply-tests
Verify no tests FAILED.
Run openbmc-build-scripts/scripts/build-unit-test-docker
Verify SUCCESS.
See:
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc-build-scripts/+/42141
(Fix for meson problem in CI)
https://github.com/openbmc/docs/blob/master/testing/local-ci-build.md
(How to run local CI)
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I4d481d7a493157b298e28d87cb2d962a8bdf5ccf
diff --git a/phosphor-power-supply/test/power_supply_tests.cpp b/phosphor-power-supply/test/power_supply_tests.cpp
index b028d56..74d98c1 100644
--- a/phosphor-power-supply/test/power_supply_tests.cpp
+++ b/phosphor-power-supply/test/power_supply_tests.cpp
@@ -286,6 +286,7 @@
EXPECT_CALL(mockPMBus, readString(_, _)).WillRepeatedly(Return(""));
psu.updateInventory();
+#if IBM_VPD
EXPECT_CALL(mockPMBus, readString(_, _))
.WillOnce(Return("CCIN"))
.WillOnce(Return("PN3456"))
@@ -293,6 +294,7 @@
.WillOnce(Return("HEADER"))
.WillOnce(Return("SN3456"))
.WillOnce(Return("FW3456"));
+#endif
psu.updateInventory();
// TODO: D-Bus mocking to verify values stored on D-Bus (???)
}