Berkeley DB Reference Guide: Building Berkeley DB for Windows systems
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

### Berkeley DB Reference Guide: Building Berkeley DB for Windows systems |

# Running the test suite under Windows

These notes are for building the test suite on Win32 platforms. Most of the issues with the test suite on Win* are due to the operating systems dependencies in the test suite itself, expressed as file names, process management or CR/NL issues.

The test suite was originally developed and maintained on UNIX platforms, so these dependencies crop up on every release as new tests are added or modified for changes to Berkeley DB. That much said, every release we work hard to fix or work around issues that cause failures on Win/NT, but we are not yet finished with Win/95.

Please read through all the instructions before you begin to ensure that you have everything you need.

First, you need a set of UNIX-like utilities to assist Tcl with various operations. Currently we require: cmp, cp, kill, mkdir, mv, rm, sed, sleep, sort and tr. We have tested using the MKS/NT package, which mostly works. (If you use this package, see MKS/NT notes below). The GNU utilities should work as well, but you may discover different issues. We assume that these tools are in c:/tools, but this can be changed by editing the include.tcl file. Note that a "PERL5" variable is referenced by the include.tcl file. It is not necessary to run the test suite, and may be left unset.

Second, you will need to get the Tcl toolkit. The test suite requires at least Tcl 8.1, and that is what we currently test with on our Win* platforms. These notes assume Tcl is installed as d:/tcl, but you can change this if you wish. We have found that we needed to rebuild a debug version of Tcl from the sources to get correct behavior. This is because the set of DLLs linked into the Tcl executable must match the corresponding set of DLLs used by Berkeley DB.

You will also need sufficient main memory and disk. Disk is not terribly demanding, something less than 100 MB should be sufficient. For memory, the more the better -- 32MB is too small, but 64MB should be fine.

### Building the software needed by the tests

To build, perform the following steps. Note that steps #1, #4 and #5 are part of the normal build process for building Berkeley DB.

1. Open the build_win32/Berkeley_DB.dsw workspace.

2. Add the pathname for the Tcl include subdirectory to your include path. To do this, under the "Tools" menu item, select "Options". In the dialog, select the "Directories" tab, and choose directories for "Include Files". Add d:/tcl/include (or whatever directory contains tcl.h in your distribution) to the list.

3. Add the pathname for the Tcl library subdirectory to your library path. To do this, under the "Tools" menu item, select "Options". In the dialog, select the "Directories" tab, and choose directories for "Library Files". Add d:/tcl/lib (or whatever directory contains tcl80.lib in your distribution) to the list.

4. Set the active configuration to build_all -- Debug. To set an active configuration, under the "Build" menu item in the IDE, select "Set Active Configuration". Then choose "build_all -- Debug".

5. Build. This will build the base Berkeley DB .dll and various tools that are needed by the test suite.

6. Set the active configuration to db_tcl -- Debug. To set an active configuration, under the "Build" menu item in the IDE, select "Set Active Configuration". Then choose "db_tcl -- Debug".

7. Build. That should create a build_win32/Debug/libdb_tclNNd.dll file, where NN is the major/minor numbers of the current release, for example NN would be "30" for the Berkeley DB 3.0.1 release.

8. Copy all the build_win32/Debug/*.exe files to the build_win32 directory. The test suite expects that programs such as db_archive.exe will be found in this directory.

### Running the test suite under Windows

Before running the tests for the first time, you must edit the file include.tcl in your build directory and change the line that reads:

>     set tclsh_path SET_YOUR_TCLSH_PATH

You will want to use the location of the tclsh program. For example, if Tcl is installed as d:/tcl, this line should be:

>     set tclsh_path d:/tcl/bin/tclsh81d.exe

In addition you may need to change the path names of your UNIX-like utilities. These path names are set as lines like:

>     set CP c:/tools/cp.exe

Then, in a shell of your choice enter the following commands:

1. cd build_win32

2. run d:/tcl/bin/tclsh80.exe, or the equivalent name of the Tcl shell for your distribution.

   You should get a "%" prompt.

3. % source ../test/test.tcl.

   You should get a "%" prompt with no errors.

You are now ready to run tests in the test suite.

### Test suite failures

We will not release Berkeley DB with a FAIL message on Windows/NT, unless we are sure it is a problem with the test suite, and not the Berkeley DB code. However, there may still be error messages or warnings from various tests.

Known places where the tests typically give error messages:

>     ..../TESTDIR: expected 0, got memp_unlink: Error 0

Often this kind of error occurs when one test has the database or environment open at the time an unlink is done. Removing a file is always legal in UNIX, but on Win*, a file cannot generally be removed if a process has it open. We are slowly chasing these problems down.

### MKS/NT notes

If you are using MKS/NT, you will find that there are a few tests that do not work out of the box, because there are some tests that produce input/output data that has long lines (more than 2048 characters). These lines are longer than the MKS default limit. The "sort" command breaks on these long lines.

The "sort" problem can be fixed by changing the maximum record length on the command line. To do this, add a "-z16384" option to the sort command. You can change the .tcl script or hack up a replacement for sort.exe that calls the real sort.exe with the extra options. Unfortunately changing include.tcl to have the extra option does not work.

The test suite also needs its own "kill" program that accepts the same options as the UNIX kill. We provide the source for a simple kill program in build_win32/killfix.cpp. This should be compiled and installed as c:/tools/kill.exe.

Copyright Sleepycat Software