From f68e776617175fe77cbd7b29ce0fb2a1011117a8 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Fri, 8 Apr 2016 22:54:46 -0300 Subject: [PATCH] test: add test-binary to print the number of ghost messages This one-liner seems preferable to the complications of depending on delve, getting the binary name right and parsing the output. --- test/.gitignore | 1 + test/Makefile.local | 4 ++++ test/ghost-report.cc | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 test/ghost-report.cc diff --git a/test/.gitignore b/test/.gitignore index 0f7d5bfc..0579feef 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -7,4 +7,5 @@ smtp-dummy symbol-test make-db-version test-results +ghost-report tmp.* diff --git a/test/Makefile.local b/test/Makefile.local index 30d420e5..022f2cf7 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 00000000..3e1b07c6 --- /dev/null +++ b/test/ghost-report.cc @@ -0,0 +1,14 @@ +#include +#include +#include + +int main(int argc, char **argv) { + + if (argc < 2) { + std::cerr << "usage: ghost-report xapian-dir" << std::endl; + exit(1); + } + + Xapian::Database db(argv[1]); + std::cout << db.get_termfreq("Tghost") << std::endl; +}