[LTP] [PATCH V2 04/14] mem/ksm: convert to new API
Li Wang
liwang@redhat.com
Mon Jul 10 09:33:29 CEST 2017
On Fri, Jul 7, 2017 at 10:49 PM, Cyril Hrubis <chrubis@suse.cz> wrote:
> 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.
>
> 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?
No problem. Agree with all these comments.
Let me move the common code to ksm_common.h in a new PATCH.
--
Li Wang
liwang@redhat.com
More information about the ltp
mailing list