diff mbox series

[v3,17/21] selftests/resctrl: Unmount resctrl FS after running all tests

Message ID 20201020235126.1871815-18-fenghua.yu@intel.com
State New
Headers show
Series Miscellaneous fixes for resctrl selftests | expand

Commit Message

Fenghua Yu Oct. 20, 2020, 11:51 p.m. UTC
Resctrl test suite is expected to unmount the resctrl file system upon
exit. But there are few scenarios where resctrl test suite might forget to
unmount resctrl FS upon exit. For example, running only mba test on a
Broadwell (BDW) machine (MBA isn't supported on BDW CPU).

This happens because validate_resctrl_feature_request() would mount resctrl
FS to check if mba is enabled on the platform or not and finds that the H/W
doesn't support mba and hence will return false to run_mba_test(). This in
turn makes the main() function return without unmounting resctrl FS.

Fix this by calling umount_resctrlfs() before returning from main()
function, so that the resctrl FS will always be unmounted upon exit.

Fixes: ecdbb911f22d ("selftests/resctrl: Add MBM test")
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
 tools/testing/selftests/resctrl/resctrl_tests.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index a22dc96c0b43..fb66da65b373 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -257,6 +257,7 @@  int main(int argc, char **argv)
 		run_cat_test(cpu_no, no_of_bits);
 
 out:
+	umount_resctrlfs();
 	printf("1..%d\n", tests_run);
 
 	return 0;