xref: /aosp_15_r20/external/vixl/tools/known_test_failures.py (revision f5c631da2f1efdd72b5fd1e20510e4042af13d77)
1*f5c631daSSadaf Ebrahimi# Copyright 2016, VIXL authors
2*f5c631daSSadaf Ebrahimi# All rights reserved.
3*f5c631daSSadaf Ebrahimi#
4*f5c631daSSadaf Ebrahimi# Redistribution and use in source and binary forms, with or without
5*f5c631daSSadaf Ebrahimi# modification, are permitted provided that the following conditions are met:
6*f5c631daSSadaf Ebrahimi#
7*f5c631daSSadaf Ebrahimi#   * Redistributions of source code must retain the above copyright notice,
8*f5c631daSSadaf Ebrahimi#     this list of conditions and the following disclaimer.
9*f5c631daSSadaf Ebrahimi#   * Redistributions in binary form must reproduce the above copyright notice,
10*f5c631daSSadaf Ebrahimi#     this list of conditions and the following disclaimer in the documentation
11*f5c631daSSadaf Ebrahimi#     and/or other materials provided with the distribution.
12*f5c631daSSadaf Ebrahimi#   * Neither the name of ARM Limited nor the names of its contributors may be
13*f5c631daSSadaf Ebrahimi#     used to endorse or promote products derived from this software without
14*f5c631daSSadaf Ebrahimi#     specific prior written permission.
15*f5c631daSSadaf Ebrahimi#
16*f5c631daSSadaf Ebrahimi# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
17*f5c631daSSadaf Ebrahimi# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18*f5c631daSSadaf Ebrahimi# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19*f5c631daSSadaf Ebrahimi# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20*f5c631daSSadaf Ebrahimi# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*f5c631daSSadaf Ebrahimi# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22*f5c631daSSadaf Ebrahimi# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23*f5c631daSSadaf Ebrahimi# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24*f5c631daSSadaf Ebrahimi# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25*f5c631daSSadaf Ebrahimi# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*f5c631daSSadaf Ebrahimi
27*f5c631daSSadaf Ebrahimiimport re
28*f5c631daSSadaf Ebrahimi
29*f5c631daSSadaf Ebrahimiimport util
30*f5c631daSSadaf Ebrahimi
31*f5c631daSSadaf Ebrahimidef FilterKnownValgrindTestFailures(tests):
32*f5c631daSSadaf Ebrahimi  rc, output = util.getstatusoutput('valgrind --version')
33*f5c631daSSadaf Ebrahimi
34*f5c631daSSadaf Ebrahimi  if rc != 0:
35*f5c631daSSadaf Ebrahimi    util.abort('Failed to get the Valgrind version.')
36*f5c631daSSadaf Ebrahimi
37*f5c631daSSadaf Ebrahimi  version = re.search('^valgrind-([0-9]+)\.([0-9]+)\.([0-9]+)', output)
38*f5c631daSSadaf Ebrahimi
39*f5c631daSSadaf Ebrahimi  if not version:
40*f5c631daSSadaf Ebrahimi    util.abort('Failed to get the Valgrind version.')
41*f5c631daSSadaf Ebrahimi
42*f5c631daSSadaf Ebrahimi  major = int(version.group(1))
43*f5c631daSSadaf Ebrahimi  minor = int(version.group(2))
44*f5c631daSSadaf Ebrahimi
45*f5c631daSSadaf Ebrahimi  if major > 3 or (major == 3 and minor > 10):
46*f5c631daSSadaf Ebrahimi    return tests
47*f5c631daSSadaf Ebrahimi
48*f5c631daSSadaf Ebrahimi  reason = "Valgrind versions before 3.11 have issues with fused multiply-add, " \
49*f5c631daSSadaf Ebrahimi           "so disable the affected tests."
50*f5c631daSSadaf Ebrahimi  known_valgrind_test_failures = {
51*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmadd_d',
52*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmadd_s',
53*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmla_2D',
54*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmla_2D_2D_D',
55*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmla_2S',
56*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmla_2S_2S_S',
57*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmla_4S',
58*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmla_4S_4S_S',
59*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmla_D_D_D',
60*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmls_2D',
61*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmls_2D_2D_D',
62*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmls_2S',
63*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmls_2S_2S_S',
64*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmls_4S',
65*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmls_4S_4S_S',
66*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmls_D_D_D',
67*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmsub_d',
68*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fmsub_s',
69*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fnmadd_d',
70*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fnmadd_s',
71*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fnmsub_d',
72*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_fnmsub_s',
73*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_frecps_2D',
74*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_frecps_D',
75*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_frsqrts_2D',
76*f5c631daSSadaf Ebrahimi    'AARCH64_SIM_frsqrts_D'
77*f5c631daSSadaf Ebrahimi  }
78*f5c631daSSadaf Ebrahimi
79*f5c631daSSadaf Ebrahimi  filtered_list = filter(lambda x: x not in known_valgrind_test_failures, tests)
80*f5c631daSSadaf Ebrahimi  return (filtered_list, len(tests) - len(filtered_list), reason)
81*f5c631daSSadaf Ebrahimi
82*f5c631daSSadaf Ebrahimidef FilterKnownTestFailures(tests, **env):
83*f5c631daSSadaf Ebrahimi  skipped = []
84*f5c631daSSadaf Ebrahimi  if env.get('under_valgrind'):
85*f5c631daSSadaf Ebrahimi    tests, n_tests_skipped, reason = FilterKnownValgrindTestFailures(tests)
86*f5c631daSSadaf Ebrahimi    skipped.append( (n_tests_skipped, reason) )
87*f5c631daSSadaf Ebrahimi
88*f5c631daSSadaf Ebrahimi  return (tests, skipped)
89