diff options
Diffstat (limited to 'indra/test')
-rw-r--r-- | indra/test/lltut.h | 16 | ||||
-rw-r--r-- | indra/test/test.cpp | 23 |
2 files changed, 37 insertions, 2 deletions
diff --git a/indra/test/lltut.h b/indra/test/lltut.h index c2ec504857..99dd71b78c 100644 --- a/indra/test/lltut.h +++ b/indra/test/lltut.h @@ -26,6 +26,22 @@ class LLSD; namespace tut { + inline void ensure_memory_matches(const char* msg,const void* actual, U32 actual_len, const void* expected,U32 expected_len) + { + if((expected_len != actual_len) || + (memcmp(actual, expected, actual_len) != 0)) + { + std::stringstream ss; + ss << (msg?msg:"") << (msg?": ":"") << "not equal"; + throw tut::failure(ss.str().c_str()); + } + } + + inline void ensure_memory_matches(const void* actual, U32 actual_len, const void* expected,U32 expected_len) + { + ensure_memory_matches(NULL, actual, actual_len, expected, expected_len); + } + template <class T,class Q> void ensure_not_equals(const char* msg,const Q& actual,const T& expected) { diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 312c52dc77..b60abdf587 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -43,7 +43,8 @@ public: mVerboseMode(verbose_mode), mTotalTests(0), mPassedTests(0), - mFailedTests(0) + mFailedTests(0), + mSkippedTests(0) { } @@ -79,6 +80,10 @@ public: ++mFailedTests; out << "abnormal termination"; break; + case tut::test_result::skip: + ++mSkippedTests; + out << "skipped"; + break; default: ++mFailedTests; out << "unknown"; @@ -94,6 +99,12 @@ public: std::cout << std::endl; std::cout << "Total Tests: " << mTotalTests << std::endl; std::cout << "Passed Tests : " << mPassedTests << std::endl; + + if (mSkippedTests > 0) + { + std::cout << "Skipped Tests : " << mSkippedTests << std::endl; + } + if(mFailedTests > 0) { std::cout << "*********************************" << std::endl; @@ -109,6 +120,7 @@ protected: S32 mTotalTests; S32 mPassedTests; S32 mFailedTests; + S32 mSkippedTests; }; static const apr_getopt_option_t TEST_CL_OPTIONS[] = @@ -117,6 +129,7 @@ static const apr_getopt_option_t TEST_CL_OPTIONS[] = {"list", 'l', 0, "List available test groups."}, {"verbose", 'v', 0, "Verbose output."}, {"group", 'g', 1, "Run test group specified by option argument."}, + {"skip", 's', 1, "Skip test number specified by option argument. Only works when a specific group is being tested"}, {"wait", 'w', 0, "Wait for input before exit."}, {0, 0, 0, 0} }; @@ -146,6 +159,8 @@ void stream_usage(std::ostream& s, const char* app) s << "\tList all available test groups." << std::endl; s << " " << app << " --group=uuid" << std::endl; s << "\tRun the test group 'uuid'." << std::endl; + s << " " << app << " --skip=2" << std::endl; + s << "\tSkip test case 2." << std::endl; } void stream_groups(std::ostream& s, const char* app) @@ -193,6 +208,7 @@ int main(int argc, char **argv) // values used for controlling application bool verbose_mode = false; bool wait_at_exit = false; + int skip_test_id = 0; std::string test_group; // values use for options parsing @@ -215,6 +231,9 @@ int main(int argc, char **argv) case 'g': test_group.assign(opt_arg); break; + case 's': + skip_test_id = atoi(opt_arg); + break; case 'h': stream_usage(std::cout, argv[0]); return 0; @@ -245,7 +264,7 @@ int main(int argc, char **argv) } else { - tut::runner.get().run_tests(test_group); + tut::runner.get().run_tests(test_group, skip_test_id); } if (wait_at_exit) |