Add a set of unit tests for the distro detection code. The tests use an
in-memory virtual filesystems resembling release files for various
distributions supported. All release files are provided (not only the
ones directly used) in order to guarantee that one of the rules will not
mistakenly recognize the distribution incorrectly due to the additional
files (e.g. Ubuntu as Debian).
Details
Diff Detail
Event Timeline
Very nice.
unittests/Driver/ToolChainsTest.cpp | ||
---|---|---|
15 | Yeah. It's better to hoist the enum + the decl for detectDistro into a public header under include/clang/Driver and include it from here. |
unittests/Driver/ToolChainsTest.cpp | ||
---|---|---|
15 | Ok. Then I'll probably refactor the whole thing into a nicer API anyway ;-). |
This is great!
unittests/Driver/ToolChainsTest.cpp | ||
---|---|---|
154 | Can you add the tests for /etc/SuSE-release here as well? |
unittests/Driver/ToolChainsTest.cpp | ||
---|---|---|
154 | Yes, that is a goal. I didn't add all distros yet because I wanted to see if I'm doing it right first ;-). |
Ok, here are the tests updated for the new API. I'll try to look into adding more distributions later today.
LGTM! Please add this before D26850, which should contain a testcase on top of this!
Thanks
I should probably also copy here that as I've mentioned on D26850, this already contains a test case erroring out due to the OpenSUSE parsing bug. I originally intended to commit the fix before the test case included here but I can move that around if you insist.
Yeah. It's better to hoist the enum + the decl for detectDistro into a public header under include/clang/Driver and include it from here.