• Gustavo Romero's avatar
    selftests/powerpc: Fix and enhance TM signal context tests · 9d535e20
    Gustavo Romero authored
    Currently TM signal context tests for GPR, FPR, VMX, and VSX registers
    print wrong register numbers (wrongly starting from register 0 instead
    of the first register in the non-volatile subset). Besides it the
    output when a mismatch happens is poor giving not much information
    about which context and which register mismatches, because it prints
    both contexts at the same time and not a comparison between the value
    that mismatches and the value expected and, moreover, it stops
    printing on the first mismatch, but it's important to know if there
    are other mismatches happening beyond the first one.
    
    For instance, this is the current output when a mismatch happens:
    
      test: tm_signal_context_chk_gpr
      tags: git_version:v5.2-8249-g02e970fae465-dirty
      Failed on 0 GPR 1 or 18446744073709551615
      failure: tm_signal_context_chk_gpr
    
      test: tm_signal_context_chk_fpu
      tags: git_version:v5.2-8248-g09c289e3ef80
      Failed on 0 FP -1 or -1
      failure: tm_signal_context_chk_fpu
    
      test: tm_signal_context_chk_vmx
      tags: git_version:v5.2-8248-g09c289e3ef80
      Failed on 0 vmx 0xfffffffffffffffefffffffdfffffffc vs 0xfffffffffffffffefffffffdfffffffc
      failure: tm_signal_context_chk_vmx
    
      test: tm_signal_context_chk_vsx
      tags: git_version:v5.2-8248-g09c289e3ef80
      Failed on 0 vsx 0xfffffffffefffffffdfffffffcffffff vs 0xfffffffffefffffffdfffffffcffffff
      failure: tm_signal_context_chk_vsx
    
    This commit fixes the register numbers printed and enhances the error
    output by providing a full list of mismatching registers separated by
    the context (non-speculative or speculative context), for example:
    
      test: tm_signal_context_chk_gpr
      tags: git_version:v5.2-8249-g02e970fae465-dirty
      GPR14 (1st context) == 1 instead of -1 (expected)
      GPR15 (1st context) == 2 instead of -2 (expected)
      GPR14 (2nd context) == 0 instead of 18446744073709551615 (expected)
      GPR15 (2nd context) == 0 instead of 18446744073709551614 (expected)
      failure: tm_signal_context_chk_gpr
    
      test: tm_signal_context_chk_fpu
      tags: git_version:v5.2-8249-g02e970fae465-dirty
      FPR14 (1st context) == -1 instead of 1 (expected)
      FPR15 (1st context) == -2 instead of 2 (expected)
      failure: tm_signal_context_chk_fpu
    
      test: tm_signal_context_chk_vmx
      tags: git_version:v5.2-8249-g02e970fae465-dirty
      VMX20 (1st context) == 0xfffffffffffffffefffffffdfffffffc instead of 0x00000001000000020000000300000004 (expected)
      VMX21 (1st context) == 0xfffffffbfffffffafffffff9fffffff8 instead of 0x00000005000000060000000700000008 (expected)
      failure: tm_signal_context_chk_vmx
    
      test: tm_signal_context_chk_vsx
      tags: git_version:v5.2-8249-g02e970fae465-dirty
      VSX20 (1st context) == 0xfffffffffefffffffdfffffffcffffff instead of 0x00000001000000020000000300000004 (expected)
      VSX21 (1st context) == 0xfbfffffffafffffff9fffffff8ffffff instead of 0x00000005000000060000000700000008 (expected)
      failure: tm_signal_context_chk_vsx
    
    Finally, this commit adds comments to the tests in the hope that it
    will help people not so familiar with TM understand the tests.
    Signed-off-by: default avatarGustavo Romero <gromero@linux.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20190814205211.24840-1-gromero@linux.ibm.com
    9d535e20
tm-signal-context-chk-vmx.c 3.94 KB