X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/46f4442e9a5a4f3b98b7c1083586332f6a8a99a4..729e4ab9bc6618bc3d8a898e575df7f4019e29ca:/icuSources/tools/ctestfw/unicode/ctest.h diff --git a/icuSources/tools/ctestfw/unicode/ctest.h b/icuSources/tools/ctestfw/unicode/ctest.h index 4cb7457a..bbff5a0b 100644 --- a/icuSources/tools/ctestfw/unicode/ctest.h +++ b/icuSources/tools/ctestfw/unicode/ctest.h @@ -1,7 +1,7 @@ /* ******************************************************************************** * - * Copyright (C) 1996-2008, International Business Machines + * Copyright (C) 1996-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************** @@ -23,53 +23,61 @@ typedef struct TestNode TestNode; U_CDECL_END /** - * Set this to zero to disable log_verbose() messages. - * Otherwise nonzero to see log_verbose() messages. + * This is use to set or get the option value for REPEAT_TESTS. + * Use with set/getTestOption(). * - * @internal Internal APIs for testing purpose only + * @internal */ -extern T_CTEST_EXPORT_API int REPEAT_TESTS; +#define REPEAT_TESTS_OPTION 1 /** - * Set this to zero to disable log_verbose() messages. + * This is use to set or get the option value for VERBOSITY. + * When option is set to zero to disable log_verbose() messages. * Otherwise nonzero to see log_verbose() messages. + * Use with set/getTestOption(). * - * @internal Internal APIs for testing purpose only + * @internal */ -extern T_CTEST_EXPORT_API int VERBOSITY; +#define VERBOSITY_OPTION 2 /** - * Set this to zero to disable log_verbose() messages. - * Otherwise nonzero to see log_verbose() messages. + * This is use to set or get the option value for ERR_MSG. + * Use with set/getTestOption(). * - * @internal Internal APIs for testing purpose only + * @internal */ -extern T_CTEST_EXPORT_API int ERR_MSG; +#define ERR_MSG_OPTION 3 /** - * Set this to zero to disable some of the slower tests. + * This is use to set or get the option value for QUICK. + * When option is zero, disable some of the slower tests. * Otherwise nonzero to run the slower tests. + * Use with set/getTestOption(). * - * @internal Internal APIs for testing purpose only + * @internal */ -extern T_CTEST_EXPORT_API int QUICK; +#define QUICK_OPTION 4 /** - * Set this to nonzero to warn (not error) on missing data. - * Otherwise, zero will cause an error to be propagated when data is not available. + * This is use to set or get the option value for WARN_ON_MISSING_DATA. + * When option is nonzero, warn on missing data. + * Otherwise, errors are propagated when data is not available. * Affects the behavior of log_dataerr. + * Use with set/getTestOption(). * * @see log_data_err - * @internal Internal APIs for testing purpose only + * @internal */ -extern T_CTEST_EXPORT_API int WARN_ON_MISSING_DATA; +#define WARN_ON_MISSING_DATA_OPTION 5 /** - * ICU tracing level, is set by command line option + * This is use to set or get the option value for ICU_TRACE. + * ICU tracing level, is set by command line option. + * Use with set/getTestOption(). * * @internal */ -extern T_CTEST_EXPORT_API UTraceLevel ICU_TRACE; +#define ICU_TRACE_OPTION 6 /** * Maximum amount of memory uprv_malloc should allocate before returning NULL. @@ -85,6 +93,32 @@ extern T_CTEST_EXPORT_API size_t MAX_MEMORY_ALLOCATION; */ extern T_CTEST_EXPORT_API int32_t ALLOCATION_COUNT; +/** + * Pass to setTestOption to decrement the test option value. + * + * @internal + */ +#define DECREMENT_OPTION_VALUE -99 + +/** + * Gets the test option set on commandline. + * + * @param testOption macro definition for the individual test option + * @return value of test option, zero if option is not set or off + * @internal Internal APIs for testing purpose only + */ +T_CTEST_API int32_t T_CTEST_EXPORT2 +getTestOption ( int32_t testOption ); + +/** + * Sets the test option with value given on commandline. + * + * @param testOption macro definition for the individual test option + * @param value to set the test option to + * @internal Internal APIs for testing purpose only + */ +T_CTEST_API void T_CTEST_EXPORT2 +setTestOption ( int32_t testOption, int32_t value); /** * Show the names of all nodes. @@ -151,6 +185,8 @@ getTest(const TestNode* root, T_CTEST_API void T_CTEST_EXPORT2 log_err(const char* pattern, ...); +T_CTEST_API void T_CTEST_EXPORT2 +log_err_status(UErrorCode status, const char* pattern, ...); /** * Log an informational message. (printf style) * @param pattern printf-style format string @@ -218,6 +254,49 @@ runTestRequest(const TestNode* root, T_CTEST_API const char* T_CTEST_EXPORT2 getTestName(void); +/** + * Append a time delta to str if it is significant (>5 ms) otherwise no change + * @param delta a delta in millis + * @param str a string to append to. + */ +T_CTEST_API void T_CTEST_EXPORT2 +str_timeDelta(char *str, UDate delta); + + +/* ======== XML (JUnit output) ========= */ + +/** + * Set the filename for the XML output. + * @param fileName file name. Caller must retain storage. + * @return 0 on success, 1 on failure. + */ +T_CTEST_API int32_t T_CTEST_EXPORT2 +ctest_xml_setFileName(const char *fileName); +/** + * Init XML subsystem. Call ctest_xml_setFileName first + * @param rootName the test root name to be written + * @return 0 on success, 1 on failure. + */ +T_CTEST_API int32_t T_CTEST_EXPORT2 +ctest_xml_init(const char *rootName); + + +/** + * Set the filename for the XML output. Caller must retain storage. + * @return 0 on success, 1 on failure. + */ +T_CTEST_API int32_t T_CTEST_EXPORT2 +ctest_xml_fini(void); + + +/** + * report a test case + * @return 0 on success, 1 on failure. + */ +T_CTEST_API int32_t +T_CTEST_EXPORT2 +ctest_xml_testcase(const char *classname, const char *name, const char *time, const char *failMsg); + #endif