Difference between revisions of "Patch TUT"
Jump to navigation
Jump to search
Rob Linden (talk | contribs) (Fixing the patch, and adding direct download links) |
|||
Line 1: | Line 1: | ||
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. | |||
= TUT-2008-11-30 = | = TUT-2008-11-30 = | ||
<pre> | <pre> | ||
--- tut | diff -r 12b2ceb31753 tut/tut_assert.hpp | ||
+++ tut | --- 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 @@ | @@ -154,9 +154,23 @@ | ||
throw failure(msg); | throw failure(msg); | ||
Line 203: | Line 38: | ||
#endif | #endif | ||
diff - | diff -r 12b2ceb31753 tut/tut_exception.hpp | ||
--- tut | --- a/tut/tut_exception.hpp Tue Jul 21 15:09:02 2009 -0700 | ||
+++ tut | +++ b/tut/tut_exception.hpp Tue Jul 21 15:37:32 2009 -0700 | ||
@@ -201,6 +201,26 @@ | @@ -201,6 +201,26 @@ | ||
const test_result tr; | const test_result tr; | ||
Line 233: | Line 68: | ||
#endif | #endif | ||
diff - | diff -r 12b2ceb31753 tut/tut_posix.hpp | ||
--- tut | --- a/tut/tut_posix.hpp Tue Jul 21 15:09:02 2009 -0700 | ||
+++ tut | +++ 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 @@ | @@ -51,6 +51,7 @@ | ||
* ex - test throwed an exceptions | * ex - test throwed an exceptions | ||
Line 253: | Line 109: | ||
}; | }; | ||
result_type result; | result_type result;</pre> | ||
</pre> | |||
Save this patch as <code>tut.patch</code> in the <code>tut-2008-11-30 | Save this patch as <code>tut.patch</code> in the <code>tut-2008-11-30</code> directory and apply it from a terminal program like xterm or cygwin with the command: | ||
$ patch -p1 < tut.patch | $ patch -p1 < tut.patch |
Revision as of 14:45, 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.
TUT-2008-11-30
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;
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