From afe6cd52897ea97f451a097623aedc91b99b46de Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 12 Mar 2014 19:26:04 +0200 Subject: [PATCH] [PATCH v2] test: conditionally test compact depending on configured support --- 11/e4becff75cb8a01e0ac59701e0e9c96ea47276 | 123 ++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 11/e4becff75cb8a01e0ac59701e0e9c96ea47276 diff --git a/11/e4becff75cb8a01e0ac59701e0e9c96ea47276 b/11/e4becff75cb8a01e0ac59701e0e9c96ea47276 new file mode 100644 index 000000000..60f67042f --- /dev/null +++ b/11/e4becff75cb8a01e0ac59701e0e9c96ea47276 @@ -0,0 +1,123 @@ +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 B7452431FC0 + for ; Wed, 12 Mar 2014 10:26:16 -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 9xRj-h4cDmBA for ; + Wed, 12 Mar 2014 10:26:10 -0700 (PDT) +Received: from mail-la0-f45.google.com (mail-la0-f45.google.com + [209.85.215.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 8B950431FAE + for ; Wed, 12 Mar 2014 10:26:10 -0700 (PDT) +Received: by mail-la0-f45.google.com with SMTP id hr17so6982999lab.32 + for ; Wed, 12 Mar 2014 10:26:07 -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:in-reply-to + :references; + bh=lgV+kGYrhxJQEh5aMZa5Tr4QHZJ9mlxpvMYv2OrcRZ4=; + b=E6kTotguBqqPMDqbvhXx1nZYrxf6nff+mL4Y6vx0DqZTi3pkwt/9LlR6JWTVMwZeJp + KOSCBVigeZOS3gLVLJLb7IBTvxBh+snSOSAF8F3W/SAJbAZcJyZPnhW5/zu/inXdwgSS + OvlXM8mAo0H8RqoUd+kNkWA5s6DeIpBnc5QcrOXuLTDncs6CLlgUsnLSxmiWlfFIr9su + 3sh7HVmuK1KsLWmVfhv2wIdMvqnPs+dFZ4rpJPNrO/saMzp7ci9LruXm88zDfUFvwo0Y + dulLSzDEarKul4xtx+0Rt6RDhUpyPykF1KPnBeO0VxcNXm6o4kM2P+rwtgK5ICQOO06e + Fgdw== +X-Gm-Message-State: + ALoCoQlnorOG5eilzmvt23suEtEumji/LcwwsLudjRNJlN0wPobUgQMLWnDKeILPOAwUJcE9jeWI +X-Received: by 10.152.225.70 with SMTP id ri6mr32641415lac.26.1394645167570; + Wed, 12 Mar 2014 10:26:07 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) + by mx.google.com with ESMTPSA id u4sm4907707laj.2.2014.03.12.10.26.05 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Wed, 12 Mar 2014 10:26:05 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v2] test: conditionally test compact depending on configured + support +Date: Wed, 12 Mar 2014 19:26:04 +0200 +Message-Id: <1394645164-23561-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.9.0 +In-Reply-To: +References: +Cc: Tomi Ollila +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: Wed, 12 Mar 2014 17:26:16 -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 | 8 ++++++++ + test/T020-compact.sh | 11 +++++++++++ + 2 files changed, 19 insertions(+) + +diff --git a/test/Makefile.local b/test/Makefile.local +index 36b1c1b71de0..781420164105 100644 +--- a/test/Makefile.local ++++ b/test/Makefile.local +@@ -35,9 +35,17 @@ $(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) ++ ln -sf /bin/true $@ ++else ++ ln -sf /bin/false $@ ++endif ++ + .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 + -- 2.26.2