diff options
author | Jacob Bramley <jacob.bramley@arm.com> | 2019-04-16 15:22:31 +0100 |
---|---|---|
committer | Jacob Bramley <jacob.bramley@arm.com> | 2019-04-17 11:42:05 +0100 |
commit | 2fb52cbe30d90fe0253db93b1d543b20df821872 (patch) | |
tree | fe242c639b5ba9e42721a3ba9f1951070c7e343d /test | |
parent | 7b712becdd49346efbeb94c7963ed48139cc6ad3 (diff) | |
download | vixl-2fb52cbe30d90fe0253db93b1d543b20df821872.tar.gz |
Only assume baseline features if InferFromOS fails.
This fixes 'CAN_RUN()' on platforms that lack kCRC32, as long as InferFromOS is
implemented.
Change-Id: Iedf9d86ba07ede88d3a45d466bce6059260bdf8d
Diffstat (limited to 'test')
-rw-r--r-- | test/aarch64/test-assembler-aarch64.h | 7 | ||||
-rw-r--r-- | test/test-api.cc | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/test/aarch64/test-assembler-aarch64.h b/test/aarch64/test-assembler-aarch64.h index 0bc81cb3..b45c7ae8 100644 --- a/test/aarch64/test-assembler-aarch64.h +++ b/test/aarch64/test-assembler-aarch64.h @@ -287,9 +287,10 @@ inline bool CanRun(const CPUFeatures& required, bool* queried_can_run) { #define TEARDOWN_CUSTOM() inline bool CanRun(const CPUFeatures& required, bool* queried_can_run) { - // InferFromOS can fail, but we can assume that basic features are present. - CPUFeatures cpu = - CPUFeatures::AArch64LegacyBaseline().With(CPUFeatures::InferFromOS()); + CPUFeatures cpu = CPUFeatures::InferFromOS(); + // If InferFromOS fails, assume that basic features are present. + if (cpu.HasNoFeatures()) cpu = CPUFeatures::AArch64LegacyBaseline(); + VIXL_ASSERT(cpu.Has(kInfrastructureCPUFeatures)); if (cpu.Has(required)) { diff --git a/test/test-api.cc b/test/test-api.cc index 2a5ccf04..53eaae38 100644 --- a/test/test-api.cc +++ b/test/test-api.cc @@ -523,12 +523,12 @@ TEST(CPUFeaturesScope) { TEST(CPUFeatures_infer_from_os) { // Test that CPUFeatures::InferFromOS functions on supported platforms. CPUFeatures os; - VIXL_ASSERT(os.Count() == 0); + VIXL_ASSERT(os.HasNoFeatures()); os = CPUFeatures::InferFromOS(); // Every real platform has FP and NEON. However, InferFromOS does not support // every platform, so we also have to tolerate empty results. - if (os.Count() == 0) { + if (os.HasNoFeatures()) { std::cout << "Warning: CPUFeatures::InferFromOS() returned no results.\n"; } else { std::cout << "CPUFeatures::InferFromOS():\n {" << os << "}\n"; |