diff options
author | Yi Sun <yi.sun@intel.com> | 2014-04-01 16:31:26 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-04-02 13:08:35 +0800 |
commit | 684608ba6459c8a987ead861a7efa22979e79c4c (patch) | |
tree | acfc61d5fe533b3cccfa7051f759c51dd89db1fd /utests/utest.hpp | |
parent | 093c12c5d90bc3df4aa4ce55912c005a10f070da (diff) | |
download | beignet-684608ba6459c8a987ead861a7efa22979e79c4c.tar.gz |
Statistics of case running
summary:
-----------------
1. Add struct RStatistics to count passed number(passCount), failed number(failCount), finished run number(finishrun).
2. Print statistics line , if the termial is too narrow, doesn't print it:
......
test_load_program_from_bin() [SUCCESS]
profiling_exec() [SUCCESS]
enqueue_copy_buf() [SUCCESS]
[run/total: 656/656] pass: 629; fail: 25; pass rate: 0.961890
3. If case crashes, count it as failed, add the function to show statistic summary.
4. When all cases finished, list a summary like follows:
summary:
----------
total: 656
run: 656
pass: 629
fail: 25
pass rate: 0.961890
5. If ./utest_run &> log, the log will be a little messy, tring the following command to analyse the log:
sed 's/\r/\n/g' log | egrep "\w*\(\)" | sed -e 's/\s//g'
After analysed:
-----------------
......
builtin_minmag_float2()[SUCCESS]
builtin_minmag_float4()[SUCCESS]
builtin_minmag_float8()[SUCCESS]
builtin_minmag_float16()[SUCCESS]
builtin_nextafter_float()[FAILED]
builtin_nextafter_float2()[FAILED]
builtin_nextafter_float4()[FAILED]
......
6. Fix one issue, print out the crashed case name.
7. Delete the debug line in utests/compiler_basic_arithmetic.cpp, which
output the kernel name.
8. Define function statistics() in struct UTest, which called by "utest_run -a/-c/-n".
We just call this function to run each case, and print the statistics line.
Reviewed-by: "Song, Ruiling" <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/utest.hpp')
-rw-r--r-- | utests/utest.hpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/utests/utest.hpp b/utests/utest.hpp index 01d4a8ce..e6a77490 100644 --- a/utests/utest.hpp +++ b/utests/utest.hpp @@ -31,6 +31,14 @@ #include <vector> #include <iostream> +/*! struct for statistics */ +struct RStatistics +{ + size_t passCount; + size_t failCount; + size_t finishrun; +}; + /*! Quick and dirty unit test system with registration */ struct UTest { @@ -58,6 +66,10 @@ struct UTest static void runAll(void); /*! List all test cases */ static void listAllCases(void); + /*! Statistics struct */ + static RStatistics retStatistics; + /*! Do run a test case actually */ + static void do_run(struct UTest utest); }; /*! Register a new unit test */ @@ -84,11 +96,13 @@ struct UTest do { \ try { \ EXPR; \ - std::cout << " " << #EXPR << " [SUCCESS]" << std::endl; \ + std::cout << " [SUCCESS]"; \ + UTest::retStatistics.passCount += 1; \ } \ catch (Exception e) { \ - std::cout << " " << #EXPR << " [FAILED]" << std::endl; \ - std::cout << " " << e.what() << std::endl; \ + std::cout << " [FAILED]"; \ + std::cout << "\n " << e.what(); \ + UTest::retStatistics.failCount++; \ } \ } while (0) @@ -96,10 +110,12 @@ struct UTest do { \ try { \ EXPR; \ - std::cout << " " << #EXPR << " [FAILED]" << std::endl; \ + std::cout << " [FAILED]"; \ + retStatistics.failCount++; \ } \ catch (gbe::Exception e) { \ - std::cout << " " << #EXPR << " [SUCCESS]" << std::endl; \ + std::cout << " [SUCCESS]"; \ + retStatistics.passCount++; \ } \ } while (0) |