summaryrefslogtreecommitdiff
path: root/bdb/test/scr015
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/test/scr015')
-rw-r--r--bdb/test/scr015/README36
-rw-r--r--bdb/test/scr015/TestConstruct01.cpp330
-rw-r--r--bdb/test/scr015/TestConstruct01.testerr4
-rw-r--r--bdb/test/scr015/TestConstruct01.testout27
-rw-r--r--bdb/test/scr015/TestExceptInclude.cpp27
-rw-r--r--bdb/test/scr015/TestGetSetMethods.cpp91
-rw-r--r--bdb/test/scr015/TestKeyRange.cpp171
-rw-r--r--bdb/test/scr015/TestKeyRange.testin8
-rw-r--r--bdb/test/scr015/TestKeyRange.testout19
-rw-r--r--bdb/test/scr015/TestLogc.cpp101
-rw-r--r--bdb/test/scr015/TestLogc.testout1
-rw-r--r--bdb/test/scr015/TestSimpleAccess.cpp67
-rw-r--r--bdb/test/scr015/TestSimpleAccess.testout3
-rw-r--r--bdb/test/scr015/TestTruncate.cpp84
-rw-r--r--bdb/test/scr015/TestTruncate.testout6
-rw-r--r--bdb/test/scr015/chk.cxxtests71
-rw-r--r--bdb/test/scr015/ignore4
-rw-r--r--bdb/test/scr015/testall32
-rw-r--r--bdb/test/scr015/testone122
19 files changed, 0 insertions, 1204 deletions
diff --git a/bdb/test/scr015/README b/bdb/test/scr015/README
deleted file mode 100644
index 75a356eea06..00000000000
--- a/bdb/test/scr015/README
+++ /dev/null
@@ -1,36 +0,0 @@
-# $Id: README,v 1.1 2001/05/31 23:09:11 dda Exp $
-
-Use the scripts testall or testone to run all, or just one of the C++
-tests. You must be in this directory to run them. For example,
-
- $ export LIBS="-L/usr/include/BerkeleyDB/lib"
- $ export CXXFLAGS="-I/usr/include/BerkeleyDB/include"
- $ export LD_LIBRARY_PATH="/usr/include/BerkeleyDB/lib"
- $ ./testone TestAppendRecno
- $ ./testall
-
-The scripts will use c++ in your path. Set environment variables $CXX
-to override this. It will also honor any $CXXFLAGS and $LIBS
-variables that are set, except that -c are silently removed from
-$CXXFLAGS (since we do the compilation in one step).
-
-To run successfully, you will probably need to set $LD_LIBRARY_PATH
-to be the directory containing libdb_cxx-X.Y.so
-
-As an alternative, use the --prefix=<DIR> option, a la configure
-to set the top of the BerkeleyDB install directory. This forces
-the proper options to be added to $LIBS, $CXXFLAGS $LD_LIBRARY_PATH.
-For example,
-
- $ ./testone --prefix=/usr/include/BerkeleyDB TestAppendRecno
- $ ./testall --prefix=/usr/include/BerkeleyDB
-
-The test framework is pretty simple. Any <name>.cpp file in this
-directory that is not mentioned in the 'ignore' file represents a
-test. If the test is not compiled successfully, the compiler output
-is left in <name>.compileout . Otherwise, the java program is run in
-a clean subdirectory using as input <name>.testin, or if that doesn't
-exist, /dev/null. Output and error from the test run are put into
-<name>.out, <name>.err . If <name>.testout, <name>.testerr exist,
-they are used as reference files and any differences are reported.
-If either of the reference files does not exist, /dev/null is used.
diff --git a/bdb/test/scr015/TestConstruct01.cpp b/bdb/test/scr015/TestConstruct01.cpp
deleted file mode 100644
index 7ae328d458c..00000000000
--- a/bdb/test/scr015/TestConstruct01.cpp
+++ /dev/null
@@ -1,330 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2000-2002
- * Sleepycat Software. All rights reserved.
- *
- * $Id: TestConstruct01.cpp,v 1.5 2002/01/23 14:26:40 bostic Exp $
- */
-
-/*
- * Do some regression tests for constructors.
- * Run normally (without arguments) it is a simple regression test.
- * Run with a numeric argument, it repeats the regression a number
- * of times, to try to determine if there are memory leaks.
- */
-
-#ifndef NO_SYSTEM_INCLUDES
-#include <sys/types.h>
-
-#include <iostream.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#ifndef _MSC_VER
-#include <unistd.h>
-#endif
-#endif
-
-#include <iomanip.h>
-#include <db_cxx.h>
-
-#define ERR(a) \
- do { \
- cout << "FAIL: " << (a) << "\n"; sysexit(1); \
- } while (0)
-
-#define ERR2(a1,a2) \
- do { \
- cout << "FAIL: " << (a1) << ": " << (a2) << "\n"; sysexit(1); \
- } while (0)
-
-#define ERR3(a1,a2,a3) \
- do { \
- cout << "FAIL: " << (a1) << ": " << (a2) << ": " << (a3) << "\n"; sysexit(1); \
- } while (0)
-
-#define CHK(a) \
- do { \
- int _ret; \
- if ((_ret = (a)) != 0) { \
- ERR3("DB function " #a " has bad return", _ret, DbEnv::strerror(_ret)); \
- } \
- } while (0)
-
-#ifdef VERBOSE
-#define DEBUGOUT(a) cout << a << "\n"
-#else
-#define DEBUGOUT(a)
-#endif
-
-#define CONSTRUCT01_DBNAME "construct01.db"
-#define CONSTRUCT01_DBDIR "."
-#define CONSTRUCT01_DBFULLPATH (CONSTRUCT01_DBDIR "/" CONSTRUCT01_DBNAME)
-
-int itemcount; // count the number of items in the database
-
-// A good place to put a breakpoint...
-//
-void sysexit(int status)
-{
- exit(status);
-}
-
-void check_file_removed(const char *name, int fatal)
-{
- unlink(name);
-#if 0
- if (access(name, 0) == 0) {
- if (fatal)
- cout << "FAIL: ";
- cout << "File \"" << name << "\" still exists after run\n";
- if (fatal)
- sysexit(1);
- }
-#endif
-}
-
-// Check that key/data for 0 - count-1 are already present,
-// and write a key/data for count. The key and data are
-// both "0123...N" where N == count-1.
-//
-// For some reason on Windows, we need to open using the full pathname
-// of the file when there is no environment, thus the 'has_env'
-// variable.
-//
-void rundb(Db *db, int count, int has_env)
-{
- const char *name;
-
- if (has_env)
- name = CONSTRUCT01_DBNAME;
- else
- name = CONSTRUCT01_DBFULLPATH;
-
- db->set_error_stream(&cerr);
-
- // We don't really care about the pagesize, but we do want
- // to make sure adjusting Db specific variables works before
- // opening the db.
- //
- CHK(db->set_pagesize(1024));
- CHK(db->open(NULL, name, NULL, DB_BTREE, count ? 0 : DB_CREATE, 0664));
-
- // The bit map of keys we've seen
- long bitmap = 0;
-
- // The bit map of keys we expect to see
- long expected = (1 << (count+1)) - 1;
-
- char outbuf[10];
- int i;
- for (i=0; i<count; i++) {
- outbuf[i] = '0' + i;
- }
- outbuf[i++] = '\0';
- Dbt key(outbuf, i);
- Dbt data(outbuf, i);
-
- DEBUGOUT("Put: " << outbuf);
- CHK(db->put(0, &key, &data, DB_NOOVERWRITE));
-
- // Acquire a cursor for the table.
- Dbc *dbcp;
- CHK(db->cursor(NULL, &dbcp, 0));
-
- // Walk through the table, checking
- Dbt readkey;
- Dbt readdata;
- while (dbcp->get(&readkey, &readdata, DB_NEXT) == 0) {
- char *key_string = (char *)readkey.get_data();
- char *data_string = (char *)readdata.get_data();
- DEBUGOUT("Got: " << key_string << ": " << data_string);
- int len = strlen(key_string);
- long bit = (1 << len);
- if (len > count) {
- ERR("reread length is bad");
- }
- else if (strcmp(data_string, key_string) != 0) {
- ERR("key/data don't match");
- }
- else if ((bitmap & bit) != 0) {
- ERR("key already seen");
- }
- else if ((expected & bit) == 0) {
- ERR("key was not expected");
- }
- else {
- bitmap |= bit;
- expected &= ~(bit);
- for (i=0; i<len; i++) {
- if (key_string[i] != ('0' + i)) {
- cout << " got " << key_string
- << " (" << (int)key_string[i] << ")"
- << ", wanted " << i
- << " (" << (int)('0' + i) << ")"
- << " at position " << i << "\n";
- ERR("key is corrupt");
- }
- }
- }
- }
- if (expected != 0) {
- cout << " expected more keys, bitmap is: " << expected << "\n";
- ERR("missing keys in database");
- }
- CHK(dbcp->close());
- CHK(db->close(0));
-}
-
-void t1(int except_flag)
-{
- cout << " Running test 1:\n";
- Db db(0, except_flag);
- rundb(&db, itemcount++, 0);
- cout << " finished.\n";
-}
-
-void t2(int except_flag)
-{
- cout << " Running test 2:\n";
- Db db(0, except_flag);
- rundb(&db, itemcount++, 0);
- cout << " finished.\n";
-}
-
-void t3(int except_flag)
-{
- cout << " Running test 3:\n";
- Db db(0, except_flag);
- rundb(&db, itemcount++, 0);
- cout << " finished.\n";
-}
-
-void t4(int except_flag)
-{
- cout << " Running test 4:\n";
- DbEnv env(except_flag);
- CHK(env.open(CONSTRUCT01_DBDIR, DB_CREATE | DB_INIT_MPOOL, 0));
- Db db(&env, 0);
- CHK(db.close(0));
- CHK(env.close(0));
- cout << " finished.\n";
-}
-
-void t5(int except_flag)
-{
- cout << " Running test 5:\n";
- DbEnv env(except_flag);
- CHK(env.open(CONSTRUCT01_DBDIR, DB_CREATE | DB_INIT_MPOOL, 0));
- Db db(&env, 0);
- rundb(&db, itemcount++, 1);
- // Note we cannot reuse the old Db!
- Db anotherdb(&env, 0);
-
- anotherdb.set_errpfx("test5");
- rundb(&anotherdb, itemcount++, 1);
- CHK(env.close(0));
- cout << " finished.\n";
-}
-
-void t6(int except_flag)
-{
- cout << " Running test 6:\n";
-
- /* From user [#2939] */
- int err;
-
- DbEnv* penv = new DbEnv(DB_CXX_NO_EXCEPTIONS);
- penv->set_cachesize(0, 32 * 1024, 0);
- penv->open(CONSTRUCT01_DBDIR, DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL, 0);
-
- //LEAK: remove this block and leak disappears
- Db* pdb = new Db(penv,0);
- if ((err = pdb->close(0)) != 0) {
- fprintf(stderr, "Error closing Db: %s\n", db_strerror(err));
- }
- delete pdb;
- //LEAK: remove this block and leak disappears
-
- if ((err = penv->close(0)) != 0) {
- fprintf(stderr, "Error closing DbEnv: %s\n", db_strerror(err));
- }
- delete penv;
-
- // Make sure we get a message from C++ layer reminding us to close.
- cerr << "expected error: ";
- {
- DbEnv foo(DB_CXX_NO_EXCEPTIONS);
- foo.open(CONSTRUCT01_DBDIR, DB_CREATE, 0);
- }
- cerr << "should have received error.\n";
- cout << " finished.\n";
-}
-
-// remove any existing environment or database
-void removeall()
-{
- {
- DbEnv tmpenv(DB_CXX_NO_EXCEPTIONS);
- (void)tmpenv.remove(CONSTRUCT01_DBDIR, DB_FORCE);
- }
-
- check_file_removed(CONSTRUCT01_DBFULLPATH, 1);
- for (int i=0; i<8; i++) {
- char buf[20];
- sprintf(buf, "__db.00%d", i);
- check_file_removed(buf, 1);
- }
-}
-
-int doall(int except_flag)
-{
- itemcount = 0;
- try {
- // before and after the run, removing any
- // old environment/database.
- //
- removeall();
- t1(except_flag);
- t2(except_flag);
- t3(except_flag);
- t4(except_flag);
- t5(except_flag);
- t6(except_flag);
-
- removeall();
- return 0;
- }
- catch (DbException &dbe) {
- ERR2("EXCEPTION RECEIVED", dbe.what());
- }
- return 1;
-}
-
-int main(int argc, char *argv[])
-{
- int iterations = 1;
- if (argc > 1) {
- iterations = atoi(argv[1]);
- if (iterations < 0) {
- ERR("Usage: construct01 count");
- }
- }
- for (int i=0; i<iterations; i++) {
- if (iterations != 0) {
- cout << "(" << i << "/" << iterations << ") ";
- }
- cout << "construct01 running:\n";
- if (doall(DB_CXX_NO_EXCEPTIONS) != 0) {
- ERR("SOME TEST FAILED FOR NO-EXCEPTION TEST");
- }
- else if (doall(0) != 0) {
- ERR("SOME TEST FAILED FOR EXCEPTION TEST");
- }
- else {
- cout << "\nALL TESTS SUCCESSFUL\n";
- }
- }
- return 0;
-}
diff --git a/bdb/test/scr015/TestConstruct01.testerr b/bdb/test/scr015/TestConstruct01.testerr
deleted file mode 100644
index 1ba627d103b..00000000000
--- a/bdb/test/scr015/TestConstruct01.testerr
+++ /dev/null
@@ -1,4 +0,0 @@
-expected error: DbEnv::_destroy_check: open DbEnv object destroyed
-should have received error.
-expected error: DbEnv::_destroy_check: open DbEnv object destroyed
-should have received error.
diff --git a/bdb/test/scr015/TestConstruct01.testout b/bdb/test/scr015/TestConstruct01.testout
deleted file mode 100644
index 9b840f9fcf4..00000000000
--- a/bdb/test/scr015/TestConstruct01.testout
+++ /dev/null
@@ -1,27 +0,0 @@
-(0/1) construct01 running:
- Running test 1:
- finished.
- Running test 2:
- finished.
- Running test 3:
- finished.
- Running test 4:
- finished.
- Running test 5:
- finished.
- Running test 6:
- finished.
- Running test 1:
- finished.
- Running test 2:
- finished.
- Running test 3:
- finished.
- Running test 4:
- finished.
- Running test 5:
- finished.
- Running test 6:
- finished.
-
-ALL TESTS SUCCESSFUL
diff --git a/bdb/test/scr015/TestExceptInclude.cpp b/bdb/test/scr015/TestExceptInclude.cpp
deleted file mode 100644
index 28bc498222f..00000000000
--- a/bdb/test/scr015/TestExceptInclude.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 1997-2002
- * Sleepycat Software. All rights reserved.
- *
- * $Id: TestExceptInclude.cpp,v 1.4 2002/07/05 22:17:59 dda Exp $
- */
-
-/* We should be able to include cxx_except.h without db_cxx.h,
- * and use the DbException class. We do need db.h to get a few
- * typedefs defined that the DbException classes use.
- *
- * This program does nothing, it's just here to make sure
- * the compilation works.
- */
-#include <db.h>
-#include <cxx_except.h>
-
-int main(int argc, char *argv[])
-{
- DbException *dbe = new DbException("something");
- DbMemoryException *dbme = new DbMemoryException("anything");
-
- dbe = dbme;
-}
-
diff --git a/bdb/test/scr015/TestGetSetMethods.cpp b/bdb/test/scr015/TestGetSetMethods.cpp
deleted file mode 100644
index 81ef914eac3..00000000000
--- a/bdb/test/scr015/TestGetSetMethods.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2000-2002
- * Sleepycat Software. All rights reserved.
- *
- * $Id: TestGetSetMethods.cpp,v 1.4 2002/01/11 15:53:59 bostic Exp $
- */
-
-/*
- * Do some regression tests for simple get/set access methods
- * on DbEnv, DbTxn, Db. We don't currently test that they have
- * the desired effect, only that they operate and return correctly.
- */
-
-#include <db_cxx.h>
-#include <iostream.h>
-
-int main(int argc, char *argv[])
-{
- try {
- DbEnv *dbenv = new DbEnv(0);
- DbTxn *dbtxn;
- u_int8_t conflicts[10];
-
- dbenv->set_error_stream(&cerr);
- dbenv->set_timeout(0x90000000,
- DB_SET_LOCK_TIMEOUT);
- dbenv->set_lg_bsize(0x1000);
- dbenv->set_lg_dir(".");
- dbenv->set_lg_max(0x10000000);
- dbenv->set_lg_regionmax(0x100000);
- dbenv->set_lk_conflicts(conflicts, sizeof(conflicts));
- dbenv->set_lk_detect(DB_LOCK_DEFAULT);
- // exists, but is deprecated:
- // dbenv->set_lk_max(0);
- dbenv->set_lk_max_lockers(100);
- dbenv->set_lk_max_locks(10);
- dbenv->set_lk_max_objects(1000);
- dbenv->set_mp_mmapsize(0x10000);
- dbenv->set_tas_spins(1000);
-
- // Need to open the environment so we
- // can get a transaction.
- //
- dbenv->open(".", DB_CREATE | DB_INIT_TXN |
- DB_INIT_LOCK | DB_INIT_LOG |
- DB_INIT_MPOOL,
- 0644);
-
- dbenv->txn_begin(NULL, &dbtxn, DB_TXN_NOWAIT);
- dbtxn->set_timeout(0xA0000000, DB_SET_TXN_TIMEOUT);
- dbtxn->abort();
-
- dbenv->close(0);
-
- // We get a db, one for each type.
- // That's because once we call (for instance)
- // set_bt_maxkey, DB 'knows' that this is a
- // Btree Db, and it cannot be used to try Hash
- // or Recno functions.
- //
- Db *db_bt = new Db(NULL, 0);
- db_bt->set_bt_maxkey(10000);
- db_bt->set_bt_minkey(100);
- db_bt->set_cachesize(0, 0x100000, 0);
- db_bt->close(0);
-
- Db *db_h = new Db(NULL, 0);
- db_h->set_h_ffactor(0x10);
- db_h->set_h_nelem(100);
- db_h->set_lorder(0);
- db_h->set_pagesize(0x10000);
- db_h->close(0);
-
- Db *db_re = new Db(NULL, 0);
- db_re->set_re_delim('@');
- db_re->set_re_pad(10);
- db_re->set_re_source("re.in");
- db_re->close(0);
-
- Db *db_q = new Db(NULL, 0);
- db_q->set_q_extentsize(200);
- db_q->close(0);
-
- }
- catch (DbException &dbe) {
- cerr << "Db Exception: " << dbe.what() << "\n";
- }
- return 0;
-}
diff --git a/bdb/test/scr015/TestKeyRange.cpp b/bdb/test/scr015/TestKeyRange.cpp
deleted file mode 100644
index 980d2f518e0..00000000000
--- a/bdb/test/scr015/TestKeyRange.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*NOTE: AccessExample changed to test Db.key_range.
- * We made a global change of /AccessExample/TestKeyRange/,
- * the only other changes are marked with comments that
- * are notated as 'ADDED'.
- */
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 1997-2002
- * Sleepycat Software. All rights reserved.
- *
- * $Id: TestKeyRange.cpp,v 1.4 2002/01/23 14:26:41 bostic Exp $
- */
-
-#ifndef NO_SYSTEM_INCLUDES
-#include <sys/types.h>
-
-#include <iostream.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#ifndef _MSC_VER
-#include <unistd.h>
-#endif
-#endif
-
-#include <iomanip.h>
-#include <db_cxx.h>
-
-class TestKeyRange
-{
-public:
- TestKeyRange();
- void run();
-
-private:
- static const char FileName[];
-
- // no need for copy and assignment
- TestKeyRange(const TestKeyRange &);
- void operator = (const TestKeyRange &);
-};
-
-static void usage(); // forward
-
-int main(int argc, char *argv[])
-{
- if (argc > 1) {
- usage();
- }
-
- // Use a try block just to report any errors.
- // An alternate approach to using exceptions is to
- // use error models (see DbEnv::set_error_model()) so
- // that error codes are returned for all Berkeley DB methods.
- //
- try {
- TestKeyRange app;
- app.run();
- return 0;
- }
- catch (DbException &dbe) {
- cerr << "TestKeyRange: " << dbe.what() << "\n";
- return 1;
- }
-}
-
-static void usage()
-{
- cerr << "usage: TestKeyRange\n";
- exit(1);
-}
-
-const char TestKeyRange::FileName[] = "access.db";
-
-TestKeyRange::TestKeyRange()
-{
-}
-
-void TestKeyRange::run()
-{
- // Remove the previous database.
- (void)unlink(FileName);
-
- // Create the database object.
- // There is no environment for this simple example.
- Db db(0, 0);
-
- db.set_error_stream(&cerr);
- db.set_errpfx("TestKeyRange");
- db.set_pagesize(1024); /* Page size: 1K. */
- db.set_cachesize(0, 32 * 1024, 0);
- db.open(NULL, FileName, NULL, DB_BTREE, DB_CREATE, 0664);
-
- //
- // Insert records into the database, where the key is the user
- // input and the data is the user input in reverse order.
- //
- char buf[1024];
- char rbuf[1024];
- char *t;
- char *p;
- int ret;
- int len;
- Dbt *firstkey = NULL;
- char firstbuf[1024];
-
- for (;;) {
- cout << "input>";
- cout.flush();
-
- cin.getline(buf, sizeof(buf));
- if (cin.eof())
- break;
-
- if ((len = strlen(buf)) <= 0)
- continue;
- for (t = rbuf, p = buf + (len - 1); p >= buf;)
- *t++ = *p--;
- *t++ = '\0';
-
- Dbt key(buf, len + 1);
- Dbt data(rbuf, len + 1);
- if (firstkey == NULL) {
- strcpy(firstbuf, buf);
- firstkey = new Dbt(firstbuf, len + 1);
- }
-
- ret = db.put(0, &key, &data, DB_NOOVERWRITE);
- if (ret == DB_KEYEXIST) {
- cout << "Key " << buf << " already exists.\n";
- }
- cout << "\n";
- }
-
- // We put a try block around this section of code
- // to ensure that our database is properly closed
- // in the event of an error.
- //
- try {
- // Acquire a cursor for the table.
- Dbc *dbcp;
- db.cursor(NULL, &dbcp, 0);
-
- /*ADDED...*/
- DB_KEY_RANGE range;
- memset(&range, 0, sizeof(range));
-
- db.key_range(NULL, firstkey, &range, 0);
- printf("less: %f\n", range.less);
- printf("equal: %f\n", range.equal);
- printf("greater: %f\n", range.greater);
- /*end ADDED*/
-
- Dbt key;
- Dbt data;
-
- // Walk through the table, printing the key/data pairs.
- while (dbcp->get(&key, &data, DB_NEXT) == 0) {
- char *key_string = (char *)key.get_data();
- char *data_string = (char *)data.get_data();
- cout << key_string << " : " << data_string << "\n";
- }
- dbcp->close();
- }
- catch (DbException &dbe) {
- cerr << "TestKeyRange: " << dbe.what() << "\n";
- }
-
- db.close(0);
-}
diff --git a/bdb/test/scr015/TestKeyRange.testin b/bdb/test/scr015/TestKeyRange.testin
deleted file mode 100644
index a2b6bd74e7b..00000000000
--- a/bdb/test/scr015/TestKeyRange.testin
+++ /dev/null
@@ -1,8 +0,0 @@
-first line is alphabetically somewhere in the middle.
-Blah blah
-let's have exactly eight lines of input.
-stuff
-more stuff
-and even more stuff
-lastly
-but not leastly.
diff --git a/bdb/test/scr015/TestKeyRange.testout b/bdb/test/scr015/TestKeyRange.testout
deleted file mode 100644
index 25b2e1a835c..00000000000
--- a/bdb/test/scr015/TestKeyRange.testout
+++ /dev/null
@@ -1,19 +0,0 @@
-input>
-input>
-input>
-input>
-input>
-input>
-input>
-input>
-input>less: 0.375000
-equal: 0.125000
-greater: 0.500000
-Blah blah : halb halB
-and even more stuff : ffuts erom neve dna
-but not leastly. : .yltsael ton tub
-first line is alphabetically somewhere in the middle. : .elddim eht ni erehwemos yllacitebahpla si enil tsrif
-lastly : yltsal
-let's have exactly eight lines of input. : .tupni fo senil thgie yltcaxe evah s'tel
-more stuff : ffuts erom
-stuff : ffuts
diff --git a/bdb/test/scr015/TestLogc.cpp b/bdb/test/scr015/TestLogc.cpp
deleted file mode 100644
index 94fcfa0b3ec..00000000000
--- a/bdb/test/scr015/TestLogc.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2000-2002
- * Sleepycat Software. All rights reserved.
- *
- * $Id: TestLogc.cpp,v 1.6 2002/01/23 14:26:41 bostic Exp $
- */
-
-/*
- * A basic regression test for the Logc class.
- */
-
-#include <db_cxx.h>
-#include <iostream.h>
-
-static void show_dbt(ostream &os, Dbt *dbt)
-{
- int i;
- int size = dbt->get_size();
- unsigned char *data = (unsigned char *)dbt->get_data();
-
- os << "size: " << size << " data: ";
- for (i=0; i<size && i<10; i++) {
- os << (int)data[i] << " ";
- }
- if (i<size)
- os << "...";
-}
-
-int main(int argc, char *argv[])
-{
- try {
- DbEnv *env = new DbEnv(0);
- env->open(".", DB_CREATE | DB_INIT_LOG | DB_INIT_MPOOL, 0);
-
- // Do some database activity to get something into the log.
- Db *db1 = new Db(env, 0);
- db1->open(NULL, "first.db", NULL, DB_BTREE, DB_CREATE, 0);
- Dbt *key = new Dbt((char *)"a", 1);
- Dbt *data = new Dbt((char *)"b", 1);
- db1->put(NULL, key, data, 0);
- key->set_data((char *)"c");
- data->set_data((char *)"d");
- db1->put(NULL, key, data, 0);
- db1->close(0);
-
- Db *db2 = new Db(env, 0);
- db2->open(NULL, "second.db", NULL, DB_BTREE, DB_CREATE, 0);
- key->set_data((char *)"w");
- data->set_data((char *)"x");
- db2->put(NULL, key, data, 0);
- key->set_data((char *)"y");
- data->set_data((char *)"z");
- db2->put(NULL, key, data, 0);
- db2->close(0);
-
- // Now get a log cursor and walk through.
- DbLogc *logc;
-
- env->log_cursor(&logc, 0);
- int ret = 0;
- DbLsn lsn;
- Dbt *dbt = new Dbt();
- u_int32_t flags = DB_FIRST;
-
- int count = 0;
- while ((ret = logc->get(&lsn, dbt, flags)) == 0) {
-
- // We ignore the contents of the log record,
- // it's not portable. Even the exact count
- // is may change when the underlying implementation
- // changes, we'll just make sure at the end we saw
- // 'enough'.
- //
- // cout << "logc.get: " << count;
- // show_dbt(cout, dbt);
- // cout << "\n";
- //
- count++;
- flags = DB_NEXT;
- }
- if (ret != DB_NOTFOUND) {
- cerr << "*** FAIL: logc.get returned: "
- << DbEnv::strerror(ret) << "\n";
- }
- logc->close(0);
-
- // There has to be at *least* four log records,
- // since we did four separate database operations.
- //
- if (count < 4)
- cerr << "*** FAIL: not enough log records\n";
-
- cout << "TestLogc done.\n";
- }
- catch (DbException &dbe) {
- cerr << "*** FAIL: " << dbe.what() <<"\n";
- }
- return 0;
-}
diff --git a/bdb/test/scr015/TestLogc.testout b/bdb/test/scr015/TestLogc.testout
deleted file mode 100644
index afac3af7eda..00000000000
--- a/bdb/test/scr015/TestLogc.testout
+++ /dev/null
@@ -1 +0,0 @@
-TestLogc done.
diff --git a/bdb/test/scr015/TestSimpleAccess.cpp b/bdb/test/scr015/TestSimpleAccess.cpp
deleted file mode 100644
index 2450b9b3030..00000000000
--- a/bdb/test/scr015/TestSimpleAccess.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2000-2002
- * Sleepycat Software. All rights reserved.
- *
- * $Id: TestSimpleAccess.cpp,v 1.5 2002/01/23 14:26:41 bostic Exp $
- */
-
-/*
- * Do some regression tests for constructors.
- * Run normally (without arguments) it is a simple regression test.
- * Run with a numeric argument, it repeats the regression a number
- * of times, to try to determine if there are memory leaks.
- */
-
-#include <db_cxx.h>
-#include <iostream.h>
-
-int main(int argc, char *argv[])
-{
- try {
- Db *db = new Db(NULL, 0);
- db->open(NULL, "my.db", NULL, DB_BTREE, DB_CREATE, 0644);
-
- // populate our massive database.
- // all our strings include null for convenience.
- // Note we have to cast for idiomatic
- // usage, since newer gcc requires it.
- Dbt *keydbt = new Dbt((char *)"key", 4);
- Dbt *datadbt = new Dbt((char *)"data", 5);
- db->put(NULL, keydbt, datadbt, 0);
-
- // Now, retrieve. We could use keydbt over again,
- // but that wouldn't be typical in an application.
- Dbt *goodkeydbt = new Dbt((char *)"key", 4);
- Dbt *badkeydbt = new Dbt((char *)"badkey", 7);
- Dbt *resultdbt = new Dbt();
- resultdbt->set_flags(DB_DBT_MALLOC);
-
- int ret;
-
- if ((ret = db->get(NULL, goodkeydbt, resultdbt, 0)) != 0) {
- cout << "get: " << DbEnv::strerror(ret) << "\n";
- }
- else {
- char *result = (char *)resultdbt->get_data();
- cout << "got data: " << result << "\n";
- }
-
- if ((ret = db->get(NULL, badkeydbt, resultdbt, 0)) != 0) {
- // We expect this...
- cout << "get using bad key: "
- << DbEnv::strerror(ret) << "\n";
- }
- else {
- char *result = (char *)resultdbt->get_data();
- cout << "*** got data using bad key!!: "
- << result << "\n";
- }
- cout << "finished test\n";
- }
- catch (DbException &dbe) {
- cerr << "Db Exception: " << dbe.what();
- }
- return 0;
-}
diff --git a/bdb/test/scr015/TestSimpleAccess.testout b/bdb/test/scr015/TestSimpleAccess.testout
deleted file mode 100644
index dc88d4788e4..00000000000
--- a/bdb/test/scr015/TestSimpleAccess.testout
+++ /dev/null
@@ -1,3 +0,0 @@
-got data: data
-get using bad key: DB_NOTFOUND: No matching key/data pair found
-finished test
diff --git a/bdb/test/scr015/TestTruncate.cpp b/bdb/test/scr015/TestTruncate.cpp
deleted file mode 100644
index d5c0dc6de29..00000000000
--- a/bdb/test/scr015/TestTruncate.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2000-2002
- * Sleepycat Software. All rights reserved.
- *
- * $Id: TestTruncate.cpp,v 1.5 2002/01/23 14:26:41 bostic Exp $
- */
-
-/*
- * Do some regression tests for constructors.
- * Run normally (without arguments) it is a simple regression test.
- * Run with a numeric argument, it repeats the regression a number
- * of times, to try to determine if there are memory leaks.
- */
-
-#include <db_cxx.h>
-#include <iostream.h>
-
-int main(int argc, char *argv[])
-{
- try {
- Db *db = new Db(NULL, 0);
- db->open(NULL, "my.db", NULL, DB_BTREE, DB_CREATE, 0644);
-
- // populate our massive database.
- // all our strings include null for convenience.
- // Note we have to cast for idiomatic
- // usage, since newer gcc requires it.
- Dbt *keydbt = new Dbt((char*)"key", 4);
- Dbt *datadbt = new Dbt((char*)"data", 5);
- db->put(NULL, keydbt, datadbt, 0);
-
- // Now, retrieve. We could use keydbt over again,
- // but that wouldn't be typical in an application.
- Dbt *goodkeydbt = new Dbt((char*)"key", 4);
- Dbt *badkeydbt = new Dbt((char*)"badkey", 7);
- Dbt *resultdbt = new Dbt();
- resultdbt->set_flags(DB_DBT_MALLOC);
-
- int ret;
-
- if ((ret = db->get(NULL, goodkeydbt, resultdbt, 0)) != 0) {
- cout << "get: " << DbEnv::strerror(ret) << "\n";
- }
- else {
- char *result = (char *)resultdbt->get_data();
- cout << "got data: " << result << "\n";
- }
-
- if ((ret = db->get(NULL, badkeydbt, resultdbt, 0)) != 0) {
- // We expect this...
- cout << "get using bad key: "
- << DbEnv::strerror(ret) << "\n";
- }
- else {
- char *result = (char *)resultdbt->get_data();
- cout << "*** got data using bad key!!: "
- << result << "\n";
- }
-
- // Now, truncate and make sure that it's really gone.
- cout << "truncating data...\n";
- u_int32_t nrecords;
- db->truncate(NULL, &nrecords, 0);
- cout << "truncate returns " << nrecords << "\n";
- if ((ret = db->get(NULL, goodkeydbt, resultdbt, 0)) != 0) {
- // We expect this...
- cout << "after truncate get: "
- << DbEnv::strerror(ret) << "\n";
- }
- else {
- char *result = (char *)resultdbt->get_data();
- cout << "got data: " << result << "\n";
- }
-
- db->close(0);
- cout << "finished test\n";
- }
- catch (DbException &dbe) {
- cerr << "Db Exception: " << dbe.what();
- }
- return 0;
-}
diff --git a/bdb/test/scr015/TestTruncate.testout b/bdb/test/scr015/TestTruncate.testout
deleted file mode 100644
index 0a4bc98165d..00000000000
--- a/bdb/test/scr015/TestTruncate.testout
+++ /dev/null
@@ -1,6 +0,0 @@
-got data: data
-get using bad key: DB_NOTFOUND: No matching key/data pair found
-truncating data...
-truncate returns 1
-after truncate get: DB_NOTFOUND: No matching key/data pair found
-finished test
diff --git a/bdb/test/scr015/chk.cxxtests b/bdb/test/scr015/chk.cxxtests
deleted file mode 100644
index 5c21e27208c..00000000000
--- a/bdb/test/scr015/chk.cxxtests
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh -
-#
-# $Id: chk.cxxtests,v 1.5 2002/07/05 22:17:59 dda Exp $
-#
-# Check to make sure that regression tests for C++ run.
-
-TEST_CXX_SRCDIR=../test/scr015 # must be a relative directory
-
-# All paths must be relative to a subdirectory of the build directory
-LIBS="-L.. -ldb -ldb_cxx"
-CXXFLAGS="-I.. -I../../dbinc"
-
-# Test must be run from a local build directory, not from a test
-# directory.
-cd ..
-[ -f db_config.h ] || {
- echo 'FAIL: chk.cxxtests must be run from a local build directory.'
- exit 1
-}
-[ -d ../docs_src ] || {
- echo 'FAIL: chk.cxxtests must be run from a local build directory.'
- exit 1
-}
-[ -f libdb.a ] || make libdb.a || {
- echo 'FAIL: unable to build libdb.a'
- exit 1
-}
-[ -f libdb_cxx.a ] || make libdb_cxx.a || {
- echo 'FAIL: unable to build libdb_cxx.a'
- exit 1
-}
-CXX=`sed -e '/^CXX=/!d' -e 's/^CXX=//' -e 's/.*mode=compile *//' Makefile`
-echo " ====== cxx tests using $CXX"
-testnames=`cd $TEST_CXX_SRCDIR; ls *.cpp | sed -e 's/\.cpp$//'`
-
-for testname in $testnames; do
- if grep -x $testname $TEST_CXX_SRCDIR/ignore > /dev/null; then
- echo " **** cxx test $testname ignored"
- continue
- fi
-
- echo " ==== cxx test $testname"
- rm -rf TESTCXX; mkdir TESTCXX
- cd ./TESTCXX
- testprefix=../$TEST_CXX_SRCDIR/$testname
-
- ${CXX} ${CXXFLAGS} -o $testname $testprefix.cpp ${LIBS} > ../$testname.compileout 2>&1 || {
- echo "FAIL: compilation of $testname failed, see ../$testname.compileout"
- exit 1
- }
- rm -f ../$testname.compileout
- infile=$testprefix.testin
- [ -f $infile ] || infile=/dev/null
- goodoutfile=$testprefix.testout
- [ -f $goodoutfile ] || goodoutfile=/dev/null
- gooderrfile=$testprefix.testerr
- [ -f $gooderrfile ] || gooderrfile=/dev/null
- ./$testname <$infile >../$testname.out 2>../$testname.err
- cmp ../$testname.out $goodoutfile > /dev/null || {
- echo "FAIL: $testname output differs: see ../$testname.out, $goodoutfile"
- exit 1
- }
- cmp ../$testname.err $gooderrfile > /dev/null || {
- echo "FAIL: $testname error differs: see ../$testname.err, $gooderrfile"
- exit 1
- }
- cd ..
- rm -f $testname.err $testname.out
-done
-rm -rf TESTCXX
-exit 0
diff --git a/bdb/test/scr015/ignore b/bdb/test/scr015/ignore
deleted file mode 100644
index 55ce82ae372..00000000000
--- a/bdb/test/scr015/ignore
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# $Id: ignore,v 1.3 2001/10/12 13:02:32 dda Exp $
-#
-# A list of tests to ignore
diff --git a/bdb/test/scr015/testall b/bdb/test/scr015/testall
deleted file mode 100644
index a2d493a8b22..00000000000
--- a/bdb/test/scr015/testall
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh -
-# $Id: testall,v 1.3 2001/09/13 14:49:36 dda Exp $
-#
-# Run all the C++ regression tests
-
-ecode=0
-prefixarg=""
-stdinarg=""
-while :
-do
- case "$1" in
- --prefix=* )
- prefixarg="$1"; shift;;
- --stdin )
- stdinarg="$1"; shift;;
- * )
- break
- esac
-done
-files="`find . -name \*.cpp -print`"
-for file in $files; do
- name=`echo $file | sed -e 's:^\./::' -e 's/\.cpp$//'`
- if grep $name ignore > /dev/null; then
- echo " **** cxx test $name ignored"
- else
- echo " ==== cxx test $name"
- if ! sh ./testone $prefixarg $stdinarg $name; then
- ecode=1
- fi
- fi
-done
-exit $ecode
diff --git a/bdb/test/scr015/testone b/bdb/test/scr015/testone
deleted file mode 100644
index 3bbba3f90f0..00000000000
--- a/bdb/test/scr015/testone
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/sh -
-# $Id: testone,v 1.5 2002/07/05 22:17:59 dda Exp $
-#
-# Run just one C++ regression test, the single argument
-# is the basename of the test, e.g. TestRpcServer
-
-error()
-{
- echo '' >&2
- echo "C++ regression error: $@" >&2
- echo '' >&2
- ecode=1
-}
-
-# compares the result against the good version,
-# reports differences, and removes the result file
-# if there are no differences.
-#
-compare_result()
-{
- good="$1"
- latest="$2"
- if [ ! -e "$good" ]; then
- echo "Note: $good does not exist"
- return
- fi
- tmpout=/tmp/blddb$$.tmp
- diff "$good" "$latest" > $tmpout
- if [ -s $tmpout ]; then
- nbad=`grep '^[0-9]' $tmpout | wc -l`
- error "$good and $latest differ in $nbad places."
- else
- rm $latest
- fi
- rm -f $tmpout
-}
-
-ecode=0
-stdinflag=n
-gdbflag=n
-CXX=${CXX:-c++}
-LIBS=${LIBS:-}
-
-# remove any -c option in the CXXFLAGS
-CXXFLAGS="`echo " ${CXXFLAGS} " | sed -e 's/ -c //g'`"
-
-# determine the prefix of the install tree
-prefix=""
-while :
-do
- case "$1" in
- --prefix=* )
- prefix="`echo $1 | sed -e 's/--prefix=//'`"; shift
- LIBS="-L$prefix/lib -ldb_cxx $LIBS"
- CXXFLAGS="-I$prefix/include $CXXFLAGS"
- export LD_LIBRARY_PATH="$prefix/lib:$LD_LIBRARY_PATH"
- ;;
- --stdin )
- stdinflag=y; shift
- ;;
- --gdb )
- CXXFLAGS="-g $CXXFLAGS"
- gdbflag=y; shift
- ;;
- * )
- break
- ;;
- esac
-done
-
-if [ "$#" = 0 ]; then
- echo 'Usage: testone [ --prefix=<dir> | --stdin ] TestName'
- exit 1
-fi
-name="$1"
-
-# compile
-rm -rf TESTDIR; mkdir TESTDIR
-cd ./TESTDIR
-
-${CXX} ${CXXFLAGS} -o $name ../$name.cpp ${LIBS} > ../$name.compileout 2>&1
-if [ $? != 0 -o -s ../$name.compileout ]; then
- error "compilation of $name failed, see $name.compileout"
- exit 1
-fi
-rm -f ../$name.compileout
-
-# find input and error file
-infile=../$name.testin
-if [ ! -f $infile ]; then
- infile=/dev/null
-fi
-
-# run and diff results
-rm -rf TESTDIR
-if [ "$gdbflag" = y ]; then
- if [ -s $infile ]; then
- echo "Input file is $infile"
- fi
- gdb ./$name
- exit 0
-elif [ "$stdinflag" = y ]; then
- ./$name >../$name.out 2>../$name.err
-else
- ./$name <$infile >../$name.out 2>../$name.err
-fi
-cd ..
-
-testerr=$name.testerr
-if [ ! -f $testerr ]; then
- testerr=/dev/null
-fi
-
-testout=$name.testout
-if [ ! -f $testout ]; then
- testout=/dev/null
-fi
-
-compare_result $testout $name.out
-compare_result $testerr $name.err
-rm -rf TESTDIR
-exit $ecode