aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/resctrl/resctrl_tests.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-07-17 16:14:53 +0300
committerShuah Khan <skhan@linuxfoundation.org>2023-07-25 08:52:33 -0600
commitede13008489b36f2adcdf01e3f6435c7b24610c1 (patch)
tree65bc42880bfa2efc46aa99ff51bd9f58015f890d /tools/testing/selftests/resctrl/resctrl_tests.c
parentselftests/resctrl: Close perf value read fd on errors (diff)
downloadwireguard-linux-ede13008489b36f2adcdf01e3f6435c7b24610c1.tar.xz
wireguard-linux-ede13008489b36f2adcdf01e3f6435c7b24610c1.zip
selftests/resctrl: Unmount resctrl FS before starting the first test
Resctrl FS mount/remount/umount code is hard to track. Better approach is to use mount/umount pair for each test but that assumes resctrl FS is not mounted beforehand. Change umount_resctrlfs() so that it can unmount resctrl FS from any path, and enable further simplifications into mount/remount/umount logic by unmounting resctrl FS at the start if a pre-existing mountpoint is found. Suggested-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Tested-by: Babu Moger <babu.moger@amd.com> Tested-by: Shaopeng Tan (Fujitsu) <tan.shaopeng@fujitsu.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/resctrl_tests.c')
-rw-r--r--tools/testing/selftests/resctrl/resctrl_tests.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index 9b9751206e1c..61c3882a26c8 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -250,6 +250,9 @@ int main(int argc, char **argv)
if (!check_resctrlfs_support())
return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n");
+ if (umount_resctrlfs())
+ return ksft_exit_skip("resctrl FS unmount failed.\n");
+
filter_dmesg();
ksft_set_plan(tests ? : 4);