Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 772456DE091B for ; Fri, 8 Apr 2016 18:55:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.000] 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 UvAKsJwIhDTm for ; Fri, 8 Apr 2016 18:55:31 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108]) by arlo.cworth.org (Postfix) with ESMTP id 537FF6DE034D for ; Fri, 8 Apr 2016 18:55:09 -0700 (PDT) Received: from fifthhorseman.net (unknown [201.140.212.132]) by che.mayfirst.org (Postfix) with ESMTPSA id 83C8310071; Fri, 8 Apr 2016 21:55:06 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id 48F332003D; Fri, 8 Apr 2016 22:54:52 -0300 (ART) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH v4 1/7] test: add test-binary to print the number of ghost messages Date: Fri, 8 Apr 2016 22:54:46 -0300 Message-Id: <1460166892-29721-1-git-send-email-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1459445693-3900-1-git-send-email-dkg@fifthhorseman.net> References: <1459445693-3900-1-git-send-email-dkg@fifthhorseman.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 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: Sat, 09 Apr 2016 01:55:39 -0000 From: David Bremner This one-liner seems preferable to the complications of depending on delve, getting the binary name right and parsing the output. --- test/Makefile.local | 4 ++++ test/ghost-report.cc | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/ghost-report.cc diff --git a/test/Makefile.local b/test/Makefile.local index 30d420e..022f2cf 100644 --- a/test/Makefile.local +++ b/test/Makefile.local @@ -38,6 +38,9 @@ $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o $(dir)/make-db-version: $(dir)/make-db-version.o $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(XAPIAN_LDFLAGS) +$(dir)/ghost-report: $(dir)/ghost-report.o + $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(XAPIAN_LDFLAGS) + .PHONY: test check test_main_srcs=$(dir)/arg-test.c \ @@ -47,6 +50,7 @@ test_main_srcs=$(dir)/arg-test.c \ $(dir)/smtp-dummy.c \ $(dir)/symbol-test.cc \ $(dir)/make-db-version.cc \ + $(dir)/ghost-report.cc test_srcs=$(test_main_srcs) $(dir)/database-test.c diff --git a/test/ghost-report.cc b/test/ghost-report.cc new file mode 100644 index 0000000..1739be4 --- /dev/null +++ b/test/ghost-report.cc @@ -0,0 +1,12 @@ +#include +#include + +int main(int argc, char **argv) { + + if (argc < 2) { + std::cerr << "usage: ghost-report xapian-dir" << std::endl; + } + + Xapian::Database db(argv[1]); + std::cout << db.get_termfreq("Tghost") << std::endl; +} -- 2.8.0.rc3