kselftest/cgroup: Add cleanup() to test_cpuset_prs.sh
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 18 Nov 2022 10:13:30 +0000 (15:43 +0530)
committerTejun Heo <tj@kernel.org>
Tue, 22 Nov 2022 20:25:37 +0000 (10:25 -1000)
commit1e85591db11b7ac097a1b34887c682e6353798c4
tree9a944273d0847c0eccac7305f01e077aa430abf7
parent7fd4da9c1584be97ffbc40e600a19cb469fd4e78
kselftest/cgroup: Add cleanup() to test_cpuset_prs.sh

Install a cleanup function using the trap command for signals EXIT,
SIGINT, SIGQUIT and SIGABRT.  The cleanup function will perform:
1. Online the CPUs that were made offline during the test.
2. Removing the cgroups created.
3. Restoring the original /sys/kernel/debug/sched/verbose value,
   currently it's left turned on, irrespective of the original
   configuration value.

the test performs steps 1 and 2, on the successful runs, but not during
all of the failed runs.  With the cleanup(), the system will perform all
three steps during failed/passed test runs.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Acked-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
tools/testing/selftests/cgroup/test_cpuset_prs.sh