ATF-devel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Conditional tests based on ${MACHINE} and ${MACHINE_ARCH}



On Sat, Jan 1, 2011 at 8:28 PM, Paul Goyette <paul%whooppee.com@localhost> 
wrote:
> On Sat, 1 Jan 2011, Julio Merino wrote:
>
>> On Sat, Jan 1, 2011 at 3:50 PM, Paul Goyette <paul%whooppee.com@localhost> 
>> wrote:
>>>>
>>>> There's atf_arch and atf_machine (and these are the opposite of MACHINE
>>>> and MACHINE_ARCH for some gnuy reason).  Do the aieeefp tests compile
>>>> on vax or do you need some intra-tp ifdef games instead?
>>>
>>> Ah, ok.  So atf_arch contains ${MACHINE} and atf_machine contains
>>> ${MACHINE_ARCH} ?  Kewl.
>>
>> Yes, they are reversed for some stupid historical reason (autoconf
>> internal variables not matching common sense, iirc).  That ought to be
>> fixed eventually... let's see if I can do that soon (filed PR
>> bin/44305 to track this).
>>
>> You can define the "require.arch" and "require.machine" properties on
>> a test case basis; these contain a whitespace separated list of all
>> allowed architectures and machines for a particular test case.
>> atf-run will automatically skip these test cases if the host machine
>> does not match the requirements.  See atf-test-case(4) for details on
>> other require.* properties.
>
> Seems to me it would also be useful to have the inverse tests?
>
> require.not.{arch,machine} could skip the tests if any of the the listed
> entries match?
>
> Seems that it would be much more likely to have one or two "skip test"
> architectures than having a small list of "run test", so maintenance would
> be simpler.

It probably does make sense to have such a feature but, from memory,
most of the ${MACHINE*} tests I have seen in the Makefiles are with
==, not with != (hence why require.* works as it does).

For now, if you want to do this, you can do it programmatically.
Something along the lines of:

const char* machine = atf_tc_get_config_var("atf_machine");
if (strcmp(machine, "foo") == 0)
    atf_tc_skip("Can't run on foo machine");
... rest of the test case body ...

-- 
Julio Merino


Home | Main Index | Thread Index | Old Index