Clean up hwpoison functional tests

Code displacement:
- moved common code into to avoid duplicates,
- merged into and into

Minor improvements:
- added sysctl vm.memory_failure_early_kill=0 in the setup of each
  testcase (some testcases change this global parameter, so it's safe
  to reset it to 0 to avoid interference between testcases),
- added freeing resources (shmems, semaphores) and unpoisoning
  in the cleanup of each testcase,
- added counter check ("HardwareCorrupted:" in /proc/meminfo)

Signed-off-by: Naoya Horiguchi <>
Signed-off-by: Chen Gong <>
7 files changed