Hi!
On 06/22/2015 03:42 PM, Cyril Hrubis wrote:
> Hi!
>>   /* only security.* & trusted.* are valid key names */
>> -static const struct tst_key tkeys[] = {
>> +static struct tst_key tkeys[] = {
>>      { .name = "trusted.test",       .good = 1,      },
>> +    { .name = "trusted.",           .good = 1,      },
>>      { .name = "security.",          .good = 1,      },
>>      { .name = "user.",              .good = 0,      },
>>      { .name = "system.",            .good = 0,      },
>> @@ -152,6 +153,14 @@ void setup(int argc, char *argv[])
>>                      "Test must be run with kernel 3.7 or newer");
>>      }
>>   
>> +    if (tst_kvercmp(3, 15, 0) >= 0) {
>> +            /* In kernel v3.15 cgroup was converted to kernfs
>> +             * that doesn't provide simple security namespace handlers.
>> +             * Setting just 'security.' should return EOPNOTSUPP.
>> +             */
>> +            tkeys[2].good = 0;
>> +    }
> I don't like indexing the testcases array with a hand computed values like
> this. One reason is that this is harder to figure out what exactly is
> changed and the second is that this way too fragile and will break if
> somebody changes the order of the array.
>
> Unfortunately I don't know ideal solution for this either. More explicit
> version may be to iterate over the array and doing strcmp() on the name.
> It's not particulary nice but it's the best I can come up with.

Agree, it's fragile. Thank you for suggestions, I think strcmp is better 
as it would be more understandable code.

Thanks,
Alexey


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to