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: ipc-modem
    ===============

    Traceback (most recent call last):
      File "[...]/scripts/src/tools/../../../tools/ipc-modem.py", line 79, in 
<module>
        rc = main()
      File "[...]/scripts/src/tools/../../../tools/ipc-modem.py", line 74, in 
main
        ipc_modem = IpcModem()
      File "[...]/scripts/src/tools/../../../tools/ipc-modem.py", line 39, in 
__init__
        ipc_modem = sh.Command(srcdir + os.sep + 'ipc-modem')
      File "/usr/lib/python3.9/site-packages/sh.py", line 1342, in __init__
        raise CommandNotFound(path)
    sh.CommandNotFound: ../../../tools/ipc-modem
    FAIL ipc-modem.py (exit status: 1)

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

diff --git a/tools/ipc-modem.py b/tools/ipc-modem.py
index 0fcd1fc..52361eb 100755
--- a/tools/ipc-modem.py
+++ b/tools/ipc-modem.py
@@ -32,11 +32,17 @@ def get_output(data):
 class IpcModem(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])
 
-        ipc_modem = sh.Command(srcdir + os.sep + 'ipc-modem')
+        command_path = ''
+        if srcdir:
+            command_path = '.' + os.sep + 'ipc-modem'
+        # Enable to run tests without automake
+        else:
+            command_path = os.path.dirname(sys.argv[0]) \
+                + os.sep \
+                + 'ipc-modem'
+
+        ipc_modem = sh.Command(command_path)
         self.ipc_modem = ipc_modem.bake('--dry-run')
 
     def test_help(self):
-- 
2.34.1

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

Reply via email to