Skip to content

Instantly share code, notes, and snippets.

@smccarney
Last active October 7, 2020 15:03
Show Gist options
  • Save smccarney/60ecbc018c55a5d13661bda8ee256d61 to your computer and use it in GitHub Desktop.
Save smccarney/60ecbc018c55a5d13661bda8ee256d61 to your computer and use it in GitHub Desktop.
Test plan for DBusErrorLogging class

Test plan for DBusErrorLogging implementation

Tests based on source code (white box)

  • error_logging.[hc]pp n DBusErrorLogging()
    • logConfigFileError()
      • Verify logs error of type xyz.openbmc_project.Power.Regulators.Error.ConfigFile
      • Verify specified severity is used
    • logDBusError()
      • Verify logs error of type xyz.openbmc_project.Power.Error.DBus
      • Verify specified severity is used
    • logI2CError()
      • Verify logs error of type xyz.openbmc_project.Power.Error.I2C
      • Verify specified severity is used
      • Verify bus stored in CALLOUT_IIC_BUS property correctly
      • Verify address stored in CALLOUT_IIC_ADDR property correctly as hex string
      • Verify errno value stored in CALLOUT_ERRNO property correctly
    • logInternalError()
      • Verify logs error of type xyz.openbmc_project.Power.Error.Internal
      • Verify specified severity is used
    • logPMBusError()
      • Verify logs error of type xyz.openbmc_project.Power.Error.PMBus
      • Verify specified severity is used
      • Verify relative inventory path stored as absolute path in CALLOUT_INVENTORY_PATH property correctly
    • logWriteVerificationError()
      • Verify logs error of type xyz.openbmc_project.Power.Regulators.Error.WriteVerification
      • Verify specified severity is used
      • Verify relative inventory path stored as absolute path in CALLOUT_INVENTORY_PATH property correctly
    • createFFDCFile()
      • Verify resulting user-defined section fields
        • Type Text
        • SubType 0
        • Version 0
      • Test where various line cases
        • vector has one line
        • vector has multiple lines
        • line is empty
        • line is not empty: Contains only a newline
        • line is not empty: Contains only one character
        • line is not empty: Contains characters + newline
        • line is not empty: Contains characters but no newline
      • Writing lines to file
        • Test where works
          • Verify all data written to the file
          • Test where all bytes written in one operation
          • Test where takes multiple operations to finish the write
        • Test where fails
      • Seeking to beginning of file
        • Test where works
        • Test where fails
    • createFFDCFiles()
      • Verify creates an FFDC file for each executable
      • Test where messages vector is empty
      • Test where messages vector is not empty
      • Test where createFFDCFile() works
      • Test where createFFDCFile() fails
        • Verify error is written to the journal
        • Verify continues to next executable
    • createFFDCTuples()
      • Test where vector of FFDCFile is empty
      • Test where vector of FFDCFile is not empty
        • Verify creates tuple with all 4 properties set correctly
        • Verify that vector of FFDCTuple in same order as vector of FFDCFile
    • getAbsoluteInventoryPath()
      • Test where inventoryPath is empty
      • Test where inventoryPath is not empty
        • Test where relative path starts with '/'
        • Test where relative path does not start with '/'
      • Verify resulting absolute path is correct with proper prefix
    • logError()
      • Verify PID stored in _PID property
      • Test where createFFDCFiles() works
        • Test where zero FFDCFiles created
        • Test where one FFDCFiles created
        • Test where two FFDCFiles created
      • Test where createFFDCFiles() fails
        • Verify error is written to the journal
        • Verify no error log created
      • Verify FFDCTuples are created successfully
      • Method call
        • Test where works
          • Verify parameters passed to method
            • message
            • severity
            • additionalData
            • FFDC tuples
        • Test where fails
          • Invalid service name
          • Invalid object path
          • Invalid interface name
          • Invalid method name
      • Verify FFDC files are removed
        • When error logging was successfully created/no exception
        • When error logging was not created/exception thrown
    • removeFFDCFiles()
      • Verify tries to remove all the FFDC files
        • Test where works
        • Test where fails
          • Verify error written to journal
          • Verify still removes the remaining files
  • mock_error_logging.hpp
    • Verify a test case can use MockErrorLogging successfully
    • logConfigFileError()
    • logDBusError()
    • logI2CError()
    • logInternalError()
    • logPMBusError()
    • logWriteVerificationError()

High level tests (black box)

  • Verify that a base BMC error log entry is created
  • Verify that a PEL is created
  • Verify that each type of error is created successfully
    • xyz.openbmc_project.Power.Regulators.Error.WriteVerification
    • xyz.openbmc_project.Power.Regulators.Error.ConfigFile
    • xyz.openbmc_project.Power.Error.Internal
    • xyz.openbmc_project.Power.Error.I2C
    • xyz.openbmc_project.Power.Error.PMBus
    • xyz.openbmc_project.Power.Error.DBus
  • Verify that created error logs have the expected data
    • Property/field values
    • Callouts with associated VPD (same VPD keywords stored for FSP errors)
    • User Data sections containing debug data stored in FFDC files
      • One section per file
    • Data from message registry
  • Verify that if a failure occurs, it is written to the system journal but does not result in a second error log (since that could lead to an infinite loop).
  • Verify that temporary FFDC files are removed
    • When no errors occurred
    • When errors occurred (exception throw)

Notes

Mapping D-Bus severities map to PEL severities

  • Notice, Informational, Debug
    • nonError
  • Warning
    • predictive
  • Critical
    • critical
  • Emergency, Alert, Error
    • unrecoverable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment