Skip to content

Instantly share code, notes, and snippets.

@smccarney
Last active June 5, 2024 21:13
Show Gist options
  • Save smccarney/28cd3f04e37c84713168a63831928b69 to your computer and use it in GitHub Desktop.
Save smccarney/28cd3f04e37c84713168a63831928b69 to your computer and use it in GitHub Desktop.
Test plan for "pseq: Switch to new pgood isolation support"

Test Plan

Automated Tests

  • Verify all automated tests build and run successfully

Manual Tests

Tests based on code changes in this commit

  • src/power_control.hpp
    • No implementation in header file
  • src/power_control.cpp
    • Test all methods in this class since there was so much change
    • PowerControl::PowerControl()
      • Verify all data members initialized correctly
        • sdbusplus::bus_t& bus;
        • BMCServices services;
        • util::CompatibleSystemTypesFinder compatSysTypesFinder;
        • std::vectorstd::string compatibleSystemTypes;
        • DeviceFinder deviceFinder;
        • std::optional deviceProperties;
        • std::unique_ptr device;
        • bool failureFound{false};
        • bool inStateTransition{false};
        • static constexpr std::chrono::seconds minimumColdStartTime{15};
        • static constexpr std::chrono::seconds minimumPowerOffTime{25};
        • int pgood{0};
        • gpiod::line pgoodLine;
        • static constexpr std::chrono::seconds pgoodTimeout{10};
        • std::chrono::time_pointstd::chrono::steady_clock pgoodTimeoutTime;
        • sdeventplus::utility::Timersdeventplus::ClockId::Monotonic pgoodWaitTimer;
        • static constexpr std::chrono::milliseconds pollInterval{3000};
        • gpiod::line powerControlLine;
        • std::chrono::time_pointstd::chrono::steady_clock powerOnAllowedTime;
        • std::string powerSupplyError;
        • int state{0};
        • std::chrono::seconds timeout{pgoodTimeout};
        • sdeventplus::utility::Timersdeventplus::ClockId::Monotonic timer;
      • Verify it sets up the GPIOs for chassis power on/off and chassis pgood
    • PowerControl::getPgood()
      • Verify it returns the correct value
    • PowerControl::getPgoodTimeout()
      • Verify it returns the correct value
    • PowerControl::getState()
      • Verify it returns the correct value
    • PowerControl::onFailureCallback()
      • Verify logs an informational journal message
      • Verify calls onFailure(false)
      • Verify it powers off the system
    • PowerControl::onFailure()
      • Test where device object was not created
      • Test where device object was created
        • Test where pgood fault found on rail monitored by device
          • Test where fault found in PSU rail
            • Test where powerSupplyError is empty
            • Test where powerSupplyError is not empty
          • Test where fault found in non-PSU rail
          • Verify returned error string
          • Verify returned additional data
        • Test where pgood fault not found on rail monitored by device
        • Test when exception occurs during pgood isolation
          • Verify logs an error journal message
          • Verify ERROR property set to exception message in AdditionalData
      • Test where error was found by power sequencer device
        • Verify rail specific error is logged with correct AdditionalData
          • Verify application
          • Verify severity
          • Verify SRC
          • Verify Callouts
          • Verify AdditionalData
          • Verify captured journal messages
      • Test where error was not found by power sequencer device
        • Test where powerSupplyError is not empty
          • Verify powerSupplyError is logged
            • Verify application
            • Verify severity
            • Verify SRC
            • Verify Callouts
            • Verify AdditionalData
            • Verify captured journal messages
        • Test where wasTimeOut is true
          • Verify powerOnTimeoutError is logged
            • Verify application
            • Verify severity
            • Verify SRC
            • Verify Callouts
            • Verify AdditionalData
            • Verify captured journal messages
        • Test where wasTimeOut is false
          • Verify shutdownError is logged
            • Verify application
            • Verify severity
            • Verify SRC
            • Verify Callouts
            • Verify AdditionalData
            • Verify captured journal messages
      • Verify BMC dump is created if wasTimeOut is false
      • Verify BMC dump is not created if wasTimeOut is true
    • PowerControl::pollPgood()
      • Test where in state transition
        • Test where pgood timeout has not occurred
        • Test where pgood timeout has occurred
          • Verify error message written to journal
          • Verify inStateTransition is set to false
          • Test where attempting to power on
            • Verify onFailure(true) called
          • Test where attempting to power off
            • Verify powerOffTimeError is logged
          • Verify failureFound is set to true
        • Verify it obtains the correct chassis pgood value
        • Test where pgood value has changed
          • Verify value is stored
          • Test where new value is 0
            • Verify power lost signal is emitted
          • Test where new value is 1
            • Verify power good signal is emitted
            • Verify powerSupplyError is cleared
            • Verify failureFound is set to false
            • Verify pgood PropertyChanged signal is emitted
        • Test where pgood state has not changed and pgoodState equals state
          • Verify inStateTransition set to false
        • Test where pgood state has not changed, not in state transition, pgoodState is 0, and failureFound is false
          • Verify error message written to journal
          • Verify pgoodWaitTimer is set to call onFailureCallback after 7 seconds
          • Verify failureFound set to true
    • PowerControl::setPgoodTimeout
      • Test where new value is same as the old value
      • Test where new value is not same as the old value
        • Verify timeout is changed
        • Verify pgood_timeout PropertyChanged signal is emitted
    • PowerControl::setPowerSupplyError()
      • Verify powerSupplyError is stored
      • Verify informational message is written to journal by PowerInterface code
    • PowerControl::setState()
      • Test where new state is same as current state
        • Verify information message is written to journal
        • Verify no other action is taken
      • Test where state is 0
        • Verify app sleeps for 2 seconds
      • Test where state is 1
        • Test where minimum power off time has not passed
          • Verify app sleeps until minimum power off time
          • Verify information message written to journal
        • Test where minimum power off time has passed
          • Verify no sleep or journal message occurs
      • Verify information message written to journal with new state
      • Verify GPIO that powers on/off chassis is set to new state
      • Test where state is 0
        • Verify new minimum power off time is stored
      • Verify new pgood timeout time is stored
      • Verify inStateTransition is set to true
      • Verify state is set to new state
      • Verify state PropertyChanged signal is emitted
    • PowerControl::compatibleSystemTypesFound()
      • Test where we already stored compatible system types
        • Verify exits immediately
      • Test where we didn't already store compatible system types
        • Verify information message written to journal with correct list of types
        • Verify types are stored
        • Verify it attempts to create a Device object
          • Test where it works because we already stored device properties
          • Test where it fails because we have not already stored device properties
    • PowerControl::deviceFound()
      • Test where we already stored device properties
        • Verify exits immediately
      • Test where we didn't already store device properties
        • Verify information message written to journal with correct property values
        • Verify device properties are stored
        • Verify it attempts to create a Device object
          • Test where it works because we already stored compatible system types
          • Test where it fails because we have not already stored compatible system types
    • PowerControl::setUpGpio()
      • Test where pgood GPIO line is found
      • Test where pgood GPIO line is not found
        • Verify error message is written to journal
        • Verify InternalError error log is created
          • Verify application
          • Verify severity
          • Verify SRC
          • Verify Callouts
          • Verify AdditionalData
          • Verify captured journal messages
        • Verify application exits with runtime_error exception
      • Test where power control GPIO line is found
      • Test where power control GPIO line is not found
        • Verify error message is written to journal
        • Verify InternalError error log is created
          • Verify application
          • Verify severity
          • Verify SRC
          • Verify Callouts
          • Verify AdditionalData
          • Verify captured journal messages
        • Verify application exits with runtime_error exception
      • Verify it obtains the correct pgood value from the GPIO
      • Verify pgood data member is set to pgood value
      • Verify state data member is set to pgood value
      • Verify information message is written to journal with pgood value
    • PowerControl::loadConfigFileAndCreateDevice()
      • Test where compatible system types have not been found
        • Verify exits without doing anything
      • Test where device properties have not been found
        • Verify exits without doing anything
      • Test where compatible system types and device properties have been found
        • Test where config file is not found
        • Test where config file is found
          • Test where config file is not parsed successfully
          • Test where config file is parsed successfully
            • Verify createDevice() is called with voltage rails from config file
    • PowerControl::findConfigFile()
      • Test where compatible system types have not been found
        • Verify empty config file path is returned
      • Test where compatible system types have been found
        • Test where config file is not found
          • Verify empty config file path is returned
        • Test where config file is found
          • Verify informational message is written to the journal
          • Verify correct config file path is returned
        • Test where exception occurs
          • Verify error message is written to the journal
          • Verify empty config file path is returned
    • PowerControl::parseConfigFile()
      • Test where config file is successfully parsed
        • Verify rails are stored in output parameter
        • Verify returns true
      • Test where exception occurs
        • Verify error message is written to the journal
        • Verify rails output parameter is empty
        • Verify returns false
    • PowerControl::createDevice()
      • Test where device properties have not been found
        • Verify it does nothing
      • Test where device properties have been found
        • Test where type is "UCD90160"
          • Verify UCD90160Device object is created with the correct rails, bus, and address
          • Verify informational message is written to the journal
        • Test where type is "UCD90320"
          • Verify UCD90320Device object is created with the correct rails, bus, and address
          • Verify informational message is written to the journal
        • Test where type is unexpected
          • Verify an exception is thrown
        • Test where exception occurs
          • Verify error message is written to the journal
          • Verify device data member is not set

End-to-end tests

  • Compatible system types
    • Test where compatible system types are found
      • Types are already on D-Bus when app starts
      • Types are obtained later from D-Bus via InterfacesAdded listener
      • Verify the right values are found
      • Verify Device object is created with correct rails
      • Verify when a pgood fault occurs a rail-specific error is logged
    • Test where compatible system types are not found
      • Verify Device object is not created
      • Verify when a pgood fault occurs a generic error is logged
  • Device properties
    • Test where device properties are found
      • Properties are already on D-Bus when app starts
      • Properties are obtained later from D-Bus via InterfacesAdded listener
      • Verify the right values are found
      • Verify Device object is created with correct rails
      • Verify when a pgood fault occurs a rail-specific error is logged
    • Test where compatible system types are not found
      • Verify Device object is not created
      • Verify when a pgood fault occurs a generic error is logged
  • Test where power on is successful
    • Verify no timeout occurs
    • Verify UCD power on sequence completes and pgood state changes to true
    • Verify no errors logged
    • Verify no error messages written to journal by this app
    • Verify obmcutil reports powered on state
    • Verify no BMC dump occurs
  • Test where power on fails during power on sequence
    • Verify timeout occurs
    • Verify UCD power on sequence never completes and pgood state never changes to true
    • Verify correct pgood error is logged
    • Verify correct journal error messages are written
    • Verify system is powered off automatically
    • Verify obmcutil reports powered off state
    • Verify no BMC dump occurs
  • Test where power on fails after power on sequence
    • Verify no timeout occurs
    • Verify UCD power on sequence completes and pgood state changes to true
    • Verify pgood state changes to false later
    • Verify correct pgood error is logged
    • Verify correct journal error messages are written
    • Verify system is powered off automatically
    • Verify obmcutil reports powered off state
    • Verify BMC dump occurs
  • Test where power off is successful
    • Verify no timeout occurs
    • Verify UCD power off sequence completes and pgood state changes to false
    • Verify no errors logged
    • Verify no error messages written to journal by this app
    • Verify obmcutil reports powered off state
    • Verify no BMC dump occurs
  • Test where power off fails due to a timeout
    • Verify timeout occurs
    • Verify UCD power off sequence never completes and pgood state never changes to false
    • Verify correct error is logged
    • Verify correct journal error messages are written
    • Verify system is powered off automatically
    • Verify obmcutil reports powered off state
    • Verify no BMC dump occurs

Rainier regression tests

  • Test where no pgood error occurs
  • Test where pgood error occurs during UCD power on sequence
    • 12.0V
    • 5.0V_USB
    • 5.0V_DASD
    • 3.3VA
    • 3.3VB
    • VDN_DCM0
    • VDN_DCM1
    • 1.5V
    • VDDA_DCM0
    • VDDB_DCM0
    • VDDA_DCM1
    • VDDB_DCM1
    • VCS_DCM0
    • VCS_DCM1
    • VIO_DCM0
    • VIO_DCM1
    • VPCIE_DCM0
    • VPCIE_DCM1
  • Test where pgood error occurs after UCD power on sequence
    • 12.0V
    • 5.0V_USB
    • 5.0V_DASD
    • 3.3VA
    • 3.3VB
    • VDN_DCM0
    • VDN_DCM1
    • 1.5V
    • VDDA_DCM0
    • VDDB_DCM0
    • VDDA_DCM1
    • VDDB_DCM1
    • VCS_DCM0
    • VCS_DCM1
    • VIO_DCM0
    • VIO_DCM1
    • VPCIE_DCM0
    • VPCIE_DCM1

Everest regression tests

  • Test where no pgood error occurs
  • Test where pgood error occurs during UCD power on sequence
    • 12.0V
    • 3V3IO
    • CP03_AVDD
    • CP12_AVDD
    • CP0_VDN
    • CP1_VDN
    • CP2_VDN
    • CP3_VDN
    • CP0_VDD0
    • CP1_VDD0
    • CP2_VDD0
    • CP3_VDD0
    • CP0_VDD1
    • CP1_VDD1
    • CP2_VDD1
    • CP3_VDD1
    • CP0_VCS0
    • CP1_VCS0
    • CP2_VCS0
    • CP3_VCS0
    • CP0_VCS1
    • CP1_VCS1
    • CP2_VCS1
    • CP3_VCS1
    • CP0_VIO
    • CP1_VIO
    • CP2_VIO
    • CP3_VIO
    • CP0_VPCIE
    • CP1_VPCIE
    • CP2_VPCIE
    • CP3_VPCIE
  • Test where pgood error occurs after UCD power on sequence
    • 12.0V
    • 3V3IO
    • CP03_AVDD
    • CP12_AVDD
    • CP0_VDN
    • CP1_VDN
    • CP2_VDN
    • CP3_VDN
    • CP0_VDD0
    • CP1_VDD0
    • CP2_VDD0
    • CP3_VDD0
    • CP0_VDD1
    • CP1_VDD1
    • CP2_VDD1
    • CP3_VDD1
    • CP0_VCS0
    • CP1_VCS0
    • CP2_VCS0
    • CP3_VCS0
    • CP0_VCS1
    • CP1_VCS1
    • CP2_VCS1
    • CP3_VCS1
    • CP0_VIO
    • CP1_VIO
    • CP2_VIO
    • CP3_VIO
    • CP0_VPCIE
    • CP1_VPCIE
    • CP2_VPCIE
    • CP3_VPCIE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment