Skip to content

jimoleary/boost_unlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boost_unlink

Test code for mongodb drop database

Setup install dependencies

Ubuntu

> sudo apt-get install cmake -y 
> sudo apt-get install build-essential checkinstall -y
> sudo apt-get install libboost-all-dev -y
> sudo apt-get install libbz2-dev

Centos 6.3:

> sudo yum install cmake -y

Install boost 1.49.0

> wget -c 'http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.bz2/download' -O boost_1_49_0.tar.bz2
> tar xf boost_1_49_0.tar.bz2
> cd boost_1_49_0/

To install for a single user locally

> export BOOST_ROOT=$HOME/boost
> mkdir $BOOST_ROOT
> ./bootstrap.sh --prefix=$BOOST_ROOT
> ./b2 install

To install for all users (needs sudo)

> ./bootstrap.sh
> sudo ./b2 install

Build Project

Please ensure you have set BOOST_ROOT in this shell (if you installed locally)

> mkdir ./build
> cd build
> cmake .. 
> make 

Optional: to use Boost_USE_STATIC_LIBS and Boost_USE_STATIC_RUNTIME are set on in the config but you can always add:

-DBoost_USE_STATIC_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON

To enable debug use:

> cmake .. -DBoost_DEBUG=on

Clean the project:

Set the BOOST_ROOT to the correct value.

> rm -rf ./build && mkdir ./build && cd ./build &&  cmake ..

Source

.
├── CMakeLists.txt              # cmake config file
├── LICENSE
├── README.md
└── src
    ├── cmdline.cpp             # process the command line options
    ├── main.cpp                # simple mainline wrapper
    ├── util.cpp                # util methods to prime the test
    └── mongo_ops.cpp           # the ops to test 

Getting Help :

$ ./boost_unlink  --help 
Allowed options:

Generic options:
  -h [ --help ]         produce help message
  -v [ --verbose ]      be more verbose (include multiple times for more 
                        verbosity e.g. -vvvvv)
  --dbpath arg          the target directory
  --dryrun              do a dryrun
  --preallocate         preallocate files pf the correct sizes
  --directoryperdb      each database will be stored in a separate directory, 
                        <default to false>)
  --setup               only setup the directory/files, <default to false>)
  -f [ --files ] arg    the number of files

Invoking the executable

> sudo mkdir /data/boost_unlink
> sudo chown <username> /data/boost_unlink
> ./boost_unlink testing --files 6  -vvvvv 
> ./boost_unlink testing --files 6  -vvvvv --directoryperdb
> ./boost_unlink testing --files 6   --directoryperdb --dbpath=/data/boost_unlink
> ./boost_unlink testing --files 6   --dbpath=/data/boost_unlink
> ls /tmp/boost_unlink/testing

Testing the executable

The following should output 8 (or whatever the value of echo $(( $(find ../test/db -maxdepth 1 -mindepth 1 -type d| wc -l) / 2)) is) :

for l in $(find ../test/db  -maxdepth 1 -mindepth 1 -type d) ; do
     ./boost_unlink testing --files 6  --dbpath=$l || echo "expected failure"
done | grep "expected failure" | wc -l

for l in $(find ../test/db -maxdepth 1 -mindepth 1  -type d) ; do
     ./boost_unlink testing --files 6  --dbpath=$l  --name=_test || echo "expected failure"
done | grep "expected failure" | wc -l

About

Test code for mongodb dropdata

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors