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 B5E95431FBF for ; Tue, 11 Mar 2014 12:24:18 -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 EnAAT3vW-iZf for ; Tue, 11 Mar 2014 12:24:12 -0700 (PDT) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9627C431FBD for ; Tue, 11 Mar 2014 12:24:12 -0700 (PDT) Received: by mail-ee0-f49.google.com with SMTP id c41so3885344eek.22 for ; Tue, 11 Mar 2014 12:24:11 -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=MJZyN6EtlwKqbdzgIKTq3zrqHqIzN6UQvabf0niW3yY=; b=LGhk6htCfihKmr/rSqpKdLqOqpy5I+3SGf/JXyrjjwGZg39KIQKI5bsVXTIAlNXCB8 yVGFoqlIXLyFpY+FnOjR1U1DXuFqQB5fBKxIvVAUgQ6Q/9pIH27LyOxsOcmXVHebgPUe Kp2ASsXZ9QWOyfd9NElpE/d85itIN5nP/9gX/e3CXULO2fqBdkUCrTQ0MwfEVs+eGI4A HGfiYigsmDdpDW/vZLV/nD03Bef1+vFUWNZitMKQynbnZyAWyWdkw5NrWMZ58sA0mgxT GObBS8q8ZKrlSWbspRwDnFomzlcmQPEkz3QT2BEzNjsnq4ZnjpMCyNI63QvxICzYWtR5 vB6w== X-Gm-Message-State: ALoCoQnGoSyvkQYyC7pR092e4LA/GbyHFCsx8LB9crtRvO3AhMXyFsUin2QtoQDIUEhtbJqWGsQN X-Received: by 10.15.41.140 with SMTP id s12mr43313483eev.4.1394565849909; Tue, 11 Mar 2014 12:24:09 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id cb5sm60793104eeb.18.2014.03.11.12.24.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 11 Mar 2014 12:24:09 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH] test: conditionally test compact depending on configured support Date: Tue, 11 Mar 2014 21:24:07 +0200 Message-Id: <1394565847-26795-1-git-send-email-jani@nikula.org> X-Mailer: git-send-email 1.9.0 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: Tue, 11 Mar 2014 19:24:18 -0000 I still have one machine with old enough Xapian to not have compaction support. Make the tests check for unsupported compact operation when compact is not available. --- test/Makefile.local | 9 +++++++++ test/T020-compact.sh | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/test/Makefile.local b/test/Makefile.local index 36b1c1b71de0..8befa40dfaa4 100644 --- a/test/Makefile.local +++ b/test/Makefile.local @@ -35,9 +35,18 @@ $(dir)/symbol-test: $(dir)/symbol-test.o lib/$(LINKER_NAME) $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o $(call quiet,CC) $^ -o $@ +$(dir)/have-compact: Makefile.config +ifeq ($(HAVE_XAPIAN_COMPACT),1) + echo -n "#!/bin/sh\nexit 0\n" > $@ +else + echo -n "#!/bin/sh\nexit 1\n" > $@ +endif + chmod +x $@ + .PHONY: test check TEST_BINARIES=$(dir)/arg-test \ + $(dir)/have-compact \ $(dir)/hex-xcode \ $(dir)/random-corpus \ $(dir)/parse-time \ diff --git a/test/T020-compact.sh b/test/T020-compact.sh index ac174cec7111..77bb9632cb11 100755 --- a/test/T020-compact.sh +++ b/test/T020-compact.sh @@ -10,6 +10,17 @@ notmuch tag +tag1 \* notmuch tag +tag2 subject:Two notmuch tag -tag1 +tag3 subject:Three +if ! ${TEST_DIRECTORY}/have-compact; then + test_begin_subtest "Compact unsupported: error message" + output=$(notmuch compact --quiet 2>&1) + test_expect_equal "$output" "notmuch was compiled against a xapian version lacking compaction support. +Compaction failed: Unsupported operation" + + test_expect_code 1 "Compact unsupported: status code" "notmuch compact" + + test_done +fi + test_expect_success "Running compact" "notmuch compact --backup=${TEST_DIRECTORY}/xapian.old" test_begin_subtest "Compact preserves database" -- 1.9.0