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 181E4431FBF for ; Tue, 11 Mar 2014 12:43:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 Hh8GAbmYRtuc for ; Tue, 11 Mar 2014 12:43:47 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 6DB84431FBD for ; Tue, 11 Mar 2014 12:43:47 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id EC68610008C; Tue, 11 Mar 2014 21:43:42 +0200 (EET) From: Tomi Ollila To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH] test: conditionally test compact depending on configured support In-Reply-To: <1394565847-26795-1-git-send-email-jani@nikula.org> References: <1394565847-26795-1-git-send-email-jani@nikula.org> User-Agent: Notmuch/0.17+112~g4e0c1d5 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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:43:55 -0000 On Tue, Mar 11 2014, Jani Nikula wrote: > 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 $@ > + printf '$#/bin/sh\nexit1\n' ... ... as '\n' expansion is not portable (bash by default do not expand, dash does) alternative: $(dir)/have-compact: Makefile.config ifeq ($(HAVE_XAPIAN_COMPACT),1) ln -s /bin/true $@ else ln -s /bin/false $@ endif this is soo much faster ;) 1) no shell needed in make 2) no shell needs to be executed when running have-compact otherwise LGTM. Tomi > .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