From patchwork Mon Dec 6 14:40:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexandra_H=C3=A1jkov=C3=A1?= X-Patchwork-Id: 48537 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 635F13858001 for ; Mon, 6 Dec 2021 14:41:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 635F13858001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1638801675; bh=T4Tue94WSAVRMYl3VgPs6V2IXq6bFa2T+sbnOf955DQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=PaHeRkHhZAA0wzAXQgawmxIWa7USCPl5TkmZtpAZHIBgAywMQia5zvmB/Xd4424T3 GGze9LPrHEHb027LrUWlkzXsGfd0J8D6K7gHcPIiPkV4P3cOXLhxpXFsarG6Sc6N98 aIjBLcAU919JMwbuNguNKp1nzKLA2eAEl3vwQMHI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with UTF8SMTPS id 2CECA3858D28 for ; Mon, 6 Dec 2021 14:40:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2CECA3858D28 Received: by mail-ed1-x530.google.com with SMTP id z5so44289121edd.3 for ; Mon, 06 Dec 2021 06:40:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=T4Tue94WSAVRMYl3VgPs6V2IXq6bFa2T+sbnOf955DQ=; b=XmC82UXXzYMLUvoCROihurH9zFYKqpqKmAVR/aGzM1XCSkT1IsFHUU02MGc8LL6jmq qJaOQUOOBh+FFRLrxldtHYLnBCj5oa/QU2Y1AzMKlwR3Sdkp1sF4dv2ZBgKe7KW4M9L8 xD6S6X0tKj7/ItpsybqNGSNbUxOPxyliqFAUlbmdlCzEnXoFKNGma5/MCDc0Vv/1mJ4T qzzLweEcsURX82l2jAIfr92NBwV2UaPO1K6xxBrlcyF5a4ZP1FP36nfgL5vapgKkPoWo YIJ+ejfsrKC084DboSNM981rrrYP5mrKygF/E0I3urrc35eY5T0WvmjC4rjlqSCB+j95 pPdw== X-Gm-Message-State: AOAM532NFfnRBto6+tdTZwVTD9Q8dWVwsB5Ilq2u/yQalMBtkkuXsQuG iH2lkxf7DvL92+f5Ql3HyH9KktTcf8I+HA== X-Google-Smtp-Source: ABdhPJzJ23OByaz0yusfb530d7QglBknajVmBbD1Wo6ydmwNNKV2FgW8SpDlsTpf8lpzZ9eO/TYKWw== X-Received: by 2002:a50:e18e:: with SMTP id k14mr55702462edl.147.1638801651897; Mon, 06 Dec 2021 06:40:51 -0800 (PST) Received: from picard.redhat.com (ip-244-183.pel.cz. [213.226.244.183]) by smtp.gmail.com with ESMTPSA id hq37sm7078682ejc.116.2021.12.06.06.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Dec 2021 06:40:51 -0800 (PST) X-Google-Original-From: =?unknown-8bit?q?Alexandra_H=C3=A1jkov=C3=A1_ahajkov?= =?unknown-8bit?q?a=40redhat=2Ecom?= To: libc-alpha@sourceware.org Subject: [PATCH] Add valgrind smoke test Date: Mon, 6 Dec 2021 15:40:43 +0100 Message-Id: <20211206144043.858697-1-ahajkova@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Alexandra_H=C3=A1jkov=C3=A1_via_Libc-alpha?= From: =?utf-8?q?Alexandra_H=C3=A1jkov=C3=A1?= Reply-To: =?utf-8?q?Alexandra_H=C3=A1jkov=C3=A1?= Cc: Mark Wielaard , =?utf-8?q?Alexandra_H=C3=A1jkov=C3=A1?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" From: Alexandra Hájková Check if valgrind is present during the configure time and run smoke tests with valgrind to verify dynamic loader. Co-authored-by: Mark Wielaard --- elf/Makefile | 7 +++++++ elf/tst-valgrind-smoke.sh | 38 ++++++++++++++++++++++++++++++++++++++ elf/valgrind-test.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 elf/tst-valgrind-smoke.sh create mode 100644 elf/valgrind-test.c diff --git a/elf/Makefile b/elf/Makefile index ef36008673..14aab3624a 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -232,6 +232,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \ tst-dl-is_dso tst-ro-dynamic \ tst-audit18 \ tst-rtld-run-static \ + valgrind-test # reldep9 tests-internal += loadtest unload unload2 circleload1 \ neededtest neededtest2 neededtest3 neededtest4 \ @@ -253,6 +254,12 @@ tests-special += $(objpfx)tst-audit14-cmp.out $(objpfx)tst-audit15-cmp.out \ endif endif endif + +tests-special += $(objpfx)tst-valgrind-smoke.out +$(objpfx)tst-valgrind-smoke.out: tst-valgrind-smoke.sh $(objpfx)ld.so + $(SHELL) $< $(objpfx)ld.so '$(test-wrapper-env)' '$(run-program-env)' '$(rpath-link)' $(objpfx)valgrind-test > $@; \ + $(evaluate-test) + tests += $(tests-execstack-$(have-z-execstack)) ifeq ($(run-built-tests),yes) tests-special += $(objpfx)tst-leaks1-mem.out \ diff --git a/elf/tst-valgrind-smoke.sh b/elf/tst-valgrind-smoke.sh new file mode 100644 index 0000000000..a78d7ff10d --- /dev/null +++ b/elf/tst-valgrind-smoke.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# Valgrind smoke test. +# Copyright (C) 2021 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library 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 +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +set -e + +rtld=$1 +test_wrapper_env=$2 +run_program_env=$3 +library_path=$4 +test_prog=$5 + +# Test whether valgrind is available in the test +# environment. If not, skip the test. +${test_wrapper_env} \ +${run_program_env} \ +$rtld --library-path "$library_path" \ + /bin/sh -c 'command -v valgrind' || exit 77 + +${test_wrapper_env} \ +${run_program_env} \ +$rtld --library-path "$library_path" \ +/bin/sh -c "valgrind -q --error-exitcode=1 $test_prog" diff --git a/elf/valgrind-test.c b/elf/valgrind-test.c new file mode 100644 index 0000000000..606c874b68 --- /dev/null +++ b/elf/valgrind-test.c @@ -0,0 +1,31 @@ +/* This is the simple test intended to be called by + tst-valgrind-smoke to perform vagrind smoke test. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +int +main (void) +{ + setlocale (LC_ALL, ""); + bindtextdomain ("translit", ""); + textdomain ("translit"); + + return 0; +}