From patchwork Wed May 20 07:01:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 1294028 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=TIkPGM20; dkim-atps=neutral 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 49RkFS3S8kz9sT6 for ; Wed, 20 May 2020 17:01:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA8453840C18; Wed, 20 May 2020 07:01:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by sourceware.org (Postfix) with ESMTPS id 59BC63840C0E for ; Wed, 20 May 2020 07:01:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 59BC63840C0E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kito.cheng@sifive.com Received: by mail-pj1-x1044.google.com with SMTP id s69so804444pjb.4 for ; Wed, 20 May 2020 00:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=emw6dc0PCRP4DZmrXIt66gE3OdSjkMgyoTInvpc6rOA=; b=TIkPGM20O8tH9vBq5vpKGXEXraQyEJJPUA5WxhltNP+LaN9XzHv7uC5gmXY+AMlCpv Le/bzJOiVj3Y9ZmekzXjEnNTskGIlYG88TPHlxrMP1fTELv+WMJc8PtRxGVdybGj08UV cwhfM95A2WRp3V0WMtLPTashhlQlwM9DmiCt/ChPJHACLfq981yqelNaEkKwu4hSeeXq nxKrOmtIyuYCeEXg7UtSV+oAZ+h0nUCpCzxyLMb2WZeWZTsHgYcTUmtxQk1SGNKcLwHv hfOYHb31Hthb1p1ZQj+aPGR+HC6aQTasWqN8PPmn/uI2j1/Ca7of/pLiutxjWL4lwIBm tubg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=emw6dc0PCRP4DZmrXIt66gE3OdSjkMgyoTInvpc6rOA=; b=cT+JVrYEE1OcdbT3Lkxqasyo4ImNmyn1IRQA5Wm9V/vYjd0dTWLv0KpS2Cm/dyGzTd zDc+hWTFUjET5rgAgzjjwCWE63s5pkR7XZH0S8z/TeRvQRsZ0YPi185L7q6qPFxuZcXe pOMMGwS90rOpzRJGDDvAybeK5M6zOp4qoRMWpp3sXfXkSeaFO1VUyNAjG4xsIWBwUd8q f40tJAasupZ+Emi6B9E++zY/FMjgZwi5HgmWno9qHwuFnvmsl5xFeCbUZYLSqGn2/JcY TMP3kjCpt0vAB3E6CnAuo67egq2ddsBXSVYQXANMCh2DnTLbl7dyUW7edD9ybaLBAOOD JV7A== X-Gm-Message-State: AOAM533/PDomJQTuyj+VWOK0GhGagHTOkRmakGql0I64jBRkZZGFI6Pe QHlmiQKgtEr2HBColcBglvZQOM6/MjU= X-Google-Smtp-Source: ABdhPJwdqIPlRPiIGGkavnmj4sdhzxEsmyrkVaQsyLRIGCEbwDpehtRviD+wAZVnRARE+8JTMpxAKQ== X-Received: by 2002:a17:90a:589:: with SMTP id i9mr3589954pji.156.1589958097021; Wed, 20 May 2020 00:01:37 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (114-34-229-221.HINET-IP.hinet.net. [114.34.229.221]) by smtp.gmail.com with ESMTPSA id f11sm1294175pfa.32.2020.05.20.00.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 00:01:36 -0700 (PDT) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jakub@redhat.com Subject: [PATCH] testsuite: Disable colorization for ubsan test Date: Wed, 20 May 2020 15:01:32 +0800 Message-Id: <20200520070132.41611-1-kito.cheng@sifive.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Spam-Status: No, score=-16.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: , Cc: Kito Cheng Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" - Run gcc testsuite with qemu will print out ascii color code for ubsan related testcase, however several testcase didn't consider that, so disable colorization prevent such problem and simplify the process when adding testcase in future. - Verified on native X86 and RISC-V qemu full system mode and user mode. ChangeLog: gcc/testsuite/ Kito Cheng * ubsan-dg.exp (orig_ubsan_options_saved): New (orig_ubsan_options): Ditto. (ubsan_init): Store UBSAN_OPTIONS and set UBSAN_OPTIONS. (ubsan_finish): Restore UBSAN_OPTIONS. --- gcc/testsuite/lib/ubsan-dg.exp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gcc/testsuite/lib/ubsan-dg.exp b/gcc/testsuite/lib/ubsan-dg.exp index 015601cd404..f4ab29e2add 100644 --- a/gcc/testsuite/lib/ubsan-dg.exp +++ b/gcc/testsuite/lib/ubsan-dg.exp @@ -17,6 +17,9 @@ # Return 1 if compilation with -fsanitize=undefined is error-free for trivial # code, 0 otherwise. +set orig_ubsan_options_saved 0 +set orig_ubsan_options 0 + proc check_effective_target_fsanitize_undefined {} { return [check_runtime fsanitize_undefined { int main (void) { return 0; } @@ -74,6 +77,17 @@ proc ubsan_init { args } { global TOOL_OPTIONS global ubsan_saved_TEST_ALWAYS_FLAGS global ubsan_saved_ALWAYS_CXXFLAGS + global orig_ubsan_options_saved + global orig_ubsan_options + + if { $orig_ubsan_options_saved == 0 } { + # Save the original environment. + if [info exists env(UBSAN_OPTIONS)] { + set orig_ubsan_options "$env(UBSAN_OPTIONS)" + set orig_ubsan_options_saved 1 + } + } + setenv UBSAN_OPTIONS color=never set link_flags "" if ![is_remote host] { @@ -109,6 +123,14 @@ proc ubsan_finish { args } { global ubsan_saved_ALWAYS_CXXFLAGS global ubsan_saved_library_path global ld_library_path + global orig_ubsan_options_saved + global orig_ubsan_options + + if { $orig_ubsan_options_saved } { + setenv UBSAN_OPTIONS "$orig_ubsan_options" + } elseif [info exists env(UBSAN_OPTIONS)] { + unsetenv UBSAN_OPTIONS + } if [info exists ubsan_saved_ALWAYS_CXXFLAGS ] { set ALWAYS_CXXFLAGS $ubsan_saved_ALWAYS_CXXFLAGS