Difference between revisions of "Patch TUT"
Jump to navigation
Jump to search
Rob Linden (talk | contribs) (Moving explanation above the patch) |
Rob Linden (talk | contribs) |
||
Line 113: | Line 113: | ||
result_type result;</pre> | result_type result;</pre> | ||
[[Category:Compiling viewer]] |
Revision as of 14:48, 21 July 2009
The TUT source code can be found here:
- Original source: http://downloads.sourceforge.net/sourceforge/tut-framework/tut-2008-11-30.tar.gz
- Linden Lab's modified version: http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/tut-2008-11-30-common-20081208.tar.bz2
- NOTE: check install.xml in the source tree for the version of the viewer you're interested in compiling.
Details
Our unit test framework did not have any method for skipping tests. Sometimes known failure cases are found which require temporarily skipping tests. This patch adds that functionality.
Patch against tut-2008-11-30.tar.gz . Save this patch as tut.patch
in the tut-2008-11-30
directory and apply it from a terminal program like xterm or cygwin with the command:
$ patch -p1 < tut.patch
diff -r 12b2ceb31753 tut/tut_assert.hpp --- a/tut/tut_assert.hpp Tue Jul 21 15:09:02 2009 -0700 +++ b/tut/tut_assert.hpp Tue Jul 21 15:37:32 2009 -0700 @@ -154,9 +154,23 @@ throw failure(msg); } +/** + * Skip test because of known failure. + */ +void skip(const char* msg = "") +{ + throw skip_failure(msg); +} + +void skip(const std::string& msg) +{ + throw skip_failure(msg); +} + } // end of namespace } + #endif diff -r 12b2ceb31753 tut/tut_exception.hpp --- a/tut/tut_exception.hpp Tue Jul 21 15:09:02 2009 -0700 +++ b/tut/tut_exception.hpp Tue Jul 21 15:37:32 2009 -0700 @@ -201,6 +201,26 @@ const test_result tr; }; +/** + * Exception to be throwed when skip_fail() is called. + */ +struct skip_failure : public failure +{ + skip_failure(const std::string& msg) + : failure(msg) + { + } + + test_result::result_type result() const + { + return test_result::skip; + } + + ~skip_failure() throw() + { + } +}; + } #endif diff -r 12b2ceb31753 tut/tut_posix.hpp --- a/tut/tut_posix.hpp Tue Jul 21 15:09:02 2009 -0700 +++ b/tut/tut_posix.hpp Tue Jul 21 15:37:32 2009 -0700 @@ -248,13 +248,13 @@ return; } else - { - std::stringstream ss; + { + std::stringstream ss; char e[1024]; ss << "child " << pid << " could not be killed with SIGKILL, " << strerror_r(errno, e, sizeof(e)) << std::endl; - fail(ss.str()); + fail(ss.str()); + } } - } ensure_equals("wait after SIGKILL", waitpid_(pid, &status), pid); ensure_child_signal_(status, SIGKILL); diff -r 12b2ceb31753 tut/tut_result.hpp --- a/tut/tut_result.hpp Tue Jul 21 15:09:02 2009 -0700 +++ b/tut/tut_result.hpp Tue Jul 21 15:37:32 2009 -0700 @@ -51,6 +51,7 @@ * ex - test throwed an exceptions * warn - test finished successfully, but test destructor throwed * term - test forced test application to terminate abnormally + * skip - test skpped because it is a known failure case */ enum result_type { @@ -60,7 +61,8 @@ warn, term, ex_ctor, - rethrown + rethrown, + skip, }; result_type result;