From patchwork Wed Jan 27 20:42:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Kretz X-Patchwork-Id: 1432359 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DQwXW6MYKz9sS8 for ; Thu, 28 Jan 2021 07:42:51 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4EFC2398B8B8; Wed, 27 Jan 2021 20:42:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from lxmtout1.gsi.de (lxmtout1.gsi.de [140.181.3.111]) by sourceware.org (Postfix) with ESMTPS id 11EE0398B86D; Wed, 27 Jan 2021 20:42:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 11EE0398B86D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gsi.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=M.Kretz@gsi.de Received: from localhost (localhost [127.0.0.1]) by lxmtout1.gsi.de (Postfix) with ESMTP id 38F6F2050D05; Wed, 27 Jan 2021 21:42:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lxmtout1.gsi.de Received: from lxmtout1.gsi.de ([127.0.0.1]) by localhost (lxmtout1.gsi.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id iZCa9-ehOhiv; Wed, 27 Jan 2021 21:42:24 +0100 (CET) Received: from srvex3.campus.gsi.de (srvex3.campus.gsi.de [10.10.4.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by lxmtout1.gsi.de (Postfix) with ESMTPS id 1EC232050D00; Wed, 27 Jan 2021 21:42:24 +0100 (CET) Received: from excalibur.localnet (140.181.3.12) by srvex3.campus.gsi.de (10.10.4.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Wed, 27 Jan 2021 21:42:23 +0100 From: Matthias Kretz To: , Subject: [PATCH 08/16] Immediate feedback with -v Date: Wed, 27 Jan 2021 21:42:23 +0100 Message-ID: <37658268.xCRyjBS7g1@excalibur> Organization: GSI Helmholtzzentrum =?utf-8?q?f=C3=BCr?= Schwerionenforschung In-Reply-To: <4667217.5jz8CO7rxU@excalibur> References: <4667217.5jz8CO7rxU@excalibur> MIME-Version: 1.0 X-Originating-IP: [140.181.3.12] X-ClientProxiedBy: srvex3.Campus.gsi.de (10.10.4.16) To srvex3.campus.gsi.de (10.10.4.16) X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" From: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/driver.sh: Remove executable on SIGINT. Process compiler and test executable output: In verbose mode print messages immediately, limited to 1000 lines and breaking long lines to below $COLUMNS (or 1024 if not set). Communicating the exit status of the compiler / test with the necessary pipe is done via a message through stdout/-in. --- .../testsuite/experimental/simd/driver.sh | 194 +++++++++++------- 1 file changed, 116 insertions(+), 78 deletions(-) -- ────────────────────────────────────────────────────────────────────────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de std::experimental::simd https://github.com/VcDevel/std-simd ────────────────────────────────────────────────────────────────────────── diff --git a/libstdc++-v3/testsuite/experimental/simd/driver.sh b/libstdc++-v3/testsuite/experimental/simd/driver.sh index cf07ff9ad85..314c6a16f86 100755 --- a/libstdc++-v3/testsuite/experimental/simd/driver.sh +++ b/libstdc++-v3/testsuite/experimental/simd/driver.sh @@ -172,81 +172,14 @@ unsupported() { echo "UNSUPPORTED: $src $type $abiflag ($*)" >> "$log" } -verify_compilation() { - failed=$1 - if [ $failed -eq 0 ]; then - warnings=$(grep -ic 'warning:' "$log") - if [ $warnings -gt 0 ]; then - fail "excess warnings:" $warnings - if $verbose; then - cat "$log" - elif ! $quiet; then - grep -i 'warning:' "$log" | head -n5 - fi - elif [ "$xfail" = "compile" ]; then - xpass "test for excess errors" - else - pass "test for excess errors" - fi - else - if [ $failed -eq 124 ]; then - fail "timeout: test for excess errors" - else - errors=$(grep -ic 'error:' "$log") - if [ "$xfail" = "compile" ]; then - xfail "excess errors:" $errors - exit 0 - else - fail "excess errors:" $errors - fi - fi - if $verbose; then - cat "$log" - elif ! $quiet; then - grep -i 'error:' "$log" | head -n5 - fi - exit 0 - fi -} - -verify_test() { - failed=$1 - if [ $failed -eq 0 ]; then - rm "$exe" - if [ "$xfail" = "run" ]; then - xpass "execution test" - else - pass "execution test" - fi - else - $keep_failed || rm "$exe" - if [ $failed -eq 124 ]; then - fail "timeout: execution test" - elif [ "$xfail" = "run" ]; then - xfail "execution test" - else - fail "execution test" - fi - if $verbose; then - lines=$(wc -l < "$log") - lines=$((lines-3)) - if [ $lines -gt 1000 ]; then - echo "[...]" - tail -n1000 "$log" - else - tail -n$lines "$log" - fi - elif ! $quiet; then - grep -i fail "$log" | head -n5 - fi - exit 0 - fi -} - write_log_and_verbose() { echo "$*" >> "$log" if $verbose; then - echo "$*" + if [ -z "$COLUMNS" ] || ! type fmt>/dev/null; then + echo "$*" + else + echo "$*" | fmt -w $COLUMNS -s - || cat + fi fi } @@ -277,7 +210,7 @@ test_selector() { return 1 } -trap "rm -f '$log' '$sum'; exit" INT +trap "rm -f '$log' '$sum' $exe; exit" INT rm -f "$log" "$sum" touch "$log" "$sum" @@ -317,17 +250,122 @@ if [ -n "$xfail" ]; then fi fi +log_output() { + if $verbose; then + maxcol=${1:-1024} + awk " +BEGIN { count = 0 } +/^###exitstatus### [0-9]+$/ { exit \$2 } +{ + print >> \"$log\" + if (count >= 1000) next + ++count + if (length(\$0) > $maxcol) { + i = 1 + while (i + $maxcol <= length(\$0)) { + len = $maxcol + line = substr(\$0, i, len) + len = match(line, / [^ ]*$/) + if (len <= 0) { + len = match(substr(\$0, i), / [^ ]/) + if (len <= 0) len = $maxcol + } + print substr(\$0, i, len) + i += len + } + print substr(\$0, i) + } else { + print + } +} +END { close(\"$log\") } +" + else + awk " +/^###exitstatus### [0-9]+$/ { exit \$2 } +{ print >> \"$log\" } +END { close(\"$log\") } +" + fi +} + +verify_compilation() { + log_output $COLUMNS + exitstatus=$? + if [ $exitstatus -eq 0 ]; then + warnings=$(grep -ic 'warning:' "$log") + if [ $warnings -gt 0 ]; then + fail "excess warnings:" $warnings + if ! $verbose && ! $quiet; then + grep -i 'warning:' "$log" | head -n5 + fi + elif [ "$xfail" = "compile" ]; then + xpass "test for excess errors" + else + pass "test for excess errors" + fi + return 0 + else + if [ $exitstatus -eq 124 ]; then + fail "timeout: test for excess errors" + else + errors=$(grep -ic 'error:' "$log") + if [ "$xfail" = "compile" ]; then + xfail "excess errors:" $errors + exit 0 + else + fail "excess errors:" $errors + fi + fi + if ! $verbose && ! $quiet; then + grep -i 'error:' "$log" | head -n5 + fi + return 1 + fi +} + +verify_test() { + log_output $COLUMNS + exitstatus=$? + if [ $exitstatus -eq 0 ]; then + if [ "$xfail" = "run" ]; then + $keep_failed || rm "$exe" + xpass "execution test" + else + rm "$exe" + pass "execution test" + fi + return 0 + else + $keep_failed || rm "$exe" + if ! $verbose && ! $quiet; then + grep -i fail "$log" | head -n5 + fi + if [ $exitstatus -eq 124 ]; then + fail "timeout: execution test" + elif [ "$xfail" = "run" ]; then + xfail "execution test" + else + fail "execution test" + fi + return 1 + fi +} + write_log_and_verbose "$CXX $src $@ -D_GLIBCXX_SIMD_TESTTYPE=$type $abiflag -o $exe" -timeout --foreground $timeout "$CXX" "$src" "$@" "-D_GLIBCXX_SIMD_TESTTYPE=$type" $abiflag -o "$exe" >> "$log" 2>&1 -verify_compilation $? +{ + timeout --foreground $timeout "$CXX" "$src" "$@" "-D_GLIBCXX_SIMD_TESTTYPE=$type" $abiflag -o "$exe" 2>&1 <&- + printf "###exitstatus### %d\n" $? +} | verify_compilation || exit 0 if [ -n "$sim" ]; then write_log_and_verbose "$sim ./$exe" - timeout --foreground $timeout $sim "./$exe" >> "$log" 2>&1 <&- else write_log_and_verbose "./$exe" timeout=$(awk "BEGIN { print int($timeout / 2) }") - timeout --foreground $timeout "./$exe" >> "$log" 2>&1 <&- fi -verify_test $? +{ + timeout --foreground $timeout $sim "./$exe" 2>&1 <&- + printf "###exitstatus### %d\n" $? +} | verify_test || exit 0 # vim: sw=2 et cc=81 si