Skip to content

Commit

Permalink
Tweaked wciInstallTester to allow database spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloa committed Sep 10, 2013
1 parent 097214a commit 9c25e54
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
22 changes: 18 additions & 4 deletions test/install/callInterface/wciInstallTest.in.sh
Expand Up @@ -29,6 +29,7 @@ Call Interface (wci)
Options:
--help display this help and exit
--version output version information and exit
--database, -d ARG database name (defaults to wdb)
--xml,-x output tests results in JUnit XML
--ouput=FILE, -o FILE
output test log to <FILE>
Expand All @@ -46,7 +47,17 @@ while test -n "$1"; do
echo "$SCRIPT_USAGE"; exit 0;;
--version)
echo "$0 $SCRIPT_VERSION"; exit 0;;
--xml)
--database)
shift
DB=`echo $1`
shift
continue;;
-d)
shift
DB=`echo $1`
shift
continue;;
--xml)
RUN_TEST_PROGRAM="__WDB_BUILDDIR__/wciInstallTester --nowarn -o X"
shift
continue;;
Expand Down Expand Up @@ -75,13 +86,16 @@ while test -n "$1"; do
done
echo -e "#\n# callInterface Installation Tests\n"

source ${TEST_PATH}/tearDown.sh
source ${TEST_PATH}/buildUp.sh

# Create the writer for the wci write tests:
#__WDB_BINDIR__/wdb createuser wcitestwriter write
# This is now actually done in the installation.
# Should test before doing this to avoid errors/warnings
if test -n "$DB"; then
RUN_TEST_PROGRAM="$RUN_TEST_PROGRAM -d $DB"
fi

source ${TEST_PATH}/tearDown.sh
source ${TEST_PATH}/buildUp.sh

# Run Tests
if test -n "$LOGFILE"; then
Expand Down
21 changes: 15 additions & 6 deletions test/install/callInterface/wciInstallTester.cpp
Expand Up @@ -34,6 +34,17 @@
#include <AbstractWdbTestFixture.h>
#include <boost/program_options.hpp>
#include <boost/program_options/options_description.hpp>
#include <iostream>
#include <cppunit/Exception.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/Message.h>
#include <cppunit/SourceLine.h>
#include <cppunit/Test.h>
#include <cppunit/TestFailure.h>
#include <cppunit/TestRunner.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestSuite.h>

using namespace std;
using namespace boost::program_options;
Expand Down Expand Up @@ -86,32 +97,31 @@ int run_main( const char * programName, int argc, char ** argv )
{
TestConfiguration c;
c.parse( argc, argv );

// --help
if ( c.general().help )
{
help( programName, c.shownOptions(), cout );
return 0;
}
// --version
if ( c.general().version )
{
version( programName, cout );
return 0;
}


CppUnit::TextUi::TestRunner runner;
CppUnit::TextTestRunner runner;

runner.setOutputter( getOutputter( c.output(), runner.result(), clog ) );

CppUnit::Test * allTests = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

//
if (c.listTests())
{
listTests(*allTests);
return 0;
}


if ( c.runTest().empty() )
runner.addTest( allTests );
else
Expand All @@ -134,7 +144,6 @@ int run_main( const char * programName, int argc, char ** argv )

bool ok = runner.run();


// Unless command line contains the switch "--nowarn":
// Give extra information if lots of errors.
if ( c.warnings() )
Expand Down

0 comments on commit 9c25e54

Please sign in to comment.