00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "smbios/compat.h"
00021
00022 #include <string>
00023 #include <string.h>
00024 #include <fstream>
00025 #include <iostream>
00026
00027 #include <cppunit/extensions/TestFactoryRegistry.h>
00028 #include <cppunit/ui/text/TestRunner.h>
00029 #include <cppunit/XmlOutputter.h>
00030
00031 using namespace std;
00032
00033 int global_argc;
00034 char ** global_argv;
00035 std::string global_programDirname;
00036 std::string global_writeDirectory;
00037 std::string global_testName;
00038 std::string global_testDirectory;
00039 int global_DebugLevel = 9;
00040
00041 int
00042 main (int argc, char **argv)
00043 {
00044 global_argc = argc;
00045 global_argv = argv;
00046
00047 if( argc < 5 )
00048 {
00049 cout <<
00050 "\nusage:\n"
00051 " <program> <cppunit_directory> <writeable_directory>\n"
00052 " Where both directory names are required arguments.\n"
00053 " cppunit_directory - location where platform/ directory is located.\n"
00054 " writeable_directory- location of a writeable dir for unit test.\n"
00055 " test_name - name of test.\n"
00056 " test_dir - location of unit test data files.\n"
00057 "\n"
00058 << endl;
00059 exit(1);
00060 }
00061
00062
00063 global_programDirname = argv[1];
00064 global_writeDirectory = argv[2];
00065 global_testName = argv[3];
00066 global_testDirectory = argv[4];
00067
00068 std::ofstream outputFile("testResults.xml");
00069 CppUnit::TextUi::TestRunner runner;
00070
00071 CppUnit::TestFactoryRegistry & registry =
00072 CppUnit::TestFactoryRegistry::getRegistry ();
00073
00074 CppUnit::XmlOutputter* outputter = new CppUnit::XmlOutputter( &runner.result(), outputFile );
00075
00076 runner.setOutputter(outputter);
00077 runner.addTest (registry.makeTest ());
00078
00079 bool wasSuccessful = runner.run ("",
00080 false,
00081 true,
00082 false
00083 );
00084
00085 outputFile.close();
00086
00087
00088 return !wasSuccessful;
00089 }