From nobody Sun May 19 10:01:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639738113842947.2114054261191; Fri, 17 Dec 2021 02:48:33 -0800 (PST) Received: from localhost ([::1]:33536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myAmu-000140-3L for importer@patchew.org; Fri, 17 Dec 2021 05:48:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myAlq-0000L5-QX for qemu-devel@nongnu.org; Fri, 17 Dec 2021 05:47:26 -0500 Received: from [2a00:1450:4864:20::434] (port=40804 helo=mail-wr1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1myAln-0001YQ-V3 for qemu-devel@nongnu.org; Fri, 17 Dec 2021 05:47:26 -0500 Received: by mail-wr1-x434.google.com with SMTP id q16so3200772wrg.7 for ; Fri, 17 Dec 2021 02:47:23 -0800 (PST) Received: from localhost.localdomain ([2001:b07:add:ec09:c399:bc87:7b6c:fb2a]) by smtp.gmail.com with ESMTPSA id h27sm11236519wmc.43.2021.12.17.02.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 02:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=43Fq0wB48BMxETc/1DXpqm+URBs8YT8p0wwcGs0SC6M=; b=nQvSam+z8AvEX6EdKEB57qyqLEIXjTqAdJ52zBQn0ne2Wr6TfBPOkC9UWN/4BvOVnc lmr3ZqkmcwHHzorjbDS/3GhoTezYuber/t8F1ohM+MVZ3sso9mvTA8pE6WVTVt80YSxZ uOKVxetPkmdAY4jsNpUTi1SWxYohFiayuVukaiXtC40+28Tsj97jCvlIBNwU1Voe0nQl SrJQQesXPD3UA6t4wXX24hbMRb/3MaJisdkPTCgcsUh/usjx1dWopSOqAcsKGP2Z2ycW XSy0+SuibFiEdvLAFTxnnLbhsQTPG4tkMeJC8+Gk+Yi1yaASI715DurN7GLZ2yapuD+c W6Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=43Fq0wB48BMxETc/1DXpqm+URBs8YT8p0wwcGs0SC6M=; b=T1pexPXW3O9lXT1v+EO9GzXPTrUPgDH5MoJUDMtGvnmV/rAcoNLrYQpgREHROccQXj H+8AlsqHGS0FwK+LF2OFohwz22adVSADxpz9FnJQrwXxl9Z/Z0dBCnkrVURMZ+xL1gb4 iKZV+W3yLHOr+1XQ9HegBwIuevqcjQhsvAC4dCnxVNhRdytmAtFkURhbcbbL2733i7/6 rNKDIsZ/tGotQW9+SXsc3wSL6OeCPAAz2GVPpcEBVVmdHYVLbUMOHfGJEeNL1M6FJLU9 mLoh/g1SIZThruOh0XSYQjRmu7kU6TT7nb/TdnhbEcmIbK0YEZlJAKkBuGnI0Uk59Tpd OoOw== X-Gm-Message-State: AOAM532zzpWM8ryMG7GK11Oj26MikMj39HjT5BsRwvr4cKGHrJXUX+s8 oSFBP/A8URM32uaT1mMZsiU9Lf5OGjc= X-Google-Smtp-Source: ABdhPJyt7NG1GcyJHKvlWZ0UPPL0RhJOl2aJG5laYoUgAL8K2iG2/ZUHajX6r76CrpnnONnvBLWjRA== X-Received: by 2002:adf:dc0a:: with SMTP id t10mr2066690wri.8.1639738042099; Fri, 17 Dec 2021 02:47:22 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2] build: use "meson test" as the test harness Date: Fri, 17 Dec 2021 11:47:00 +0100 Message-Id: <20211217104700.179557-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::434 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639738114899100001 Content-Type: text/plain; charset="utf-8" "meson test" starting with version 0.57 is just as capable and easy to use as QEMU's own TAP driver. All existing options for "make check" work. The only required code change involves how to mark "slow" tests; they need to belong additionally to the "slow" suite. The rules for .tap output are replaced by JUnit XML; GitLab is able to parse that output and present it in the CI pipeline report. Supersedes: <20211028142826.57327-1-pbonzini@redhat.com> Cc: Thomas Huth Signed-off-by: Paolo Bonzini --- v1->v2: fix handling of slow tests in "make check-SUITE" [Thomas] Makefile | 3 +- meson.build | 5 +- scripts/mtest2make.py | 112 +++++-------- scripts/tap-driver.pl | 379 ------------------------------------------ scripts/tap-merge.pl | 111 ------------- tests/fp/meson.build | 2 +- 6 files changed, 51 insertions(+), 561 deletions(-) delete mode 100755 scripts/tap-driver.pl delete mode 100755 scripts/tap-merge.pl diff --git a/Makefile b/Makefile index 06ad8a61e1..8037f73b35 100644 --- a/Makefile +++ b/Makefile @@ -145,7 +145,8 @@ NINJAFLAGS =3D $(if $V,-v) $(if $(MAKE.n), -n) $(if $(M= AKE.k), -k0) \ $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \ =20 ninja-cmd-goals =3D $(or $(MAKECMDGOALS), all) -ninja-cmd-goals +=3D $(foreach t, $(.tests), $(.test.deps.$t)) +ninja-cmd-goals +=3D $(foreach t, $(.check.build-suites), $(.check-$t.deps= )) +ninja-cmd-goals +=3D $(foreach t, $(.bench.build-suites), $(.bench-$t.deps= )) =20 makefile-targets :=3D build.ninja ctags TAGS cscope dist clean uninstall # "ninja -t targets" also lists all prerequisites. If build system diff --git a/meson.build b/meson.build index 2495360fd0..dbd39c9cc6 100644 --- a/meson.build +++ b/meson.build @@ -1,8 +1,11 @@ project('qemu', ['c'], meson_version: '>=3D0.58.2', default_options: ['warning_level=3D1', 'c_std=3Dgnu11', 'cpp_std= =3Dgnu++11', 'b_colorout=3Dauto', - 'b_staticpic=3Dfalse'], + 'b_staticpic=3Dfalse', 'stdsplit=3Dfalse'], version: files('VERSION')) =20 +add_test_setup('quick', exclude_suites: 'slow', is_default: true) +add_test_setup('slow', env: ['G_TEST_SLOW=3D1', 'SPEED=3Dslow']) + not_found =3D dependency('', required: false) keyval =3D import('keyval') ss =3D import('sourceset') diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py index 02c0453e67..7067bdadf5 100644 --- a/scripts/mtest2make.py +++ b/scripts/mtest2make.py @@ -13,101 +13,79 @@ =20 class Suite(object): def __init__(self): - self.tests =3D list() - self.slow_tests =3D list() - self.executables =3D set() + self.deps =3D set() + self.speeds =3D ['quick'] + + def names(self, base): + return [base if speed =3D=3D 'quick' else f'{base}-{speed}' for sp= eed in self.speeds] + =20 print(''' SPEED =3D quick =20 -# $1 =3D environment, $2 =3D test command, $3 =3D test name, $4 =3D dir -.test-human-tap =3D $1 $(if $4,(cd $4 && $2),$2) -m $(SPEED) < /dev/null |= ./scripts/tap-driver.pl --test-name=3D"$3" $(if $(V),,--show-failures-only) -.test-human-exitcode =3D $1 $(PYTHON) scripts/test-driver.py $(if $4,-C$4)= $(if $(V),--verbose) -- $2 < /dev/null -.test-tap-tap =3D $1 $(if $4,(cd $4 && $2),$2) < /dev/null | sed "s/^[a-z]= [a-z]* [0-9]*/& $3/" || true -.test-tap-exitcode =3D printf "%s\\n" 1..1 "`$1 $(if $4,(cd $4 && $2),$2) = < /dev/null > /dev/null || echo "not "`ok 1 $3" -.test.human-print =3D echo $(if $(V),'$1 $2','Running test $3') && -.test.env =3D MALLOC_PERTURB_=3D$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 2= 55 + 1))} +.speed.quick =3D $(foreach s,$(sort $(filter-out %-slow, $1)), --suite $s) +.speed.slow =3D $(foreach s,$(sort $1), --suite $s) =20 -# $1 =3D test name, $2 =3D test target (human or tap) -.test.run =3D $(call .test.$2-print,$(.test.env.$1),$(.test.cmd.$1),$(.tes= t.name.$1)) $(call .test-$2-$(.test.driver.$1),$(.test.env.$1),$(.test.cmd.= $1),$(.test.name.$1),$(.test.dir.$1)) +.mtestargs =3D --no-rebuild -t 0 +ifneq ($(SPEED), quick) +.mtestargs +=3D --setup $(SPEED) +endif +.mtestargs +=3D $(subst -j,--num-processes , $(filter-out -j, $(lastword -= j1 $(filter -j%, $(MAKEFLAGS))))) =20 -.test.output-format =3D human -''') +.check.mtestargs =3D $(MTESTARGS) $(.mtestargs) $(if $(V),--verbose,--prin= t-errorlogs) +.bench.mtestargs =3D $(MTESTARGS) $(.mtestargs) --benchmark --verbose''') =20 introspect =3D json.load(sys.stdin) -i =3D 0 =20 def process_tests(test, targets, suites): - global i - env =3D ' '.join(('%s=3D%s' % (shlex.quote(k), shlex.quote(v)) - for k, v in test['env'].items())) executable =3D test['cmd'][0] try: executable =3D os.path.relpath(executable) except: pass - if test['workdir'] is not None: - try: - test['cmd'][0] =3D os.path.relpath(executable, test['workdir']) - except: - test['cmd'][0] =3D executable - else: - test['cmd'][0] =3D executable - cmd =3D ' '.join((shlex.quote(x) for x in test['cmd'])) - driver =3D test['protocol'] if 'protocol' in test else 'exitcode' - - i +=3D 1 - if test['workdir'] is not None: - print('.test.dir.%d :=3D %s' % (i, shlex.quote(test['workdir']))) =20 deps =3D (targets.get(x, []) for x in test['depends']) deps =3D itertools.chain.from_iterable(deps) - - print('.test.name.%d :=3D %s' % (i, test['name'])) - print('.test.driver.%d :=3D %s' % (i, driver)) - print('.test.env.%d :=3D $(.test.env) %s' % (i, env)) - print('.test.cmd.%d :=3D %s' % (i, cmd)) - print('.test.deps.%d :=3D %s' % (i, ' '.join(deps))) - print('.PHONY: run-test-%d' % (i,)) - print('run-test-%d: $(.test.deps.%d)' % (i,i)) - print('\t@$(call .test.run,%d,$(.test.output-format))' % (i,)) + deps =3D list(deps) =20 test_suites =3D test['suite'] or ['default'] - is_slow =3D any(s.endswith('-slow') for s in test_suites) for s in test_suites: # The suite name in the introspection info is "PROJECT:SUITE" s =3D s.split(':')[1] + if s =3D=3D 'slow': + continue if s.endswith('-slow'): s =3D s[:-5] - if is_slow: - suites[s].slow_tests.append(i) - else: - suites[s].tests.append(i) - suites[s].executables.add(executable) + suites[s].speeds.append('slow') + suites[s].deps.update(deps) =20 def emit_prolog(suites, prefix): - all_tap =3D ' '.join(('%s-report-%s.tap' % (prefix, k) for k in suites= .keys())) - print('.PHONY: %s %s-report.tap %s' % (prefix, prefix, all_tap)) - print('%s: run-tests' % (prefix,)) - print('%s-report.tap %s: %s-report%%.tap: all' % (prefix, all_tap, pre= fix)) - print('''\t$(MAKE) .test.output-format=3Dtap --quiet -Otarget V=3D1 %s= $* | ./scripts/tap-merge.pl | tee "$@" \\ - | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only)'= '' % (prefix, )) + all_targets =3D ' '.join((f'{prefix}-{k}' for k in suites.keys())) + all_xml =3D ' '.join((f'{prefix}-report-{k}.junit.xml' for k in suites= .keys())) + print() + print(f'all-{prefix}-targets =3D {all_targets}') + print(f'all-{prefix}-xml =3D {all_xml}') + print(f'.PHONY: {prefix} do-meson-{prefix} {prefix}-report.junit.xml $= (all-{prefix}-targets) $(all-{prefix}-xml)') + print(f'ifeq ($(filter {prefix}, $(MAKECMDGOALS)),)') + print(f'.{prefix}.mtestargs +=3D $(call .speed.$(SPEED), $(.{prefix}.m= test-suites))') + print(f'endif') + print(f'{prefix}-build: run-ninja') + print(f'{prefix} $(all-{prefix}-targets): do-meson-{prefix}') + print(f'do-meson-{prefix}: run-ninja; $(if $(MAKE.n),,+)$(MESON) test = $(.{prefix}.mtestargs)') + print(f'{prefix}-report.junit.xml $(all-{prefix}-xml): {prefix}-report= %.junit.xml: run-ninja') + print(f'\t$(MAKE) {prefix}$* MTESTARGS=3D"$(MTESTARGS) --logbase {pref= ix}-report$*" && ln -f meson-logs/$@ .') =20 def emit_suite(name, suite, prefix): - executables =3D ' '.join(suite.executables) - slow_test_numbers =3D ' '.join((str(x) for x in suite.slow_tests)) - test_numbers =3D ' '.join((str(x) for x in suite.tests)) - target =3D '%s-%s' % (prefix, name) - print('.test.quick.%s :=3D %s' % (target, test_numbers)) - print('.test.slow.%s :=3D $(.test.quick.%s) %s' % (target, target, slo= w_test_numbers)) - print('%s-build: %s' % (prefix, executables)) - print('.PHONY: %s' % (target, )) - print('.PHONY: %s-report-%s.tap' % (prefix, name)) - print('%s: run-tests' % (target, )) - print('ifneq ($(filter %s %s, $(MAKECMDGOALS)),)' % (target, prefix)) - print('.tests +=3D $(.test.$(SPEED).%s)' % (target, )) - print('endif') - print('all-%s-targets +=3D %s' % (prefix, target)) + deps =3D ' '.join(suite.deps) + targets =3D f'{prefix}-{name} {prefix}-report-{name}.junit.xml {prefix= } {prefix}-report.junit.xml' + print() + print(f'.{prefix}-{name}.deps =3D {deps}') + print(f'ifneq ($(filter {prefix}-build {targets}, $(MAKECMDGOALS)),)') + print(f'.{prefix}.build-suites +=3D {name}') + print(f'endif') + print(f'ifneq ($(filter {targets}, $(MAKECMDGOALS)),)') + print(f'.{prefix}.mtest-suites +=3D ' + ' '.join(suite.names(name))) + print(f'endif') =20 targets =3D {t['id']: [os.path.relpath(f) for f in t['filename']] for t in introspect['targets']} @@ -125,5 +103,3 @@ def emit_suite(name, suite, prefix): emit_prolog(benchsuites, 'bench') for name, suite in benchsuites.items(): emit_suite(name, suite, 'bench') - -print('run-tests: $(patsubst %, run-test-%, $(.tests))') diff --git a/scripts/tap-driver.pl b/scripts/tap-driver.pl deleted file mode 100755 index b1d3880c50..0000000000 --- a/scripts/tap-driver.pl +++ /dev/null @@ -1,379 +0,0 @@ -#! /usr/bin/env perl -# Copyright (C) 2011-2013 Free Software Foundation, Inc. -# Copyright (C) 2018 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# ---------------------------------- # -# Imports, static data, and setup. # -# ---------------------------------- # - -use warnings FATAL =3D> 'all'; -use strict; -use Getopt::Long (); -use TAP::Parser; -use Term::ANSIColor qw(:constants); - -my $ME =3D "tap-driver.pl"; -my $VERSION =3D "2018-11-30"; - -my $USAGE =3D <<'END'; -Usage: - tap-driver [--test-name=3DTEST] [--color=3D{always|never|auto}] - [--verbose] [--show-failures-only] -END - -my $HELP =3D "$ME: TAP-aware test driver for QEMU testsuite harness." . - "\n" . $USAGE; - -# It's important that NO_PLAN evaluates "false" as a boolean. -use constant NO_PLAN =3D> 0; -use constant EARLY_PLAN =3D> 1; -use constant LATE_PLAN =3D> 2; - -use constant DIAG_STRING =3D> "#"; - -# ------------------- # -# Global variables. # -# ------------------- # - -my $testno =3D 0; # Number of test results seen so far. -my $bailed_out =3D 0; # Whether a "Bail out!" directive has been seen. -my $failed =3D 0; # Final exit code - -# Whether the TAP plan has been seen or not, and if yes, which kind -# it is ("early" is seen before any test result, "late" otherwise). -my $plan_seen =3D NO_PLAN; - -# ----------------- # -# Option parsing. # -# ----------------- # - -my %cfg =3D ( - "color" =3D> 0, - "verbose" =3D> 0, - "show-failures-only" =3D> 0, -); - -my $color =3D "auto"; -my $test_name =3D undef; - -# Perl's Getopt::Long allows options to take optional arguments after a sp= ace. -# Prevent --color by itself from consuming other arguments -foreach (@ARGV) { - if ($_ eq "--color" || $_ eq "-color") { - $_ =3D "--color=3D$color"; - } -} - -Getopt::Long::GetOptions - ( - 'help' =3D> sub { print $HELP; exit 0; }, - 'version' =3D> sub { print "$ME $VERSION\n"; exit 0; }, - 'test-name=3Ds' =3D> \$test_name, - 'color=3Ds' =3D> \$color, - 'show-failures-only' =3D> sub { $cfg{"show-failures-only"} =3D 1; }, - 'verbose' =3D> sub { $cfg{"verbose"} =3D 1; }, - ) or exit 1; - -if ($color =3D~ /^always$/i) { - $cfg{'color'} =3D 1; -} elsif ($color =3D~ /^never$/i) { - $cfg{'color'} =3D 0; -} elsif ($color =3D~ /^auto$/i) { - $cfg{'color'} =3D (-t STDOUT); -} else { - die "Invalid color mode: $color\n"; -} - -# ------------- # -# Prototypes. # -# ------------- # - -sub colored ($$); -sub decorate_result ($); -sub extract_tap_comment ($); -sub handle_tap_bailout ($); -sub handle_tap_plan ($); -sub handle_tap_result ($); -sub is_null_string ($); -sub main (); -sub report ($;$); -sub stringify_result_obj ($); -sub testsuite_error ($); - -# -------------- # -# Subroutines. # -# -------------- # - -# If the given string is undefined or empty, return true, otherwise -# return false. This function is useful to avoid pitfalls like: -# if ($message) { print "$message\n"; } -# which wouldn't print anything if $message is the literal "0". -sub is_null_string ($) -{ - my $str =3D shift; - return ! (defined $str and length $str); -} - -sub stringify_result_obj ($) -{ - my $result_obj =3D shift; - if ($result_obj->is_unplanned || $result_obj->number !=3D $testno) - { - return "ERROR"; - } - elsif ($plan_seen =3D=3D LATE_PLAN) - { - return "ERROR"; - } - elsif (!$result_obj->directive) - { - return $result_obj->is_ok ? "PASS" : "FAIL"; - } - elsif ($result_obj->has_todo) - { - return $result_obj->is_actual_ok ? "XPASS" : "XFAIL"; - } - elsif ($result_obj->has_skip) - { - return $result_obj->is_ok ? "SKIP" : "FAIL"; - } - die "$ME: INTERNAL ERROR"; # NOTREACHED -} - -sub colored ($$) -{ - my ($color_string, $text) =3D @_; - return $color_string . $text . RESET; -} - -sub decorate_result ($) -{ - my $result =3D shift; - return $result unless $cfg{"color"}; - my %color_for_result =3D - ( - "ERROR" =3D> BOLD.MAGENTA, - "PASS" =3D> GREEN, - "XPASS" =3D> BOLD.YELLOW, - "FAIL" =3D> BOLD.RED, - "XFAIL" =3D> YELLOW, - "SKIP" =3D> BLUE, - ); - if (my $color =3D $color_for_result{$result}) - { - return colored ($color, $result); - } - else - { - return $result; # Don't colorize unknown stuff. - } -} - -sub report ($;$) -{ - my ($msg, $result, $explanation) =3D (undef, @_); - if ($result =3D~ /^(?:X?(?:PASS|FAIL)|SKIP|ERROR)/) - { - # Output on console might be colorized. - $msg =3D decorate_result($result); - if ($result =3D~ /^(?:PASS|XFAIL|SKIP)/) - { - return if $cfg{"show-failures-only"}; - } - else - { - $failed =3D 1; - } - } - elsif ($result eq "#") - { - $msg =3D " "; - } - else - { - die "$ME: INTERNAL ERROR"; # NOTREACHED - } - $msg .=3D " $explanation" if defined $explanation; - print $msg . "\n"; -} - -sub testsuite_error ($) -{ - report "ERROR", "$test_name - $_[0]"; -} - -sub handle_tap_result ($) -{ - $testno++; - my $result_obj =3D shift; - - my $test_result =3D stringify_result_obj $result_obj; - my $string =3D $result_obj->number; - - my $description =3D $result_obj->description; - $string .=3D " $test_name" unless is_null_string $test_name; - $string .=3D " $description" unless is_null_string $description; - - if ($plan_seen =3D=3D LATE_PLAN) - { - $string .=3D " # AFTER LATE PLAN"; - } - elsif ($result_obj->is_unplanned) - { - $string .=3D " # UNPLANNED"; - } - elsif ($result_obj->number !=3D $testno) - { - $string .=3D " # OUT-OF-ORDER (expecting $testno)"; - } - elsif (my $directive =3D $result_obj->directive) - { - $string .=3D " # $directive"; - my $explanation =3D $result_obj->explanation; - $string .=3D " $explanation" - unless is_null_string $explanation; - } - - report $test_result, $string; -} - -sub handle_tap_plan ($) -{ - my $plan =3D shift; - if ($plan_seen) - { - # Error, only one plan per stream is acceptable. - testsuite_error "multiple test plans"; - return; - } - # The TAP plan can come before or after *all* the TAP results; we speak - # respectively of an "early" or a "late" plan. If we see the plan line - # after at least one TAP result has been seen, assume we have a late - # plan; in this case, any further test result seen after the plan will - # be flagged as an error. - $plan_seen =3D ($testno >=3D 1 ? LATE_PLAN : EARLY_PLAN); - # If $testno > 0, we have an error ("too many tests run") that will be - # automatically dealt with later, so don't worry about it here. If - # $plan_seen is true, we have an error due to a repeated plan, and that - # has already been dealt with above. Otherwise, we have a valid "plan - # with SKIP" specification, and should report it as a particular kind - # of SKIP result. - if ($plan->directive && $testno =3D=3D 0) - { - my $explanation =3D is_null_string ($plan->explanation) ? - undef : "- " . $plan->explanation; - report "SKIP", $explanation; - } -} - -sub handle_tap_bailout ($) -{ - my ($bailout, $msg) =3D ($_[0], "Bail out!"); - $bailed_out =3D 1; - $msg .=3D " " . $bailout->explanation - unless is_null_string $bailout->explanation; - testsuite_error $msg; -} - -sub extract_tap_comment ($) -{ - my $line =3D shift; - if (index ($line, DIAG_STRING) =3D=3D 0) - { - # Strip leading `DIAG_STRING' from `$line'. - $line =3D substr ($line, length (DIAG_STRING)); - # And strip any leading and trailing whitespace left. - $line =3D~ s/(?:^\s*|\s*$)//g; - # Return what is left (if any). - return $line; - } - return ""; -} - -sub main () -{ - my $iterator =3D TAP::Parser::Iterator::Stream->new(\*STDIN); - my $parser =3D TAP::Parser->new ({iterator =3D> $iterator }); - - STDOUT->autoflush(1); - while (defined (my $cur =3D $parser->next)) - { - # Parsing of TAP input should stop after a "Bail out!" directive. - next if $bailed_out; - - if ($cur->is_plan) - { - handle_tap_plan ($cur); - } - elsif ($cur->is_test) - { - handle_tap_result ($cur); - } - elsif ($cur->is_bailout) - { - handle_tap_bailout ($cur); - } - elsif ($cfg{"verbose"}) - { - my $comment =3D extract_tap_comment ($cur->raw); - report "#", "$comment" if length $comment; - } - } - # A "Bail out!" directive should cause us to ignore any following TAP - # error. - if (!$bailed_out) - { - if (!$plan_seen) - { - testsuite_error "missing test plan"; - } - elsif ($parser->tests_planned !=3D $parser->tests_run) - { - my ($planned, $run) =3D ($parser->tests_planned, $parser->tests_= run); - my $bad_amount =3D $run > $planned ? "many" : "few"; - testsuite_error (sprintf "too %s tests run (expected %d, got %d)= ", - $bad_amount, $planned, $run); - } - } -} - -# ----------- # -# Main code. # -# ----------- # - -main; -exit($failed); - -# Local Variables: -# perl-indent-level: 2 -# perl-continued-statement-offset: 2 -# perl-continued-brace-offset: 0 -# perl-brace-offset: 0 -# perl-brace-imaginary-offset: 0 -# perl-label-offset: -2 -# cperl-indent-level: 2 -# cperl-brace-offset: 0 -# cperl-continued-brace-offset: 0 -# cperl-label-offset: -2 -# cperl-extra-newline-before-brace: t -# cperl-merge-trailing-else: nil -# cperl-continued-statement-offset: 2 -# End: diff --git a/scripts/tap-merge.pl b/scripts/tap-merge.pl deleted file mode 100755 index 10ccf57bb2..0000000000 --- a/scripts/tap-merge.pl +++ /dev/null @@ -1,111 +0,0 @@ -#! /usr/bin/env perl -# Copyright (C) 2018 Red Hat, Inc. -# -# Author: Paolo Bonzini -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# ---------------------------------- # -# Imports, static data, and setup. # -# ---------------------------------- # - -use warnings FATAL =3D> 'all'; -use strict; -use Getopt::Long (); -use TAP::Parser; - -my $ME =3D "tap-merge.pl"; -my $VERSION =3D "2018-11-30"; - -my $HELP =3D "$ME: merge multiple TAP inputs from stdin."; - -use constant DIAG_STRING =3D> "#"; - -# ----------------- # -# Option parsing. # -# ----------------- # - -Getopt::Long::GetOptions - ( - 'help' =3D> sub { print $HELP; exit 0; }, - 'version' =3D> sub { print "$ME $VERSION\n"; exit 0; }, - ); - -# -------------- # -# Subroutines. # -# -------------- # - -sub main () -{ - my $iterator =3D TAP::Parser::Iterator::Stream->new(\*STDIN); - my $parser =3D TAP::Parser->new ({iterator =3D> $iterator }); - my $testno =3D 0; # Number of test results seen so far. - my $bailed_out =3D 0; # Whether a "Bail out!" directive has been seen. - - STDOUT->autoflush(1); - while (defined (my $cur =3D $parser->next)) - { - if ($cur->is_bailout) - { - $bailed_out =3D 1; - print DIAG_STRING . " " . $cur->as_string . "\n"; - next; - } - elsif ($cur->is_plan) - { - $bailed_out =3D 0; - next; - } - elsif ($cur->is_test) - { - $bailed_out =3D 0 if $cur->number =3D=3D 1; - $testno++; - $cur =3D TAP::Parser::Result::Test->new({ - ok =3D> $cur->ok, - test_num =3D> $testno, - directive =3D> $cur->directive, - explanation =3D> $cur->explanation, - description =3D> $cur->description - }); - } - elsif ($cur->is_version) - { - next if $testno > 0; - } - print $cur->as_string . "\n" unless $bailed_out; - } - print "1..$testno\n"; -} - -# ----------- # -# Main code. # -# ----------- # - -main; - -# Local Variables: -# perl-indent-level: 2 -# perl-continued-statement-offset: 2 -# perl-continued-brace-offset: 0 -# perl-brace-offset: 0 -# perl-brace-imaginary-offset: 0 -# perl-label-offset: -2 -# cperl-indent-level: 2 -# cperl-brace-offset: 0 -# cperl-continued-brace-offset: 0 -# cperl-label-offset: -2 -# cperl-extra-newline-before-brace: t -# cperl-merge-trailing-else: nil -# cperl-continued-statement-offset: 2 -# End: diff --git a/tests/fp/meson.build b/tests/fp/meson.build index 07e2cdc8d2..59776a00a7 100644 --- a/tests/fp/meson.build +++ b/tests/fp/meson.build @@ -622,7 +622,7 @@ test('fp-test-mulAdd', fptest, # no fptest_rounding_args args: fptest_args + ['f16_mulAdd', 'f32_mulAdd', 'f64_mulAdd', 'f128_mulAdd'], - suite: ['softfloat-slow', 'softfloat-ops-slow'], timeout: 90) + suite: ['softfloat-slow', 'softfloat-ops-slow', 'slow'], timeout: 90) =20 fpbench =3D executable( 'fp-bench', --=20 2.33.1