1. 26 Jul, 2023 3 commits
    • Rae Moar's avatar
      kunit: Add module attribute · a00a7270
      Rae Moar authored
      Add module attribute to the test attribute API. This attribute stores the
      module name associated with the test using KBUILD_MODNAME.
      
      The name of a test suite and the module name often do not match. A
      reference to the module name associated with the suite could be extremely
      helpful in running tests as modules without needing to check the codebase.
      
      This attribute will be printed for each suite.
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Signed-off-by: default avatarRae Moar <rmoar@google.com>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      a00a7270
    • Rae Moar's avatar
      kunit: Add speed attribute · 02c2d0c2
      Rae Moar authored
      Add speed attribute to the test attribute API. This attribute will allow
      users to mark tests with a category of speed.
      
      Currently the categories of speed proposed are: normal, slow, and very_slow
      (outlined in enum kunit_speed). These are outlined in the enum kunit_speed.
      
      The assumed default speed for tests is "normal". This indicates that the
      test takes a relatively trivial amount of time (less than 1 second),
      regardless of the machine it is running on. Any test slower than this could
      be marked as "slow" or "very_slow".
      
      Add the macro KUNIT_CASE_SLOW to set a test as slow, as this is likely a
      common use of the attributes API.
      
      Add an example of marking a slow test to kunit-example-test.c.
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Signed-off-by: default avatarRae Moar <rmoar@google.com>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      02c2d0c2
    • Rae Moar's avatar
      kunit: Add test attributes API structure · 39e92cb1
      Rae Moar authored
      Add the basic structure of the test attribute API to KUnit, which can be
      used to save and access test associated data.
      
      Add attributes.c and attributes.h to hold associated structs and functions
      for the API.
      
      Create a struct that holds a variety of associated helper functions for
      each test attribute. These helper functions will be used to get the
      attribute value, convert the value to a string, and filter based on the
      value. This struct is flexible by design to allow for attributes of
      numerous types and contexts.
      
      Add a method to print test attributes in the format of "# [<test_name if
      not suite>.]<attribute_name>: <attribute_value>".
      
      Example for a suite: "# speed: slow"
      
      Example for a test case: "# test_case.speed: very_slow"
      
      Use this method to report attributes in the KTAP output (KTAP spec:
      https://docs.kernel.org/dev-tools/ktap.html) and _list_tests output when
      kernel's new kunit.action=list_attr option is used. Note this is derivative
      of the kunit.action=list option.
      
      In test.h, add fields and associated helper functions to test cases and
      suites to hold user-inputted test attributes.
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Signed-off-by: default avatarRae Moar <rmoar@google.com>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      39e92cb1
  2. 19 Jul, 2023 5 commits
  3. 18 Jul, 2023 3 commits
  4. 09 Jul, 2023 10 commits
  5. 08 Jul, 2023 19 commits