From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id BEE836DE0FE6 for ; Mon, 25 Sep 2017 13:39:01 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.065 X-Spam-Level: X-Spam-Status: No, score=-0.065 tagged_above=-999 required=5 tests=[AWL=0.146, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.211] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WVOUtfUjnDju for ; Mon, 25 Sep 2017 13:39:01 -0700 (PDT) Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by arlo.cworth.org (Postfix) with ESMTPS id 2CE5C6DE10F9 for ; Mon, 25 Sep 2017 13:38:57 -0700 (PDT) Received: by mail-wr0-f169.google.com with SMTP id z39so9967499wrb.8 for ; Mon, 25 Sep 2017 13:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=RduBnX5xx5i7K5LmRo37puYBEDKYVLyTW4ZBC3cr8ig=; b=gYzrLwr/Kbx1jvM9n7NhtyPwUW1nAoAgwgMgoqBP9xGrrs7kMvXQvqXy/Pqp2Wf27r hWhWi6onipnI/zPaO2k+esKStaRBKCHuHPjxPayJzitODxsaRkRiS84l012nyUFv8Yvo zcpLJAOXYXyB+5tyt3SpseNlJkKEsyWd1y6aUZ6Jt7DR7OG9ItI8vzsUESxKXdwHvBRy h52KSq2SxVgSVVl/hpOnQbDDPsXQnLr+QUfaFgdQMuGH5dWxQXmOqpntJi3ce8RGibiB Lf/scxBJxSfhDDzyS15pXKWWCjCyp5Ye+hnHTXPsUIMYXGT2+e+ku53dqcqNBEKqooeK qDzw== 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:in-reply-to :references:in-reply-to:references; bh=RduBnX5xx5i7K5LmRo37puYBEDKYVLyTW4ZBC3cr8ig=; b=FXganVRL9YAKfOiUoSf3p5KadChxzUyl2OHXzd2DXWBWX+XvBWufOhh+cHzTjFzySa o5VNhgo+8s/v1fDWAenFMzj0+TUw3wjmglBrh+YnineO7jS2gXfpHHJ2YNVswN/djgzD 1ll5FsGnBHvZ0NQlybXAOGT+BufAX+dDWZfDrIWpWoogfPQy33XP+dWEVLvUdGf+wvYp PMViSAWkx/OpH1XHNIdIv4AuwdxDIw6P8P/A5RGN6M6qw7OeRKGaVwQH/76/qSDR++E/ RvYIOTMCI+r6QCugSZz/uStawiQ7I4wDGc4RMBB7lZygFkHqTt2pXyMbJKW/f1DeIMB5 R6AA== X-Gm-Message-State: AHPjjUhhlogrALHNFUrNhrOl9A1FGtRtKkAZczs8NiM4wI5YPeR2Vtyu 3i4IY5fmzJd5Db1puqtAR9wf0B1MOMc= X-Google-Smtp-Source: AOwi7QA05yLRcGTD/n19iGDPl8vOuzHJrQzN4r4DZRVl0NHxXvm5ac+DGhz0vkEzC0gkPt+cn8OGag== X-Received: by 10.46.42.3 with SMTP id q3mr3080771ljq.191.1506371934876; Mon, 25 Sep 2017 13:38:54 -0700 (PDT) Received: from localhost (mobile-access-5d6a60-234.dhcp.inet.fi. [93.106.96.234]) by smtp.gmail.com with ESMTPSA id h83sm823192lfi.71.2017.09.25.13.38.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 13:38:54 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 06/24] test: add a script to figure out source and build directories Date: Mon, 25 Sep 2017 23:38:22 +0300 Message-Id: <24d0d789f2379404115e3f079be75799c1a807a0.1506370901.git.jani@nikula.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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, 25 Sep 2017 20:39:01 -0000 Expect the tests to be run somewhere in the build directory hierarchy. Allow for source and build directories to be passed through the environment. --- test/export-dirs.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/export-dirs.sh diff --git a/test/export-dirs.sh b/test/export-dirs.sh new file mode 100644 index 000000000000..0578b1e50194 --- /dev/null +++ b/test/export-dirs.sh @@ -0,0 +1,32 @@ +# Source this script to set and export NOTMUCH_SRCDIR and +# NOTMUCH_BUILDDIR. +# +# For this to work, always have current directory somewhere within the +# build directory hierarchy, and run the script sourcing this script +# using a path (relative or absolute) to the source directory. + +if [[ -z "${NOTMUCH_SRCDIR}" ]]; then + export NOTMUCH_SRCDIR="$(cd "$(dirname "$0")"/.. && pwd)" +fi + +find_builddir() +{ + local dir="$1" + + while [[ -n "$dir" ]] && [[ "$dir" != "/" ]]; do + if [[ -x "$dir/notmuch" ]] && [[ ! -d "$dir/notmuch" ]]; then + echo "$dir" + break + fi + dir="$(dirname "$dir")" + done +} + +if [[ -z "${NOTMUCH_BUILDDIR}" ]]; then + export NOTMUCH_BUILDDIR="$(find_builddir "$(pwd)")" + + if [[ -z "${NOTMUCH_BUILDDIR}" ]]; then + echo "Run tests in a subdir of built notmuch tree." >&2 + exit 1 + fi +fi -- 2.11.0