<div>Hi,</div>
<div> </div>
<div>Just one minor comment, could you keep the single case running mode the same as before?</div>
<div>I think that will be more convenient for the developer.<br><br></div>
<div class="gmail_quote">On Mon, May 20, 2013 at 3:14 PM, Yi Sun <span dir="ltr"><<a href="mailto:yi.sun@intel.com" target="_blank">yi.sun@intel.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">Add three arguments:<br>  -n <casename> : run a single case.<br>  -a            : run all sub cases.<br>  -l            : list all sub cases name.<br>
<br>Signed-off-by: Yi Sun <<a href="mailto:yi.sun@intel.com">yi.sun@intel.com</a>><br><br>diff --git a/utests/utest.cpp b/utests/utest.cpp<br>index fc3467e..193e931 100644<br>--- a/utests/utest.cpp<br>+++ b/utests/utest.cpp<br>
@@ -76,3 +76,13 @@ void UTest::runAll(void) {<br>   }<br> }<br><br>+void UTest::listAllCases()<br>+{<br>+if (utestList == NULL) return;<br>+  for (size_t i = 0; i < utestList->size(); ++i) {<br>+    const UTest &utest = (*utestList)[i];<br>
+    if (utest.fn == NULL) continue;<br>+    std::cout << <a href="http://utest.name/" target="_blank">utest.name</a> << std::endl;<br>+  }<br>+<br>+}<br>diff --git a/utests/utest.hpp b/utests/utest.hpp<br>index 338a4dc..5487911 100644<br>
--- a/utests/utest.hpp<br>+++ b/utests/utest.hpp<br>@@ -50,6 +50,8 @@ struct UTest<br>   static void run(const char *name);<br>   /*! Run all the tests */<br>   static void runAll(void);<br>+  /* List all the sub cases name*/<br>
+  static void listAllCases(void);<br> };<br><br> /*! Register a new unit test */<br>diff --git a/utests/utest_run.cpp b/utests/utest_run.cpp<br>index e577b7b..3974bbb 100644<br>--- a/utests/utest_run.cpp<br>+++ b/utests/utest_run.cpp<br>
@@ -26,19 +26,67 @@<br> #include "utest_helper.hpp"<br> #include "utest_exception.hpp"<br> #include <iostream><br>+#include <getopt.h><br>+<br>+static const char *shortopts = "n:la";<br>
+struct option longopts[] = {<br>+{"name", required_argument, NULL, 'n'},<br>+{"list", no_argument, NULL, 'l'},<br>+{0, 0, 0, 0},<br>+};<br>+<br>+void usage()<br>+{<br>+    std::cout << "\<br>
+Usage:\n\<br>+  ./utest_run <option>\n\<br>+\n\<br>+  option:\n\<br>+    -n <casename>: run sub-case named 'casename'\n\<br>+    -l           : list all the available case name\n\<br>+    -a           : run all test cases\n\<br>
+\<br>+    "<< std::endl;<br>+}<br><br> int main(int argc, char *argv[])<br> {<br>-  try {<br>+<br>+    int c;<br>     cl_ocl_init();<br>-    if (argc >= 2)<br>-      for (int i = 1; i < argc; ++i)<br>-        UTest::run(argv[i]);<br>
-    else<br>-      UTest::runAll();<br>+<br>+    while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)<br>+    {<br>+        switch (c)<br>+        {<br>+            case 'n':<br>+                try {<br>
+                    UTest::run(optarg);<br>+                }<br>+                catch (Exception e){<br>+                    std::cout << "  " << e.what() << "    [SUCCESS]" << std::endl;<br>
+                }<br>+<br>+                break;<br>+<br>+            case 'l':<br>+                UTest::listAllCases();<br>+                break;<br>+<br>+            case 'a':<br>+                try {<br>
+                    UTest::runAll();<br>+                }<br>+                catch (Exception e){<br>+                    std::cout << "  " << e.what() << "    [SUCCESS]" << std::endl;<br>
+                }<br>+<br>+                break;<br>+            default: usage();<br>+                exit(1);<br>+        }<br>+    }<br>+<br>     cl_ocl_destroy();<br>-  } catch (Exception e) {<br>-      std::cout << "  " << e.what() << "    [SUCCESS]" << std::endl;<br>
-  }<br> }<br><span class="HOEnZb"><font color="#888888"><br>--<br>1.7.6.4<br><br>_______________________________________________<br>Beignet mailing list<br><a href="mailto:Beignet@lists.freedesktop.org">Beignet@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/beignet" target="_blank">http://lists.freedesktop.org/mailman/listinfo/beignet</a><br></font></span></blockquote></div><br>