Difference between revisions of "Patch TUT"

From Second Life Wiki
Jump to navigation Jump to search
(Update to be more clear about canonical way to obtain tut.)
Line 1: Line 1:
The TUT source code can be found here:
Linden Lab's modified version can be downloaded with <code>scripts/install.py tut</code>,
*  Original source: http://downloads.sourceforge.net/sourceforge/tut-framework/tut-2008-11-30.tar.gz
which uses <code>install.xml</code> in the source tree for the right version/download-url.
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 ==
== Using the original source ==


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.
The original source can be downloaded from http://downloads.sourceforge.net/sourceforge/tut-framework/tut-2008-11-30.tar.gz
 
Our unit test framework did not have any method for skipping tests. Sometimes known failure cases are found which require temporarily skipping tests. The following patch adds that functionality.


Patch against tut-2008-11-30.tar.gz .  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 against tut-2008-11-30.tar.gz .  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:  

Revision as of 06:36, 15 July 2010

Linden Lab's modified version can be downloaded with scripts/install.py tut, which uses install.xml in the source tree for the right version/download-url.

Using the original source

The original source can be downloaded from http://downloads.sourceforge.net/sourceforge/tut-framework/tut-2008-11-30.tar.gz

Our unit test framework did not have any method for skipping tests. Sometimes known failure cases are found which require temporarily skipping tests. The following 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;