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