linux/tools/testing/selftests/arm64/signal
Andre Przywara a2aa5dcc63 kselftest/arm64: signal: drop now redundant GNU_SOURCE definition
The definition of GNU_SOURCE was recently centralised in an upper layer
kselftest Makefile, so the definition in the arm64 signal tests Makefile
is no longer needed. To make things worse, since both definitions are
not strictly identical, the compiler warns about it:
<command-line>: warning: "_GNU_SOURCE" redefined
<command-line>: note: this is the location of the previous definition

Drop the definition in the arm64/signal Makefile.

Fixes: cc937dad85 ("selftests: centralize -D_GNU_SOURCE= to CFLAGS in lib.mk")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20240816153251.2833702-2-andre.przywara@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2024-10-17 18:51:49 +01:00
..
testcases Merge branch 'for-next/selftests' into for-next/core 2024-09-12 13:43:57 +01:00
.gitignore kselftest/arm64: Add test case for POR_EL0 signal frame records 2024-09-04 12:54:07 +01:00
Makefile kselftest/arm64: signal: drop now redundant GNU_SOURCE definition 2024-10-17 18:51:49 +01:00
README
signals.S kselftest: arm64: fake_sigreturn_bad_magic 2019-11-08 11:10:42 +00:00
sve_helpers.c kselftest/arm64: signal: fix/refactor SVE vector length enumeration 2024-08-23 11:34:55 +01:00
sve_helpers.h kselftest/arm64: signal: fix/refactor SVE vector length enumeration 2024-08-23 11:34:55 +01:00
test_signals_utils.c kselftest/arm64: Log signal code and address for unexpected signals 2023-06-21 12:07:18 +01:00
test_signals_utils.h kselftest/arm64: Use shared OPTIMZER_HIDE_VAR() definiton 2023-08-04 17:36:52 +01:00
test_signals.c kselftest/arm64: Initialise current at build time in signal tests 2023-01-20 14:30:45 +00:00
test_signals.h kselftest/arm64: Enumerate SME2 in the signal test utility code 2023-01-20 12:23:08 +00:00

KSelfTest arm64/signal/
=======================

Signals Tests
+++++++++++++

- Tests are built around a common main compilation unit: such shared main
  enforces a standard sequence of operations needed to perform a single
  signal-test (setup/trigger/run/result/cleanup)

- The above mentioned ops are configurable on a test-by-test basis: each test
  is described (and configured) using the descriptor signals.h::struct tdescr

- Each signal testcase is compiled into its own executable: a separate
  executable is used for each test since many tests complete successfully
  by receiving some kind of fatal signal from the Kernel, so it's safer
  to run each test unit in its own standalone process, so as to start each
  test from a clean slate.

- New tests can be simply defined in testcases/ dir providing a proper struct
  tdescr overriding all the defaults we wish to change (as of now providing a
  custom run method is mandatory though)

- Signals' test-cases hereafter defined belong currently to two
  principal families:

  - 'mangle_' tests: a real signal (SIGUSR1) is raised and used as a trigger
    and then the test case code modifies the signal frame from inside the
    signal handler itself.

  - 'fake_sigreturn_' tests: a brand new custom artificial sigframe structure
    is placed on the stack and a sigreturn syscall is called to simulate a
    real signal return. This kind of tests does not use a trigger usually and
    they are just fired using some simple included assembly trampoline code.

 - Most of these tests are successfully passing if the process gets killed by
   some fatal signal: usually SIGSEGV or SIGBUS. Since while writing this
   kind of tests it is extremely easy in fact to end-up injecting other
   unrelated SEGV bugs in the testcases, it becomes extremely tricky to
   be really sure that the tests are really addressing what they are meant
   to address and they are not instead falling apart due to unplanned bugs
   in the test code.
   In order to alleviate the misery of the life of such test-developer, a few
   helpers are provided:

   - a couple of ASSERT_BAD/GOOD_CONTEXT() macros to easily parse a ucontext_t
     and verify if it is indeed GOOD or BAD (depending on what we were
     expecting), using the same logic/perspective as in the arm64 Kernel signals
     routines.

   - a sanity mechanism to be used in 'fake_sigreturn_'-alike tests: enabled by
     default it takes care to verify that the test-execution had at least
     successfully progressed up to the stage of triggering the fake sigreturn
     call.

  In both cases test results are expected in terms of:
   - some fatal signal sent by the Kernel to the test process
  or
  - analyzing some final regs state