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 442FD6DE110A for ; Mon, 25 Sep 2017 13:39:04 -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 KJLJ5eRRbS7U for ; Mon, 25 Sep 2017 13:39:03 -0700 (PDT) Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) by arlo.cworth.org (Postfix) with ESMTPS id 8E69C6DE0FD2 for ; Mon, 25 Sep 2017 13:39:01 -0700 (PDT) Received: by mail-wr0-f170.google.com with SMTP id m18so9967505wrm.2 for ; Mon, 25 Sep 2017 13:39:01 -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=ccO6i/CrLNB/1hRTv+cmP5s4CPs5jAZGF6O5V3FqXLQ=; b=aIK2tesLrPuqjML8d0Ng886pB2yLeZF/J1MkjGWWwRCNAaWbE6Veb011xejZK9f8tl JiLaMHiH800U5R3Pi1ZuRCZtyft1WqqkoT2tZSkyrVcYxTN3lm2byCqQ4XjJ8qHAzvwx HMqTk5hGfIxpbRQJHuC8tLPtUeijO7gH6olt3Ns0UCUYuMQB0xnQu1ZW+QrX5FeLuJfv WxT+lEqnKyCPeBDgcVEUSiGXU4ny8wgj3GSP8uQlc3+SjyMrWt1bHeTQ+t2y3+AIzN9T bN1aEMaHrIX9ghHYUdPEt9Bg3bVxUxIkowFrYfMLFKd18h84L6UWJXB70mez2X/IcO0l kCpQ== 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=ccO6i/CrLNB/1hRTv+cmP5s4CPs5jAZGF6O5V3FqXLQ=; b=C9FhBWQgNvXidRzRrUIv+AzFwcDCf2J1tz/reKAxNzoGlGo8ca8pWbxUFbMynh7cq8 upj2w/aqCgAjlXbbp7kUPvNvvArUTySfEjHDbCyuFDVBn+l+i6Q5Q1RMTHKs7mTiHTeH YoMG+YR/VrXd9IxDSbGGmO6wFbOU8kunVwqCMYRvOc+z/RgULjbfaxeVTK++h/wy3QTq kGQkSHOYOdpNjbTlgD18fPCgv5xqZozRGTDx+Z86OyXQwS9qKi4zi5L8yVDOLw+yq7Xi 9s+N1AX6RV799Bv5lodgRF2KzfTzIXBZxFFtOPyi/hZN1snSsM0eKIQmT3CHy4c7rfyl RRhw== X-Gm-Message-State: AHPjjUgTazPOS9qMDgA/tUvBNhq5+iVrgRvbDDymsvAXPm2OQrgFno0I l+Aa7ltm7111f2X+4xUj2meO7kEThCo= X-Google-Smtp-Source: AOwi7QB8dgokGev7Zzf7vqlc9tOa9KsW21dH4KabPP2VNQQhWzVcFgOhyPQ3MKwsr9/E5T9CdeF4Vw== X-Received: by 10.25.39.202 with SMTP id n193mr2838886lfn.131.1506371939924; Mon, 25 Sep 2017 13:38:59 -0700 (PDT) Received: from localhost (mobile-access-5d6a60-234.dhcp.inet.fi. [93.106.96.234]) by smtp.gmail.com with ESMTPSA id p4sm1580444ljp.33.2017.09.25.13.38.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 13:38:59 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 09/24] test: use source and build paths in test-lib-common.sh Date: Mon, 25 Sep 2017 23:38:25 +0300 Message-Id: <1988a894a787961cb1e98e06b10e169992354f49.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:04 -0000 Make a distinction between source and build directories. The expectation is that anyone sourcing test-lib-common.sh has sourced export-dirs.sh. --- test/test-lib-common.sh | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh index 984a7c1a5798..5133917dae9a 100644 --- a/test/test-lib-common.sh +++ b/test/test-lib-common.sh @@ -24,39 +24,26 @@ # type die >/dev/null 2>&1 || die () { echo "$@" >&2; exit 1; } -find_notmuch_path () -{ - dir="$1" - - while [ -n "$dir" ]; do - bin="$dir/notmuch" - if [ -x "$bin" ]; then - echo "$dir" - return - fi - dir="$(dirname "$dir")" - if [ "$dir" = "/" ]; then - break - fi - done -} +if [[ -z "$NOTMUCH_SRCDIR" ]] || [[ -z "$NOTMUCH_BUILDDIR" ]]; then + echo "internal: srcdir or builddir not set" >&2 + exit 1 +fi backup_database () { test_name=$(basename $0 .sh) - rm -rf notmuch-dir-backup."$test_name" - cp -pR ${MAIL_DIR}/.notmuch notmuch-dir-backup."${test_name}" + rm -rf $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."$test_name" + cp -pR ${MAIL_DIR}/.notmuch $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."${test_name}" } restore_database () { test_name=$(basename $0 .sh) rm -rf ${MAIL_DIR}/.notmuch - cp -pR notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch + cp -pR $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch } # Test the binaries we have just built. The tests are kept in # test/ subdirectory and are run in 'trash directory' subdirectory. -TEST_DIRECTORY=$(pwd -P) -notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"` +TEST_DIRECTORY=$NOTMUCH_BUILDDIR/test # Prepend $TEST_DIRECTORY/../lib to LD_LIBRARY_PATH, to make tests work # on systems where ../notmuch depends on LD_LIBRARY_PATH. @@ -64,11 +51,11 @@ LD_LIBRARY_PATH=${TEST_DIRECTORY%/*}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH # configure output -. $notmuch_path/sh.config || exit 1 +. "$NOTMUCH_BUILDDIR/sh.config" || exit 1 # load OS specifics -if [ -e ./test-lib-$PLATFORM.sh ]; then - . ./test-lib-$PLATFORM.sh || exit 1 +if [[ -e "$NOTMUCH_SRCDIR/test/test-lib-$PLATFORM.sh" ]]; then + . "$NOTMUCH_SRCDIR/test/test-lib-$PLATFORM.sh" || exit 1 fi # Generate a new message in the mail directory, with a unique message @@ -308,12 +295,12 @@ then PATH=$GIT_VALGRIND/bin:$PATH GIT_EXEC_PATH=$GIT_VALGRIND/bin export GIT_VALGRIND - test -n "$notmuch_path" && MANPATH="$notmuch_path/doc/_build/man" + test -n "$NOTMUCH_BUILDDIR" && MANPATH="$NOTMUCH_BUILDDIR/doc/_build/man" else # normal case - if test -n "$notmuch_path" + if test -n "$NOTMUCH_BUILDDIR" then - PATH="$notmuch_path:$PATH" - MANPATH="$notmuch_path/doc/_build/man" + PATH="$NOTMUCH_BUILDDIR:$PATH" + MANPATH="$NOTMUCH_BUILDDIR/doc/_build/man" fi fi export PATH MANPATH -- 2.11.0