|
From: Julian S. <js...@ac...> - 2019-10-08 14:31:25
|
On 08/10/2019 16:06, Assad Hashmi wrote:
> After establishing the host architecture, can the test infrastructure
> detect CPU capabilities when deciding to execute tests?
> For example arm64 v8.1 CPUs have the "atomics" capability, v8.2 has "fphp" etc.
> Or is that check something each test has to implement itself?
The framework can do that itself. But you'll need to update the framework.
You should just write the test .c file(s) without any capability checks.
There are actually two different questions here:
(1) can the target's assembler assemble the relevant instructions? In
other words, is the test even compilable? For an example, look at
"if BUILD_ARMV8_CRC_TESTS" in tests/none/arm64/Makefile.am. You will
need to add a new conditional, for .._ARMV8_1. See the top level
configure.ac for how BUILD_ARMV8_CRC_TESTS gets defined.
(2) can the target machine run the test (is the insn actually supported)?
Unfortunately there is no infrastructure in none/tests/arm64 that you
can copy, because so far we have only supported on arm64 variant.
The way this is done is by having a "prereq:" line in the test's
.vgtest file. For example, look at none/tests/amd64/xacq_xrel.vgtest.
This has:
prereq: test -x xacq_xrel && ../../../tests/x86_amd64_features amd64-avx
This checks first whether the test got built (per (1)). If so then it
runs tests/x86_amd64_features to ask whether the specified CPU feature
("amd64-avx") is supported on this machine.
You'll need to add an arm64 equivalent to the existing
{mips,s390,x86_amd64}_features.c, which the .vgtest file can use to ask
if the relevant 8.1 features are supported.
Sorry if this seems like a maze. Just fix it as best you can and it can be
checked over at review time.
J
|