[LTP] [PATCH V2 04/14] mem/ksm: convert to new API
Cyril Hrubis
chrubis@suse.cz
Fri Jul 7 17:29:45 CEST 2017
Hi!
> > - tst_parse_opts(argc, argv, ksm_options, ksm_usage);
> > - setup();
> > - for (lc = 0; TEST_LOOPING(lc); lc++) {
> > - tst_count = 0;
> > - check_ksm_options(&size, &num, &unit);
> > - create_same_memory(size, num, unit);
> > - }
> > - cleanup();
> > - tst_exit();
> > + check_ksm_options(&size, &num, &unit);
>
> There is no need to parse the test options on every test iteration, this
> should be called once in the test setup.
>
> Moreover passing things around in global variables is messy. What about
> we (ideally in a separate patch) created a function(s) to parse the KSM
> options and pass the string values explicitily.
Or since we are about to create ksm_common.h anyway, we can add static
inline functions to parse the test options there as well. And FYI we do
have option parsing helpers in the tst_test.h library that are much
better than plain old atoi().
> setup(void)
> {
> ...
> parse_ksm_options(str_size, &size, str_num, &num, str_unit, &unit);
> ...
> }
>
> Also could we define the ksm_options array in one place instead of
> repeating it in each test. What about putting it into ksh_common.h in
> the mem/ksm/ directory and including it in each test?
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list