From 1618cb0ce5e1b7d11dd6c1fbce0c8053908b7ce2 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Mon, 20 Oct 2014 18:03:21 +0300 Subject: [PATCH] [PATCH] test: use LDFLAGS in test/Makefile.local --- 88/4c7de7c89dc4299a5dfb57a0fc8bf3e74b3bc2 | 126 ++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 88/4c7de7c89dc4299a5dfb57a0fc8bf3e74b3bc2 diff --git a/88/4c7de7c89dc4299a5dfb57a0fc8bf3e74b3bc2 b/88/4c7de7c89dc4299a5dfb57a0fc8bf3e74b3bc2 new file mode 100644 index 000000000..4878cba00 --- /dev/null +++ b/88/4c7de7c89dc4299a5dfb57a0fc8bf3e74b3bc2 @@ -0,0 +1,126 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 69760431FAF + for ; Mon, 20 Oct 2014 08:03:34 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id j3F1wU7dWvQC for ; + Mon, 20 Oct 2014 08:03:29 -0700 (PDT) +Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com + [74.125.82.49]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + B890F431FAE for ; Mon, 20 Oct 2014 08:03:28 -0700 + (PDT) +Received: by mail-wg0-f49.google.com with SMTP id x12so5658857wgg.8 + for ; Mon, 20 Oct 2014 08:03:26 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id; + bh=xpj5MRhotBAUTILo8BGntCIp+Fn5pXuVjjeN6PxJ9bI=; + b=V5nKEtI1tqY1DNWKf/y07ZZP5aw8w16an2W+X6QxWG7o5VLkDVDvboLy2w7OB/hrAQ + HddYSf4w7wLBsjGtcIkXo8FTLux9gbl9sQ1NbqfGJNqJ8Uzmr3ESpaeKD6F5yMfThQtk + g6BQRksmVr16qOkN0PJY0S52qqUWdKqZYpgJSY5rzYo0V9z/HGfKInO73OM08TLQyE1V + 6IIAeC1Q1Jv3eKcNBHuHN6yU/NuFq2vpMtepDYJzNaGkN0cZ9olpAK8cFlUGqUf7rT/E + fKi2BUz8e6O0rwP0JMJze+ZKFWgUXdCpvaEIatIYzKfCKCnp7PNe5Dh1Mc7ZgFTHYH0c + f/lQ== +X-Gm-Message-State: + ALoCoQnsdqC+ni6ude1CG59F/YtJUQ1DjO5o9016WEkEJmvE2T0BfwpFS8sG4RpDq+TFxE7C40NP +X-Received: by 10.181.27.229 with SMTP id jj5mr21091026wid.64.1413817405174; + Mon, 20 Oct 2014 08:03:25 -0700 (PDT) +Received: from localhost (mobile-internet-5d6ad2-138.dhcp.inet.fi. + [93.106.210.138]) by mx.google.com with ESMTPSA id + ws2sm12166358wjc.32.2014.10.20.08.03.23 for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 20 Oct 2014 08:03:24 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH] test: use LDFLAGS in test/Makefile.local +Date: Mon, 20 Oct 2014 18:03:21 +0300 +Message-Id: <1413817401-6058-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 2.1.1 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 20 Oct 2014 15:03:34 -0000 + +Apparently the test binaries are built with minimal LDFLAGS, only +adding dependency specific LDFLAGS as needed. However because some of +the test binaries incorporate notmuch object files, it is necessary to +use the same link flags as notmuch. For example user provided +CFLAGS/CXXFLAGS/LDFLAGS with -fsanitize=undefined fails to build the +test binaries if the flags differ. + +--- + +With this I could do + +CFLAGS="-fsanitize=undefined -g" CXXFLAGS="-fsanitize=undefined -g" LDFLAGS="-fsanitize=undefined -g" ./configure + +to try ubsan with gcc 4.9. No problems found while running make test +(and it did find an UB I planted to ensure I had it all set up right). +--- + test/Makefile.local | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/test/Makefile.local b/test/Makefile.local +index a2d58fc1a1b0..2331ceb15e33 100644 +--- a/test/Makefile.local ++++ b/test/Makefile.local +@@ -13,10 +13,10 @@ smtp_dummy_srcs = \ + smtp_dummy_modules = $(smtp_dummy_srcs:.c=.o) + + $(dir)/arg-test: $(dir)/arg-test.o command-line-arguments.o util/libutil.a +- $(call quiet,CC) $^ -o $@ ++ $(call quiet,CC) $^ -o $@ $(LDFLAGS) + + $(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o util/libutil.a +- $(call quiet,CC) $^ $(TALLOC_LDFLAGS) -o $@ ++ $(call quiet,CC) $^ -o $@ $(LDFLAGS) $(TALLOC_LDFLAGS) + + random_corpus_deps = $(dir)/random-corpus.o $(dir)/database-test.o \ + notmuch-config.o command-line-arguments.o \ +@@ -24,19 +24,19 @@ random_corpus_deps = $(dir)/random-corpus.o $(dir)/database-test.o \ + parse-time-string/libparse-time-string.a + + $(dir)/random-corpus: $(random_corpus_deps) +- $(call quiet,CXX) $(CFLAGS_FINAL) $^ -o $@ $(CONFIGURE_LDFLAGS) ++ $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(CONFIGURE_LDFLAGS) + + $(dir)/smtp-dummy: $(smtp_dummy_modules) +- $(call quiet,CC) $^ -o $@ ++ $(call quiet,CC) $^ -o $@ $(LDFLAGS) + + $(dir)/symbol-test: $(dir)/symbol-test.o lib/$(LINKER_NAME) +- $(call quiet,CXX) $^ -o $@ -Llib -lnotmuch $(XAPIAN_LDFLAGS) ++ $(call quiet,CXX) $^ -o $@ $(LDFLAGS) -Llib -lnotmuch $(XAPIAN_LDFLAGS) + + $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o +- $(call quiet,CC) $^ -o $@ ++ $(call quiet,CC) $^ -o $@ $(LDFLAGS) + + $(dir)/make-db-version: $(dir)/make-db-version.o +- $(call quiet,CXX) $^ -o $@ $(XAPIAN_LDFLAGS) ++ $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(XAPIAN_LDFLAGS) + + .PHONY: test check + +-- +2.1.1 + -- 2.26.2