[SEC-180] Add ability to run tests for specific OS based on tags#1929
[SEC-180] Add ability to run tests for specific OS based on tags#1929NathanJPhillips wants to merge 1 commit intodiffblue:developfrom
Conversation
|
@NathanJPhillips Thank you for factoring this out! Platform-specific tests are needed in places, but ideally as few of them as possible. There are two reasons I am showing limited appreciation of the proposed solution.
Recommended reading: http://www.sourceware.org/autobook/ - yes, a lot of my resistance towards platform-specific bits stems from having read that book, the remaining ones from being a Debian Developer. As such I want to make writing platform-specific code harder, not easier. You don't know what platform your users are on, and they are the ones you should care about. |
tautschnig
left a comment
There was a problem hiding this comment.
As outlined in the comment below, I'd prefer to leave inference of the build environment to the build tools. Hence I'm not going to approve this one; but also I might be very narrow-minded, and someone else might say that the proposed solution is the way to go. Thus I'd leave it to either someone else to approve or to @NathanJPhillips to come up with a solution that suits my taste.
| # not given (implying run all tests) or it matches at least one include-tag. | ||
|
|
||
| my $include_tags_length = @$include_tags; | ||
| # If any include tags are passed then only include tests including those tags |
There was a problem hiding this comment.
This part of the change is great.
| if(not exists($tags_set{"OS-" . $os}) and grep { "OS-" eq substr($_, 0, length("OS-")) } @tags) { | ||
| $passes_tag_tests = 0; | ||
| } | ||
|
|
There was a problem hiding this comment.
I'm not confident about this one. The surrounding environment has already solved this problem: CMake surely comes up with some identifier of the operating system (here, the crucial one will be WIN32), and we've got a solution for Make in src/common.
|
@tautschnig there's no build tool here to spot the environment, but how about instead: Where |
|
There's also the approach proposed in #1915: generate the *.desc files at test-execution time. |
This facilitates tests for OS specific features as well as allowing tests that use syntax specific to the OS such as passing OS-specific paths or using OS-specific class path delimiters (semicolon on Windows, colon on other systems)