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