• Kees Cook's avatar
    overflow: Refactor test skips for Clang-specific issues · 72c3ebea
    Kees Cook authored
    Convert test exclusion into test skipping. This brings the logic for
    why a test is being skipped into the test itself, instead of having to
    spread ifdefs around the code. This will make cleanup easier as minimum
    tests get raised. Drop __maybe_unused so missed tests will be noticed
    again and clean up whitespace.
    
    For example, clang-11 on i386:
    
    [15:52:32] ================== overflow (18 subtests) ==================
    [15:52:32] [PASSED] u8_u8__u8_overflow_test
    [15:52:32] [PASSED] s8_s8__s8_overflow_test
    [15:52:32] [PASSED] u16_u16__u16_overflow_test
    [15:52:32] [PASSED] s16_s16__s16_overflow_test
    [15:52:32] [PASSED] u32_u32__u32_overflow_test
    [15:52:32] [PASSED] s32_s32__s32_overflow_test
    [15:52:32] [SKIPPED] u64_u64__u64_overflow_test
    [15:52:32] [SKIPPED] s64_s64__s64_overflow_test
    [15:52:32] [SKIPPED] u32_u32__int_overflow_test
    [15:52:32] [PASSED] u32_u32__u8_overflow_test
    [15:52:32] [PASSED] u8_u8__int_overflow_test
    [15:52:32] [PASSED] int_int__u8_overflow_test
    [15:52:32] [PASSED] shift_sane_test
    [15:52:32] [PASSED] shift_overflow_test
    [15:52:32] [PASSED] shift_truncate_test
    [15:52:32] [PASSED] shift_nonsense_test
    [15:52:32] [PASSED] overflow_allocation_test
    [15:52:32] [PASSED] overflow_size_helpers_test
    [15:52:32] ==================== [PASSED] overflow =====================
    [15:52:32] ============================================================
    [15:52:32] Testing complete. Ran 18 tests: passed: 15, skipped: 3
    
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: Tom Rix <trix@redhat.com>
    Cc: Daniel Latypov <dlatypov@google.com>
    Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
    Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
    Cc: llvm@lists.linux.dev
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
    Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
    Link: https://lore.kernel.org/r/20221006230017.1833458-1-keescook@chromium.org
    72c3ebea
overflow_kunit.c 28.1 KB