summaryrefslogtreecommitdiff
path: root/utests
diff options
context:
space:
mode:
authorPan Xiuli <xiuli.pan@intel.com>2016-08-12 16:52:01 +0800
committerYang Rong <rong.r.yang@intel.com>2016-08-12 18:29:39 +0800
commit8bc5d2852eedf9613d58276ab06d7e58570b885f (patch)
treebabfc18444d1c197f9f128fc6199af2775c728a6 /utests
parent116a365aefeb8eadf85fc787b9720caaafe30b2a (diff)
downloadbeignet-8bc5d2852eedf9613d58276ab06d7e58570b885f.tar.gz
Utest: Refine utest_run -l option
Refine old -l to test cases that can run -la for all test cases -li for test cases with issue Signed-off-by: Pan Xiuli <xiuli.pan@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests')
-rw-r--r--utests/utest.cpp29
-rw-r--r--utests/utest.hpp4
-rw-r--r--utests/utest_run.cpp18
3 files changed, 43 insertions, 8 deletions
diff --git a/utests/utest.cpp b/utests/utest.cpp
index dac6c287..336fe679 100644
--- a/utests/utest.cpp
+++ b/utests/utest.cpp
@@ -248,9 +248,30 @@ void UTest::runAllBenchMark(void) {
void UTest::listAllCases()
{
if (utestList == NULL) return;
- for (size_t i = 0; i < utestList->size(); ++i) {
- const UTest &utest = (*utestList)[i];
- if (utest.fn == NULL) continue;
+ for (size_t i = 0; i < utestList->size(); ++i) {
+ const UTest &utest = (*utestList)[i];
+ if (utest.fn == NULL)
+ continue;
std::cout << utest.name << std::endl;
- }
+ }
+}
+void UTest::listCasesCanRun()
+{
+ if (utestList == NULL) return;
+ for (size_t i = 0; i < utestList->size(); ++i) {
+ const UTest &utest = (*utestList)[i];
+ if (utest.fn == NULL || utest.haveIssue || utest.isBenchMark)
+ continue;
+ std::cout << utest.name << std::endl;
+ }
+}
+void UTest::listCasesWithIssue()
+{
+ if (utestList == NULL) return;
+ for (size_t i = 0; i < utestList->size(); ++i) {
+ const UTest &utest = (*utestList)[i];
+ if (utest.fn == NULL || !utest.haveIssue || utest.isBenchMark)
+ continue;
+ std::cout << utest.name << std::endl;
+ }
}
diff --git a/utests/utest.hpp b/utests/utest.hpp
index 3e9f077e..ca233aa7 100644
--- a/utests/utest.hpp
+++ b/utests/utest.hpp
@@ -76,6 +76,10 @@ struct UTest
static void runAll(void);
/*! List all test cases */
static void listAllCases(void);
+ /*! List test cases that can run*/
+ static void listCasesCanRun(void);
+ /*! List test cases with issue*/
+ static void listCasesWithIssue(void);
/*! Statistics struct */
static RStatistics retStatistics;
/*! Do run a test case actually */
diff --git a/utests/utest_run.cpp b/utests/utest_run.cpp
index 380d738a..1866d9a3 100644
--- a/utests/utest_run.cpp
+++ b/utests/utest_run.cpp
@@ -26,13 +26,14 @@
#include "utest_helper.hpp"
#include "utest_exception.hpp"
#include <iostream>
+#include <string.h>
#include <getopt.h>
-static const char *shortopts = "c:j:lanh";
+static const char *shortopts = "c:j:l::anh";
struct option longopts[] = {
{"casename", required_argument, NULL, 'c'},
{"jobs", required_argument, NULL, 'j'},
-{"list", no_argument, NULL, 'l'},
+{"list", optional_argument, NULL, 'l'},
{"all", no_argument, NULL, 'a'},
{"allnoissue", no_argument, NULL, 'n'},
{"help", no_argument, NULL, 'h'},
@@ -48,7 +49,7 @@ Usage:\n\
option:\n\
-c <casename>: run sub-case named 'casename'\n\
-j <number> : specifies the 'number' of jobs (multi-thread)\n\
- -l : list all the available case name\n\
+ -l <a/i> : list case name that can run(a for all case, i for case with issue)\n\
-a : run all test cases\n\
-n : run all test cases without known issue (default option)\n\
-h : display this usage\n\
@@ -103,7 +104,16 @@ int main(int argc, char *argv[])
break;
case 'l':
- UTest::listAllCases();
+ if (optarg == NULL)
+ UTest::listCasesCanRun();
+ else if (strcmp(optarg,"a") == 0)
+ UTest::listAllCases();
+ else if (strcmp(optarg,"i") == 0)
+ UTest::listCasesWithIssue();
+ else {
+ usage();
+ exit(1);
+ }
break;
case 'a':