[PATCH] D31236: Refactor getHostCPUName to allow testing on non-native hardware.
Kristof Beyls via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 02:50:01 PDT 2017
kristof.beyls created this revision.
Herald added a subscriber: aemerson.
This refactors getHostCPUName so that for the architectures that get the
host cpu info on linux from /proc/cpuinfo, the /proc/cpuinfo parsing
logic is present in the build, even if it wasn't built on a linux system
for that architecture.
Since the code is present in the build, we can then test that code also
on other systems, i.e. we don't need to have buildbots setup for all
architectures on linux to be able to test this. Instead, developers will
test this as part of the regression test run.
As an example, a gmock-using test is added to test getHostCPUName for a
Cortex-A9 processor running linux. I'm not aware of other locations in
LLVM we're using gmock to create a mocking-based test, but here it seems
the most natural way to test this functionality.
This is a preparation step to enable implementing the range of
improvements discussed on PR30516, such as adding AArch64 support,
support for big.LITTLE systems, reducing code duplication.
It will hopefully also help in implementing some of the cleanup ideas
expressed in https://reviews.llvm.org/D24661 - being able to test
refactoring changes locally without having access to all the different
architectures or cores.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 17248 bytes
Desc: not available
More information about the llvm-commits