From 278b5729a44837e37fe13611518c1babc8de00df Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Fri, 19 Jun 2020 13:15:56 +0200 Subject: Model and variant type are obtained from kernel cmdline instead of setup.xml. Python checks if they exist and can generate an error message to the DB if they are missing. --- test-cli/test/helpers/cmdline.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test-cli/test/helpers/cmdline.py (limited to 'test-cli/test/helpers/cmdline.py') diff --git a/test-cli/test/helpers/cmdline.py b/test-cli/test/helpers/cmdline.py new file mode 100644 index 0000000..fad81ac --- /dev/null +++ b/test-cli/test/helpers/cmdline.py @@ -0,0 +1,28 @@ + +class LinuxKernel: + + __kernel_vars = {} + + def __init__(self): + self.parse_kernel_cmdline() + + def parse_kernel_cmdline(self): + cmdline = open('/proc/cmdline', 'rb').read().decode() + cmd_array = cmdline.split() + i = 0 + for f in cmdline.split(): + pos = f.find('=') + if pos == -1: + cmd_array[i - 1] = cmd_array[i - 1] + " " + f + cmd_array.remove(cmd_array[i]) + else: + i += 1 + self.__kernel_vars = {} + for f in cmd_array: + dat = f.split('=') + self.__kernel_vars[dat[0]] = dat[1] + + def getkvar(self, vName, vdefault): + if vName in self.__kernel_vars: + return self.__kernel_vars[vName] + return vdefault -- cgit v1.1 From d46bce422fd03cd57d1ba336361da17d6efb48db Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Fri, 31 Jul 2020 02:07:37 +0200 Subject: TEST restructure --- test-cli/test/helpers/cmdline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test-cli/test/helpers/cmdline.py') diff --git a/test-cli/test/helpers/cmdline.py b/test-cli/test/helpers/cmdline.py index fad81ac..db94a1c 100644 --- a/test-cli/test/helpers/cmdline.py +++ b/test-cli/test/helpers/cmdline.py @@ -1,5 +1,5 @@ -class LinuxKernel: +class LinuxKernelCmd: __kernel_vars = {} -- cgit v1.1