/usr/include/ossim/util/ossimBatchTest.h is in libossim-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | //----------------------------------------------------------------------------
//
// License: See top level LICENSE.txt file.
//
// Author: David Burken, Oscar Kramer
//
// Description: Test code application utility class.
//
//----------------------------------------------------------------------------
// $Id$
#ifndef ossimBatchTest_HEADER
#define ossimBatchTest_HEADER 1
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimReferenced.h>
#include <ossim/base/ossimRefPtr.h>
#include <ossim/base/ossimFilename.h>
#include <vector>
#include <map>
#include <fstream>
// Forward class declarations:
class ossimArgumentParser;
class ossimDpt;
class ossimString;
class ossimGpt;
class ossimImageFileWriter;
class ossimImageGeometry;
class ossimIrect;
class ossimKeywordlist;
class ossimTilingRect;
class OSSIM_DLL ossimBatchTest : public ossimReferenced
{
public:
enum TEST_STATUS
{
TEST_TBD = 0x00, // initial state: no test yet attempted
TEST_PASSED = 0x01,
TEST_FAILED = 0x02,
TEST_ERROR = 0x04,
TEST_DISABLED = 0x08
};
//! This constructor only initializes data members to null/defaults
ossimBatchTest();
//! Initializes the test session given the command line.
bool initialize(ossimArgumentParser& ap);
//! Performs the actual test with the config filename previously set in initialize() or
//! processConfigList() when config is a list of subordinate test config files.
//! @return The overall bit-wise status of all tests (see TEST_STATUS enum for bit definitions).
ossim_uint8 execute();
private:
//! Writes template test config file, either exhaustive long form for flexibility, or simple
//! short-form for easier test creation.
void writeTemplate(const ossimFilename& templateFile, bool long_form);
//! Fetches string from OS for naming and tagging the log file.
void getDateString(ossimString& date);
//! Establishes name of output log file.
void getLogFilename(ossimFilename& logFile);
//! When the config file consists of a list of subordinate test config files, this method manages
//! processing multiple configs.
//! @return The overall bit-wise status of all configs (see TEST_STATUS enum for bit definitions).
ossim_uint8 processConfigList(const ossimKeywordlist& kwl);
//! Within a single config file can be multiple tests, distinguished by the "test*." prefix. This
//! method manages the execution of a single test.
//! @return The overall bit-wise status of test (see TEST_STATUS enum for bit definitions).
ossim_uint8 processTest(const ossimString& prefix, const ossimKeywordlist& kwl);
//! Runs a single command within a test.
//! @return The bit-wise status of command (see TEST_STATUS enum for bit definitions).
ossim_uint8 processCommands(const ossimString& prefix,
const ossimKeywordlist& kwl,
const ossimString& testName,
bool logTime,
const ossimFilename& tempFile=ossimFilename(""));
//! Modifies the config's KWL to explicitly declare implied keywords.
void preprocessKwl(const std::vector<std::string>& testList,
const std::string& testCommand,
ossimKeywordlist& kwl);
//! Default preprocessing step makes expected and output results directories. Returns
//! @return TRUE if successful.
bool makeDefaultResultsDir();
//! Default clean step deletes all files in out and exp dirs.
//! @return TRUE if successful.
bool doDefaultClean();
/**
* @brief Gets the temp file name.
*
* This will either be from the config file lookup of "temp_file" or derived under
* $(OSSIM_BATCH_TEST_RESULTS)/tmp if the lookup fails. Note that this will create
* the $(OSSIM_BATCH_TEST_RESULTS)/tmp directory if needed.
*
* @param prefix Like "test1."
* @param kwl Keyword list to look for temp_file in.
* @param tempFile Initialized by this.
*
* @return true on success. False if derived temp file directory could
* not be created.
*/
bool getTempFileName( const ossimString& prefix,
const ossimKeywordlist& kwl,
ossimFilename& tempFile ) const;
/**
* @brief Gets the default temp directory $(OSSIM_BATCH_TEST_RESULTS)/tmp.
* @param tempDir Initialized by this.
*
* @return true on success, false on error.
*/
bool getDefaultTempFileDir( ossimFilename& tempDir ) const;
/** @brief Initializes arg parser and outputs usage. */
void usage(ossimArgumentParser& ap);
/**
* @brief Converts string slashes to either forward or backward taking
* into account that windows commands with forward slashes in them.
* @param s String to convert.
*/
std::string convertToNative( const char* lookup ) const;
std::vector<std::string> m_acceptTestList;
std::vector<std::string> m_cleanTestList;
std::vector<std::string> m_preprocessTestList;
std::vector<std::string> m_runTestList;
std::map<ossim_uint32, std::string> m_statusLabels;
bool m_templateModeActive;
ossimFilename m_configFileName;
ossimFilename m_outDir;
ossimFilename m_expDir;
std::ofstream m_logStr;
};
#endif /* #ifndef ossimBatchTest_HEADER */
|