Skip to content

Commit 47809eb

Browse files
ij-intelshuahkh
authored andcommitted
selftests/resctrl: Reorder resctrl FS prep code and benchmark_cmd init
Benchmark command is initialized before resctrl FS check and preparation code that can call ksft_exit_skip(). There is no strong reason why the resctrl FS support check and unmounting it (if already mounted), has to be done after the benchmark command initialization. Move benchmark command initialization such that it is done not until right before the tests commence. This simplifies rollback handling when benchmark command initialization starts to use dynamic allocation (in a change following this). Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent b1a901e commit 47809eb

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tools/testing/selftests/resctrl/resctrl_tests.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ int main(int argc, char **argv)
252252
if (geteuid() != 0)
253253
return ksft_exit_skip("Not running as root. Skipping...\n");
254254

255+
if (!check_resctrlfs_support())
256+
return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n");
257+
258+
if (umount_resctrlfs())
259+
return ksft_exit_skip("resctrl FS unmount failed.\n");
260+
261+
filter_dmesg();
262+
255263
if (has_ben) {
256264
if (argc - ben_ind >= BENCHMARK_ARGS)
257265
ksft_exit_fail_msg("Too long benchmark command.\n");
@@ -277,14 +285,6 @@ int main(int argc, char **argv)
277285
benchmark_cmd[5] = NULL;
278286
}
279287

280-
if (!check_resctrlfs_support())
281-
return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n");
282-
283-
if (umount_resctrlfs())
284-
return ksft_exit_skip("resctrl FS unmount failed.\n");
285-
286-
filter_dmesg();
287-
288288
ksft_set_plan(tests ? : 4);
289289

290290
if (mbm_test)

0 commit comments

Comments
 (0)