<div dir="ltr">+1 and thanks</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 18, 2015 at 4:16 PM, Jim Ingham <span dir="ltr"><<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jingham<br>
Date: Wed Mar 18 18:16:58 2015<br>
New Revision: 232689<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=232689&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=232689&view=rev</a><br>
Log:<br>
Comment discouraging writing command based test cases.<br>
<br>
Modified:<br>
    lldb/trunk/test/README-TestSuite<br>
<br>
Modified: lldb/trunk/test/README-TestSuite<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/README-TestSuite?rev=232689&r1=232688&r2=232689&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/README-TestSuite?rev=232689&r1=232688&r2=232689&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/README-TestSuite (original)<br>
+++ lldb/trunk/test/README-TestSuite Wed Mar 18 18:16:58 2015<br>
@@ -133,3 +133,27 @@ $ DOTEST_PROFILE=YES DOTEST_SCRIPT_DIR=/<br>
   After that, I used the pstats.py module to browse the statistics:<br>
<br>
 $ python /System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/pstats.py my.profile<br>
+<br>
+o Writing test cases:<br>
+<br>
+ We strongly prefer writing test cases using the SB API's rather than the runCmd & expect.<br>
+ Unless you are actually testing some feature of the command line, please don't write<br>
+ command based tests.  For historical reasons there are plenty of examples of tests in the<br>
+ test suite that use runCmd where they shouldn't, but don't copy them, copy the plenty that<br>
+ do use the SB API's instead.<br>
+<br>
+ The reason for this is that our policy is that we will maintain compatibility with the<br>
+ SB API's.  But we don't make any similar guarantee about the details of command result format.<br>
+ If your test is using the command line, it is going to have to check against the command result<br>
+ text, and you either end up writing your check  pattern by checking as little as possible so<br>
+ you won't be exposed to random changes in the text; in which case you can end up missing some<br>
+ failure, or you test too much and it means irrelevant changes break your tests.<br>
+<br>
+ However, if you use the Python API's it is possible to check all the results you want<br>
+ to check in a very explicit way, which makes the tests much more robust.<br>
+<br>
+ Even if you are testing that a command-line command does some specific thing, it is still<br>
+ better in general to use the SB API's to drive to the point where you want to run the test,<br>
+ then use SBInterpreter::HandleCommand to run the command.  You get the full result text<br>
+ from the command in the command return object, and all the part where you are driving the<br>
+ debugger to the point you want to test will be more robust.<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
</blockquote></div><br></div>