kyua icon indicating copy to clipboard operation
kyua copied to clipboard

Feature Request: allowed_os

Open bapt opened this issue 10 years ago • 5 comments

Please add a allowed_os, so we can skip some tests on a given os

bapt avatar Sep 21 '15 20:09 bapt

How do you define the values that allowed_os would take? The plain OS name as returned by uname?

Is that sufficient without version numbers?

Also, how useful is that for Linux, where the distribution name might be more important depending on what you are trying to do?

Why do you need to make test cases specific to a OS?

jmmv avatar Oct 18 '15 01:10 jmmv

uname -r should be enough I do have tests in pkg that will only be run on Linux/FreeBSD but not on OSX (because related to elf binary analysis) and some only runnng on OSX and not on the others due to MACH-O analysis for example

bapt avatar Oct 18 '15 01:10 bapt

Hmm, but determining those details based on the OS name seems fragile. It's the same issue as configure scripts making decisions based on the OS name: they usually work, until they don't. These dependencies (elf, mach-o, etc.) should be checked for explicitly so that, if the OS ever changes underneath, the test will detect the change regardless of the OS name. Shouldn't they?

(I know some things are "clearly OS X"... but even then, trying to avoid checks based on the OS name, if possible, seems worthwhile.)

jmmv avatar Oct 18 '15 02:10 jmmv

So far I have been working around with aft-sh and it worked by simply not defining some test if uname -r replies Darwin. But it is not ideal:

https://github.com/freebsd/pkg/blob/master/tests/frontend/jpeg.sh#L9 https://github.com/freebsd/pkg/blob/master/tests/frontend/001sanity.sh#L4

bapt avatar Oct 18 '15 10:10 bapt

I still need to make up my mind regarding this feature request, but one comment on your code: you should use atf_skip when you are on Darwin to clearly mark the test as not applicable to the host instead of just silently exiting. Using atf_skip from within the test is not much different than relying on a metadata property to do the skip for you.

jmmv avatar Nov 21 '15 22:11 jmmv