xapian-core
1.4.26
|
tests which need a writable backend More...
#include <config.h>
#include "api_wrdb.h"
#include <xapian.h>
#include "filetests.h"
#include "omassert.h"
#include "str.h"
#include "stringutils.h"
#include "testsuite.h"
#include "testutils.h"
#include "unixcmds.h"
#include "apitest.h"
#include "safeunistd.h"
#include <cmath>
#include <cstdlib>
#include <limits>
#include <map>
#include <string>
Go to the source code of this file.
Functions | |
DEFINE_TESTCASE (adddoc1, writable) | |
DEFINE_TESTCASE (adddoc2, writable) | |
DEFINE_TESTCASE (adddoc3, writable) | |
DEFINE_TESTCASE (adddoc4, writable) | |
DEFINE_TESTCASE (adddoc5, writable) | |
DEFINE_TESTCASE (adddoc6, writable) | |
DEFINE_TESTCASE (implicitendsession1, writable) | |
DEFINE_TESTCASE (databaseassign1, writable) | |
DEFINE_TESTCASE (deldoc1, writable) | |
DEFINE_TESTCASE (deldoc2, writable) | |
DEFINE_TESTCASE (deldoc3, writable) | |
DEFINE_TESTCASE (deldoc4, writable) | |
DEFINE_TESTCASE (deldoc5, writable) | |
DEFINE_TESTCASE (deldoc6, writable) | |
DEFINE_TESTCASE (replacedoc1, writable) | |
DEFINE_TESTCASE (replacedoc2, writable) | |
DEFINE_TESTCASE (replacedoc3, writable) | |
DEFINE_TESTCASE (replacedoc4, writable) | |
DEFINE_TESTCASE (replacedoc5, writable) | |
DEFINE_TESTCASE (replacedoc6, writable) | |
DEFINE_TESTCASE (uniqueterm1, writable) | |
DEFINE_TESTCASE (allpostlist2, writable) | |
static void | test_emptyterm2_helper (Xapian::WritableDatabase &db) |
DEFINE_TESTCASE (emptyterm2, writable) | |
DEFINE_TESTCASE (phraseorneartoand1, backend) | |
static void | gen_longpositionlist1_db (Xapian::WritableDatabase &db, const string &) |
DEFINE_TESTCASE (longpositionlist1, backend) | |
static void | gen_consistency2_db (Xapian::WritableDatabase &db, const string &) |
DEFINE_TESTCASE (consistency2, backend) | |
DEFINE_TESTCASE (crashrecovery1, chert) | |
DEFINE_TESTCASE (nomoredocids1, writable) | |
DEFINE_TESTCASE (synonymitor1, writable &&synonyms) | |
DEFINE_TESTCASE (termtoolong1, writable) | |
DEFINE_TESTCASE (postlist7, writable) | |
Test playing with a postlist. More... | |
static void | gen_lazytablebug1_db (Xapian::WritableDatabase &db, const string &) |
DEFINE_TESTCASE (lazytablebug1, synonyms) | |
DEFINE_TESTCASE (cursordelbug1, writable &&path) | |
Regression test for bug #287 for flint. More... | |
static void | check_vals (const Xapian::Database &db, const map< Xapian::docid, string > &vals) |
Helper function for modifyvalues1. More... | |
DEFINE_TESTCASE (modifyvalues1, writable) | |
Regression test for bug in initial streaming values implementation in chert. More... | |
DEFINE_TESTCASE (protocolbug1, remote &&writable) | |
Regression test for protocol design bug. More... | |
DEFINE_TESTCASE (remotefdleak1, remote &&writable) | |
tests which need a writable backend
Definition in file api_wrdb.cc.
|
static |
Helper function for modifyvalues1.
Check that the values stored in the database match
Definition at line 1956 of file api_wrdb.cc.
References Xapian::Database::get_doccount(), Xapian::Database::get_document(), Xapian::Database::get_lastdocid(), Xapian::Document::get_value(), TEST_EQUAL, TEST_NOT_EQUAL, TEST_REL, tout, Xapian::Document::values_begin(), Xapian::Document::values_count(), and Xapian::Document::values_end().
Referenced by DEFINE_TESTCASE().
DEFINE_TESTCASE | ( | adddoc1 | , |
writable | |||
) |
Definition at line 57 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Enquire::get_mset(), get_writable_database(), mset_expect_order(), query(), Xapian::Document::set_data(), and Xapian::Enquire::set_query().
DEFINE_TESTCASE | ( | adddoc2 | , |
writable | |||
) |
Definition at line 100 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::Database::get_document(), Xapian::TermIterator::get_termfreq(), Xapian::TermIterator::get_wdf(), get_writable_database(), Xapian::TermIterator::positionlist_begin(), Xapian::TermIterator::positionlist_end(), Xapian::Document::remove_posting(), Xapian::Document::remove_term(), Xapian::Database::size(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | adddoc3 | , |
writable | |||
) |
Definition at line 292 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), and get_writable_database().
DEFINE_TESTCASE | ( | adddoc4 | , |
writable | |||
) |
Definition at line 310 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::Database::get_document(), get_writable_database(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | adddoc5 | , |
writable | |||
) |
Definition at line 338 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_value(), Xapian::WritableDatabase::delete_document(), FAIL_TEST, Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Document::get_data(), Xapian::Database::get_doccount(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), get_writable_database_as_database(), Xapian::Document::set_data(), Xapian::Database::size(), SKIP_TEST_FOR_BACKEND, Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST_EQUAL, TEST_EXCEPTION, TEST_NOT_EQUAL, Xapian::Document::values_begin(), and Xapian::Document::values_end().
DEFINE_TESTCASE | ( | adddoc6 | , |
writable | |||
) |
Definition at line 479 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_value(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_termfreq(), get_writable_database(), get_writable_database_again(), Xapian::Document::remove_term(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), SKIP_TEST_FOR_BACKEND, and TEST_EQUAL.
DEFINE_TESTCASE | ( | implicitendsession1 | , |
writable | |||
) |
Definition at line 522 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), get_writable_database(), and Xapian::Document::set_data().
DEFINE_TESTCASE | ( | databaseassign1 | , |
writable | |||
) |
Definition at line 536 of file api_wrdb.cc.
References get_database(), and get_writable_database().
DEFINE_TESTCASE | ( | deldoc1 | , |
writable | |||
) |
Definition at line 564 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_document(), get_writable_database(), Xapian::Document::remove_term(), Xapian::WritableDatabase::replace_document(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST_EQUAL, TEST_EXCEPTION, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | deldoc2 | , |
writable | |||
) |
Definition at line 609 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), Xapian::WritableDatabase::commit(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_doclength(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), Xapian::Database::get_unique_terms(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), Xapian::Database::reopen(), Xapian::Database::term_exists(), Xapian::Database::termlist_begin(), TEST, TEST_EQUAL, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | deldoc3 | , |
writable | |||
) |
Definition at line 689 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), Xapian::WritableDatabase::commit(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_doclength(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), Xapian::Database::get_unique_terms(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Database::reopen(), Xapian::Database::term_exists(), Xapian::Database::termlist_begin(), TEST, TEST_EQUAL, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | deldoc4 | , |
writable | |||
) |
Definition at line 739 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), Xapian::WritableDatabase::commit(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_doclength(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), Xapian::Database::get_unique_terms(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), Xapian::Database::reopen(), Xapian::Database::term_exists(), Xapian::Database::termlist_begin(), TEST, TEST_EQUAL, TEST_EXCEPTION, and tout.
DEFINE_TESTCASE | ( | deldoc5 | , |
writable | |||
) |
Definition at line 825 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), TEST_EQUAL, TEST_EXCEPTION, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | deldoc6 | , |
writable | |||
) |
Definition at line 870 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_document(), get_writable_database(), Xapian::Document::remove_term(), TEST_EQUAL, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | replacedoc1 | , |
writable | |||
) |
Definition at line 898 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::get_document(), get_writable_database(), Xapian::TermIterator::positionlist_begin(), Xapian::WritableDatabase::replace_document(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | replacedoc2 | , |
writable | |||
) |
Definition at line 943 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::get_doccount(), Xapian::Database::get_document(), get_writable_database(), Xapian::TermIterator::positionlist_begin(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::WritableDatabase::replace_document(), TEST, TEST_EQUAL, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | replacedoc3 | , |
writable | |||
) |
Definition at line 999 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::Database::get_doclength(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), Xapian::Database::get_unique_terms(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), Xapian::WritableDatabase::replace_document(), TEST_EQUAL, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | replacedoc4 | , |
writable | |||
) |
Definition at line 1071 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), Xapian::WritableDatabase::replace_document(), TEST_EQUAL, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | replacedoc5 | , |
writable | |||
) |
Definition at line 1131 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::Database::get_document(), get_writable_database(), Xapian::Database::has_positions(), Xapian::Database::positionlist_begin(), Xapian::Database::positionlist_end(), Xapian::WritableDatabase::replace_document(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | replacedoc6 | , |
writable | |||
) |
Definition at line 1186 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_value(), Xapian::WritableDatabase::commit(), Xapian::Database::get_document(), Xapian::Document::get_value(), get_writable_database(), Xapian::WritableDatabase::replace_document(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | uniqueterm1 | , |
writable | |||
) |
Definition at line 1223 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_doccount(), get_writable_database(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), Xapian::Internal::str(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | allpostlist2 | , |
writable | |||
) |
Definition at line 1276 of file api_wrdb.cc.
References Xapian::WritableDatabase::delete_document(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::PostingIterator::skip_to(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | emptyterm2 | , |
writable | |||
) |
Definition at line 1327 of file api_wrdb.cc.
References Xapian::WritableDatabase::delete_document(), Xapian::Database::get_doccount(), get_writable_database(), test_emptyterm2_helper(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | phraseorneartoand1 | , |
backend | |||
) |
Definition at line 1361 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), get_database(), Xapian::Query::OP_NEAR, Xapian::Query::OP_PHRASE, Xapian::Document::set_data(), Xapian::MSet::size(), Xapian::Internal::str(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | longpositionlist1 | , |
backend | |||
) |
Definition at line 1420 of file api_wrdb.cc.
References gen_longpositionlist1_db(), get_database(), Xapian::Database::get_document(), Xapian::TermIterator::positionlist_begin(), Xapian::TermIterator::positionlist_end(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | consistency2 | , |
backend | |||
) |
Definition at line 1525 of file api_wrdb.cc.
References gen_consistency2_db(), get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value_then_relevance(), Xapian::MSet::size(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | crashrecovery1 | , |
chert | |||
) |
Definition at line 1552 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::commit(), Xapian::DB_OPEN, file_exists(), get_dbtype(), Xapian::Database::get_doccount(), get_writable_database(), get_writable_database_as_database(), Xapian::Database::reopen(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | nomoredocids1 | , |
writable | |||
) |
Definition at line 1642 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), get_writable_database(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), SKIP_TEST_FOR_BACKEND, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | synonymitor1 | , |
writable && | synonyms | ||
) |
Definition at line 1665 of file api_wrdb.cc.
References Xapian::Database::add_database(), Xapian::WritableDatabase::add_synonym(), Xapian::WritableDatabase::clear_synonyms(), Xapian::WritableDatabase::commit(), get_database(), get_writable_database(), Xapian::WritableDatabase::remove_synonym(), Xapian::Database::synonym_keys_begin(), Xapian::Database::synonym_keys_end(), Xapian::Database::synonyms_begin(), Xapian::Database::synonyms_end(), TEST, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | termtoolong1 | , |
writable | |||
) |
Definition at line 1778 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), endswith(), get_dbtype(), Xapian::Error::get_msg(), get_writable_database(), SKIP_TEST_FOR_BACKEND, Xapian::Internal::str(), TEST, TEST_AND_EXPLAIN, tout, and XFAIL().
DEFINE_TESTCASE | ( | postlist7 | , |
writable | |||
) |
Test playing with a postlist.
Definition at line 1851 of file api_wrdb.cc.
References Xapian::Document::add_term(), Xapian::PostingIterator::get_doclength(), Xapian::PostingIterator::get_unique_terms(), Xapian::PostingIterator::get_wdf(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::WritableDatabase::replace_document(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | lazytablebug1 | , |
synonyms | |||
) |
Definition at line 1910 of file api_wrdb.cc.
References gen_lazytablebug1_db(), get_database(), Xapian::Database::synonym_keys_begin(), Xapian::Database::synonym_keys_end(), and tout.
DEFINE_TESTCASE | ( | cursordelbug1 | , |
writable && | path | ||
) |
Regression test for bug #287 for flint.
Chert also has the same duff code but this testcase doesn't actually tickle the bug there.
Definition at line 1922 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::Database::check(), Xapian::WritableDatabase::commit(), Xapian::WritableDatabase::delete_document(), get_named_writable_database(), get_named_writable_database_path(), Xapian::Internal::str(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | modifyvalues1 | , |
writable | |||
) |
Regression test for bug in initial streaming values implementation in chert.
Definition at line 1986 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_value(), check_vals(), Xapian::WritableDatabase::commit(), Xapian::Database::get_document(), get_writable_database(), Xapian::WritableDatabase::replace_document(), seed, Xapian::Internal::str(), and tout.
DEFINE_TESTCASE | ( | protocolbug1 | , |
remote && | writable | ||
) |
Regression test for protocol design bug.
Previously some messages didn't send a reply but could result in an exception being sent over the link. That exception would then get read as a response to the next message instead of its actual response so we'd be out of step.
This also affected MSG_DELETEDOCUMENTTERM, MSG_CANCEL, MSG_SETMETADATA and MSG_ADDSPELLING but it's harder to reliably trigger an exception from any of those.
See #783. Fixed in 1.4.12.
Definition at line 2098 of file api_wrdb.cc.
References Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), get_writable_database(), Xapian::WritableDatabase::replace_document(), and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | remotefdleak1 | , |
remote && | writable | ||
) |
Definition at line 2108 of file api_wrdb.cc.
References get_writable_database(), get_writable_database_again(), and TEST_EXCEPTION.
|
static |
Definition at line 1500 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), and Xapian::Document::add_value().
Referenced by DEFINE_TESTCASE().
|
static |
Definition at line 1895 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::add_synonym(), Xapian::Document::add_term(), and Xapian::WritableDatabase::commit().
Referenced by DEFINE_TESTCASE().
|
static |
Definition at line 1399 of file api_wrdb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), and Xapian::Document::set_data().
Referenced by DEFINE_TESTCASE().
|
static |
Definition at line 1316 of file api_wrdb.cc.
References Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_termfreq(), Xapian::Database::positionlist_begin(), Xapian::Database::term_exists(), TEST_EQUAL, and TEST_EXCEPTION.
Referenced by DEFINE_TESTCASE().