Clean up hwpoison functional tests

Code displacement:
- moved common code into helper.sh to avoid duplicates,
- merged run-huge-test.sh into run_hugepage.sh and
  run-transhuge-test.sh into run_thp.sh.

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 <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
7 files changed