aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorduerpei <duep.fnst@fujitsu.com>2023-04-18 13:16:03 +0800
committerdu erp <duep.fnst@fujitsu.com>2023-04-18 05:52:47 +0000
commit9b9fd4724424c9758cdb5f66b66ae61da177a8a6 (patch)
treec84cc92bd8265800201960e89c4e3331b390f100
parent97bc739f6178298a15989ba3ca2638a36875762d (diff)
ltp/cve : set environment variables
If the kernel config file cannot be found, set the environment variable "KCONFIG_SKIP_CHECK" = "True" to avoid some case errors in ltp/cve. The format of the case error report is as follows: <<<test_output>>> incrementing stop tst_kconfig.c:65: TINFO: Couldn't locate kernel config! tst_kconfig.c:201: TBROK: Cannot parse kernel .config Bug-AGL: SPEC-4755 Signed-off-by: duerpei <duep.fnst@fujitsu.com> Change-Id: Idbe419ee2938436196893389c69a706b0083431e
-rw-r--r--tests/LTP/cve/run_tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/LTP/cve/run_tests.py b/tests/LTP/cve/run_tests.py
index cbe86fd..f8e864f 100644
--- a/tests/LTP/cve/run_tests.py
+++ b/tests/LTP/cve/run_tests.py
@@ -1,4 +1,7 @@
+import os
import pytest
+import pathlib
+import platform
from tests.LTP.agl_test_ltp_base import LTPBase
@@ -6,11 +9,23 @@ class CveBase(LTPBase):
def __init__(self):
super().__init__(test_name="cve")
+ def set_test_env(self):
+ # check into /proc/config.gz
+ path_Obj_gz = pathlib.Path("/proc/config.gz")
+ # check into /lib.modules/ for .config
+ release_info = platform.release()
+ config_file_path = "/lib/modules/" + release_info + "/build/.config"
+ path_Obj_config = pathlib.Path(config_file_path)
+ if not path_Obj_gz.is_file() and not path_Obj_config.is_file():
+ # set ENV "KCONFIG_SKIP_CHECK" to skip .config check
+ os.environ['KCONFIG_SKIP_CHECK'] = "True"
+
instance = CveBase()
test_case_list = instance.get_test_case_list()
@pytest.fixture(scope='module')
def testbase():
+ instance.set_test_env()
yield instance
#package log files and make report file
instance.log_report()