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-md5
    =================

    Traceback (most recent call last):
      File "[...]/scripts/src/tools/../../../tools/nv_data-md5.py", line 69, in 
<module>
        rc = main()
      File "[...]/scripts/src/tools/../../../tools/nv_data-md5.py", line 64, in 
main
        nv_data_md5 = NvDataMD5()
      File "[...]/scripts/src/tools/../../../tools/nv_data-md5.py", line 39, in 
__init__
        self.nv_data_md5 = sh.Command(srcdir + os.sep + 'nv_data-md5')
      File "/usr/lib/python3.9/site-packages/sh.py", line 1342, in __init__
        raise CommandNotFound(path)
    sh.CommandNotFound: ../../../tools/nv_data-md5
    FAIL nv_data-md5.py (exit status: 1)

Signed-off-by: Denis 'GNUtoo' Carikli <gnu...@cyberdimension.org>
---
 tools/nv_data-md5.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/nv_data-md5.py b/tools/nv_data-md5.py
index 2dc98ab..54a8ad1 100755
--- a/tools/nv_data-md5.py
+++ b/tools/nv_data-md5.py
@@ -32,11 +32,17 @@ def get_output(data):
 class NvDataMD5(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_md5 = sh.Command(srcdir + os.sep + 'nv_data-md5')
+        command_path = ''
+        if srcdir:
+            command_path = '.' + os.sep + 'nv_data-md5'
+        # Enable to run tests without automake
+        else:
+            command_path = os.path.dirname(sys.argv[0]) \
+                + os.sep \
+                + 'nv_data-md5'
+
+        self.nv_data_md5 = sh.Command(command_path)
     def test_help(self):
         try:
             self.nv_data_md5()
-- 
2.34.1

_______________________________________________
Replicant mailing list
Replicant@osuosl.org
https://lists.osuosl.org/mailman/listinfo/replicant

Reply via email to