[Fuego] [kselftest] Separating testcases into their corresponding group

Hoang Van Tuyen tuyen.hoangvan at toshiba-tsdv.com
Tue Nov 14 04:14:21 UTC 2017


Hi Daniel,

Thanks for your recommendation. I updated the patch.

Hi Tim,

Please ignore the patch in the previous email and check the patch in 
this email.

Thanks

Tuyen


On 11/14/2017 10:05 AM, Daniel Sangorrin wrote:
> Hi Tuyen,
>
> I noticed that the file output_all is not closed.
>
> You could add a output_all.close() or better, use a "with" statement like this:
>
> with open(plib.TEST_LOG,'r') as f:
>     lines = f.readlines()
>
> # By the way, I noticed that ltp_process.py has the same issue
>
> Please, could you modify it and send again?
>
> Thanks,
> Daniel
>
>> -----Original Message-----
>> From: fuego-bounces at lists.linuxfoundation.org [mailto:fuego-bounces at lists.linuxfoundation.org] On Behalf Of Hoang Van Tuyen
>> Sent: Tuesday, November 14, 2017 11:48 AM
>> To: Bird, Timothy; fuego at lists.linuxfoundation.org
>> Subject: [Fuego] [kselftest] Separating testcases into their corresponding group
>>
>> Hi Tim,
>>
>> The current parser.py is NOT putting testcases into their corresponding group. The group test appears
>>
>>
>> in the log as: "Running tests in <group>" and the test case appears as: "selftests: <testcase> [PASS]".
>>
>> So, I have modified parser.py for separating the testcases into groups by checking the testlog
>>
>>
>> and parsing it line by line appropriately.
>>
>> Additionally, some testcases are failed causing the whole test to be failed on docker.
>>
>> I have added criteria.json so that the test passes on docker.
>>
>> Could you please review and consider applying the patch file in the attachment?
>>
>> Note: The patch is for master branch
>>
>>
>> Best regards,
>>
>> Tuyen
>>
>>
>> --
>> ================================================================
>> Hoang Van Tuyen (Mr.)
>> TOSHIBA SOFTWARE DEVELOPMENT (VIETNAM) CO., LTD.
>> 16th Floor, VIT Building, 519 Kim Ma Str., Ba Dinh Dist., Hanoi, Vietnam
>> Tel: 84-4-22208801 (Company) - Ext.251
>> Fax: 84-4-22208802 (Company)
>> Email: tuyen.hoangvan at toshiba-tsdv.com <mailto:tuyen.hoangvan at toshiba-tsdv.com>
>> ================================================================
>

-- 
================================================================
Hoang Van Tuyen (Mr.)
TOSHIBA SOFTWARE DEVELOPMENT (VIETNAM) CO., LTD.
16th Floor, VIT Building, 519 Kim Ma Str., Ba Dinh Dist., Hanoi, Vietnam
Tel: 84-4-22208801 (Company) - Ext.251
Fax: 84-4-22208802 (Company)
Email: tuyen.hoangvan at toshiba-tsdv.com
================================================================

-------------- next part --------------
From ca9549d9f470c761226d7a1fd8384bd84143f5e5 Mon Sep 17 00:00:00 2001
From: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
Date: Tue, 14 Nov 2017 10:54:16 +0700
Subject: [PATCH] kselftest: fix parser.py and add criteria.json

The current parser.py is NOT putting testcases into their corresponding group.
So, modify the parser.py for separating testcases into groups.
Also, add criteria.json so that the test passes on docker.

Signed-off-by: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
---
 engine/tests/Functional.kselftest/criteria.json | 13 +++++++++++++
 engine/tests/Functional.kselftest/parser.py     | 19 +++++++++++++++----
 2 files changed, 28 insertions(+), 4 deletions(-)
 create mode 100644 engine/tests/Functional.kselftest/criteria.json

diff --git a/engine/tests/Functional.kselftest/criteria.json b/engine/tests/Functional.kselftest/criteria.json
new file mode 100644
index 0000000..c2feb2c
--- /dev/null
+++ b/engine/tests/Functional.kselftest/criteria.json
@@ -0,0 +1,13 @@
+{
+    "schema_version":"1.0",
+    "criteria":[
+        {
+            "tguid":"exec",
+            "fail_ok_list": ["execveat"]
+        },
+        {
+            "tguid":"timers",
+            "fail_ok_list": ["rtctest"]
+        }
+    ]
+}
diff --git a/engine/tests/Functional.kselftest/parser.py b/engine/tests/Functional.kselftest/parser.py
index fbec735..e61ae54 100755
--- a/engine/tests/Functional.kselftest/parser.py
+++ b/engine/tests/Functional.kselftest/parser.py
@@ -5,11 +5,22 @@ import os, re, sys
 sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
 import common as plib
 
-matches = plib.parse_log("^selftests: (.*) \[(.*)\]$")
+with open(plib.TEST_LOG,'r') as f:
+    lines = f.readlines()
+
 results = {}
-for m in matches:
-    testcase = m[0]
-    results[testcase] = "PASS" if m[1] == 'PASS' else "FAIL"
+testset_regex = re.compile("^Running tests in")
+testcase_regex = re.compile("^selftests:")
+for line in lines:
+    fields = line.split()
+    m = testset_regex.match(line)
+    if m is not None:
+        test_set = fields[3]
+        continue
+    m = testcase_regex.match(line)
+    if m is not None:
+        test_case = fields[1]
+        results[test_set +'.' + test_case] = "PASS" if fields[2] == '[PASS]' else "FAIL"
 
 plib.process(results)
 
-- 
2.1.4
-------------- next part --------------
-- 
This mail was scanned by BitDefender
For more information please visit http://www.bitdefender.com


More information about the Fuego mailing list