[RFC,PATCH 3/4] acpi: only run ACPI tests if we have ACPI

Colin Ian King colin.king at canonical.com
Thu Apr 24 13:08:03 UTC 2014


On 24/04/14 13:53, Jeremy Kerr wrote:
> Hi Colin,
> 
> Thanks for the quick feedback!
> 
>> ..my next thought was to add a .fw_feature flag in the ops field for
>> each test:
>>
>>     .fw_feature = FWTS_FW_FEATURE_ACPI;
> 
> Yep, I was thinking this might be a better way to do it. My only
> suggestion would be to make this a mask of required features, and we
> require all of the features to be present to run the tests. eg:
> 
>   .fw_features = FWTS_FW_FEATURE_ACPI | FWTS_FW_FEATURE_MAGIC_BEANS,
> 
> this would require a:
> 
>   bool fwts_firmware_has_all_features(int features)
>   {
>       int fw_features;
> 
>       /* populate fw_features based on the running firmware */
>     [...]
> 
>       return (fw_features & features) == features;
>   }
> 
> - which would do the right thing if .fw_features is zero.

yep, makes sense, I was thinking of the features being a bit mask.

> 
> I'll also do up a function to convert a feature enum / mask to a string,
> so we can log the missing features nicely.
> 
> However, is the ops struct the correct place to put this?

Well, the ops struct is easiest as we can leave out the .fw_features
flag if we are lazy and don't want to modify every test in fwts.

Perhaps a better idea though would be to add the bit mask
FWTS_REGISTER() macro and shove this into a field the
fwts_framework_test struct.  This requires:

1. modifying all the tests to add the new .fw_feature setting to the
FWTS_REGISTER macro
2. passing the fw_feature into fwts_framework_test_add() and setting
this in new_test

..so it's a lot more effort, but probably a better way forward.

Colin


> 
> Cheers,
> 
> 
> Jeremy




More information about the fwts-devel mailing list