basho/basho_bench — pull request #54 by rzezeski (2012-11-10 03:46:29+00:00)
Title: Fix Logging, Add Option Handling

This commit address an issue and adds a feature

Issue

When the switch to lager was made a bug was introduced where
initialization of basho bench could fail before lager is started.
Specifically, if a malformed config was passed basho bench would exit
with no indication as to why. This was because the config was read
for `test_dir` to determine where to write the log files but lager
cannot start until the log file locations are determined. Thus a
chicken-egg problem. This commit changes that behavior, pulling the
test_dir (now called results_dir) from command line options.

Feature

In order to pass the results_dir as a command line option I thought it
would be best to add proper argument handling in the form of getopt.
In addition to the `-d` option I also added `--bench-name`. By
default basho bench stores the results of a run under a directory with
the current iso8601 timestamp. This is a great default but many times
I want to name the results of a run for posterity and this required an
extra copy operation afterwards. The `-n` option allows you to name a
test run which will also be used as the name of the directory. By
default basho bench will act as it did before but the `-d` and `-n`
options give you more control on where to store results.

Usage statement:

./basho_bench -h
Usage: ./basho_bench [-h] [-d ] [-n ] CONFIG_FILE

-h, --help Print usage
-d, --results-dir Base directory to store test results, defaults to ./tests
-n, --bench-name Name to identify the run, defaults to timestamp