• Sander Vanheule's avatar
    kunit: fix assert_type for comparison macros · aded3cad
    Sander Vanheule authored
    When replacing KUNIT_BINARY_*_MSG_ASSERTION() macros with
    KUNIT_BINARY_INT_ASSERTION(), the assert_type parameter was not always
    correctly transferred.  Specifically, the following errors were
    introduced:
      - KUNIT_EXPECT_LE_MSG() uses KUNIT_ASSERTION
      - KUNIT_ASSERT_LT_MSG() uses KUNIT_EXPECTATION
      - KUNIT_ASSERT_GT_MSG() uses KUNIT_EXPECTATION
    
    A failing KUNIT_EXPECT_LE_MSG() test thus prevents further tests from
    running, while failing KUNIT_ASSERT_{LT,GT}_MSG() tests do not prevent
    further tests from running.  This is contrary to the documentation,
    which states that failing KUNIT_EXPECT_* macros allow further tests to
    run, while failing KUNIT_ASSERT_* macros should prevent this.
    
    Revert the KUNIT_{ASSERTION,EXPECTATION} switches to fix the behaviour
    for the affected macros.
    
    Fixes: 40f39777 ("kunit: decrease macro layering for integer asserts")
    Signed-off-by: default avatarSander Vanheule <sander@svanheule.net>
    Reviewed-by: default avatarDaniel Latypov <dlatypov@google.com>
    Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    aded3cad
test.h 46 KB