From 0777ba1f687956bc0e326d0576d8570cdbdcec96 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Mon, 24 Jan 2022 23:32:09 +0100 Subject: tests: nv_data-imei: fix test with out of tree builds When running the tests in an out of tree build directory (here in scripts/src/), without that fix, we have the following error in src/samsung-ipc/tests/test-suite.log when running 'make check': FAIL: nv_data-imei ================== Traceback (most recent call last): File "[...]/scripts/src/tools/../../../tools/nv_data-imei.py", line 122, in rc = main() File "[...]/scripts/src/tools/../../../tools/nv_data-imei.py", line 117, in main nv_data_imei = NvDataImei() File "[...]/scripts/src/tools/../../../tools/nv_data-imei.py", line 53, in __init__ self.nv_data_imei = sh.Command(srcdir + os.sep + 'nv_data-imei') File "/usr/lib/python3.9/site-packages/sh.py", line 1342, in __init__ raise CommandNotFound(path) sh.CommandNotFound: ../../../tools/nv_data-imei FAIL nv_data-imei.py (exit status: 1) Signed-off-by: Denis 'GNUtoo' Carikli --- tools/nv_data-imei.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/nv_data-imei.py b/tools/nv_data-imei.py index dbe9cfb..c3e9351 100755 --- a/tools/nv_data-imei.py +++ b/tools/nv_data-imei.py @@ -46,11 +46,18 @@ def get_output(data): class NvDataImei(object): def __init__(self): srcdir = os.environ.get('srcdir', None) - # Enable also to test without automake - if not srcdir: - srcdir = os.path.dirname(sys.argv[0]) - self.nv_data_imei = sh.Command(srcdir + os.sep + 'nv_data-imei') + command_path = '' + if srcdir: + command_path = '.' + os.sep + 'nv_data-imei' + # Enable to run tests without automake + else: + command_path = os.path.dirname(sys.argv[0]) \ + + os.sep \ + + 'nv_data-imei' + + self.nv_data_imei = sh.Command(command_path) + def test_help(self): try: self.nv_data_imei('') -- cgit v1.2.3