From 6c387fa3b42b74ec555a79caf2bc750b8c89bfa2 Mon Sep 17 00:00:00 2001 From: Michael Platings Date: Mon, 22 Jan 2024 16:21:53 +0000 Subject: [PATCH] Run tests on NEON, SVE & SME --- .gitlab-ci.yml | 2 +- intrinsiccv/include/dispatch.h | 4 +++- scripts/ci.sh | 21 +++++++++++++++---- scripts/prefix_testsuite_names.py | 35 +++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 6 deletions(-) create mode 100755 scripts/prefix_testsuite_names.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3490fd90..d33718f37 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ build: artifacts: when: always reports: - junit: build/test-results/*.xml + junit: build/test-results/**/*.xml coverage_report: coverage_format: cobertura path: build/cobertura-coverage.xml diff --git a/intrinsiccv/include/dispatch.h b/intrinsiccv/include/dispatch.h index d73ca7a50..0c035eb0f 100644 --- a/intrinsiccv/include/dispatch.h +++ b/intrinsiccv/include/dispatch.h @@ -30,7 +30,9 @@ static inline bool hwcaps_has_sve2(HwCaps hwcaps) { } static inline bool hwcaps_has_sme2(HwCaps hwcaps) { - return hwcaps.hwcap2 & (1UL << 37); + // Actually checks for SME, not SME2, but this will be changed to check for + // SME2 in future. + return hwcaps.hwcap2 & (1UL << 23); } struct IFuncImpls final { diff --git a/scripts/ci.sh b/scripts/ci.sh index bd2bb544d..57bc176a3 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -12,22 +12,35 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.." # Ensure we're doing a clean build rm -rf build +apt-get -y --no-install-recommends install qemu-user + # Check format of C++ files CHECK_ONLY=ON VERBOSE=ON scripts/format.sh # Check license headers reuse lint -# Build and run tests +# Build cmake -S . -B build -G Ninja \ -DCMAKE_CXX_CLANG_TIDY=clang-tidy \ - -DCMAKE_CXX_FLAGS="--coverage -g -O0" + -DCMAKE_CXX_FLAGS="--coverage -g -O0" \ + -DINTRINSICCV_ENABLE_SVE2=ON \ + -DINTRINSICCV_ENABLE_SVE2_SELECTIVELY=OFF # Workaround to avoid applying clang-tidy to files in build directory echo '{"Checks": "-*,cppcoreguidelines-avoid-goto"}'>build/.clang-tidy -GTEST_OUTPUT=xml:$(pwd)/build/test-results/ \ - ninja -C build check-intrinsiccv +ninja -C build + +# Run tests +qemu-aarch64 build/test/framework/intrinsiccv-framework-test --gtest_output=xml:build/test-results/ +qemu-aarch64 -cpu cortex-a35 build/test/api/intrinsiccv-api-test --gtest_output=xml:build/test-results/neon/ +qemu-aarch64 -cpu cortex-a76 build/test/api/intrinsiccv-api-test --gtest_output=xml:build/test-results/sve2/ +qemu-aarch64 -cpu max build/test/api/intrinsiccv-api-test --gtest_output=xml:build/test-results/sme/ + +scripts/prefix_testsuite_names.py build/test-results/neon/intrinsiccv-api-test.xml "NEON." +scripts/prefix_testsuite_names.py build/test-results/sve2/intrinsiccv-api-test.xml "SVE2." +scripts/prefix_testsuite_names.py build/test-results/sme/intrinsiccv-api-test.xml "SME." # Generate test coverage report gcovr \ diff --git a/scripts/prefix_testsuite_names.py b/scripts/prefix_testsuite_names.py new file mode 100755 index 000000000..c4b67ea53 --- /dev/null +++ b/scripts/prefix_testsuite_names.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# +# SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates +# +# SPDX-License-Identifier: Apache-2.0 + +""" +This is a script to help improve how tests are displayed in CI. +The same tests are run repeatedly with different features enabled. +To differentiate these test runs, this script prefixes the test names with the +given prefix. + +Example: + prefix_testsuite_names.py path/to/test.xml MyPrefix. +""" + +import argparse +import xml.etree.ElementTree as ET + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("testsuite") + parser.add_argument("prefix") + args = parser.parse_args() + tree = ET.parse(args.testsuite) + for ts in tree.getroot().findall("testsuite"): + for tc in ts.findall("testcase"): + name = tc.get("classname") + name = args.prefix + name + tc.set("classname", name) + tree.write(args.testsuite) + + +if __name__ == "__main__": + main() -- GitLab