[lnst] Repair test path error on client side.
by Jiří Pírko
commit 591734b81458c80430f412aa71b77e51b15c5958
Author: Jiří Župka <jzupka(a)redhat.com>
Date: Wed Jun 8 14:54:22 2011 +0200
Repair test path error on client side.
Signed-off-by: Jiří Župka <jzupka(a)redhat.com>
Common/Logs.py | 2 +-
Common/SlaveUtils.py | 27 ++++++++++++++++++---------
NetTest/NetTestController.py | 5 ++---
3 files changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/Common/Logs.py b/Common/Logs.py
index 34dae3e..44d4f98 100644
--- a/Common/Logs.py
+++ b/Common/Logs.py
@@ -194,7 +194,7 @@ class Logs:
':%(lineno)4.4d| %(levelname)s: '
'%(message)s', '%d/%m %H:%M:%S', " "*4)
cls.log_root = log_root
- cls.logFolder = find_test_root(__file__, "nettest")
+ cls.logFolder = os.path.dirname(sys.argv[0])
cls.logger = logger
cls.debug = debug
cls.date = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
diff --git a/Common/SlaveUtils.py b/Common/SlaveUtils.py
index c9e24d0..d8db772 100644
--- a/Common/SlaveUtils.py
+++ b/Common/SlaveUtils.py
@@ -11,23 +11,32 @@ from Common.ShellProcess import ShellProcess
def prepare_client_session(host, port, login, passwd=None, command=None,
- prompt=None):
+ prompt=None, install_path=None, test_dir=None):
"""
Copy nettest to client start client part
and create session with client part.
- @param command: Command which is started after login to guest.
- @param prompt: Prompt in guest side which means that guest side stared correctly.
+ @param command: Command which is started after login to guest, in root
+ path of installed test.
+ @param prompt: Prompt in guest side which means that guest side stared
+ correctly.
+ @param test_dir: Path in install_path where is installed testing framework.
+ @param install_path: Path to create and install test_dir folder.
"""
- s = ShellProcess("tar -cvzf nettest.tar.gz --exclude *.pyc --exclude 'Logs/*' *")
+ if install_path is None:
+ install_path = "/tmp"
+ if test_dir is None:
+ test_dir = "lnst"
+ s = ShellProcess("tar -cjf lnst.tar.bz2 --exclude *.pyc --exclude 'Logs/*' *")
s.wait()
scp_to_remote(host, port, login, passwd,
- "nettest.tar.gz","/tmp/")
+ "lnst.tar.bz2","/%s/" % (install_path))
wait_for_login(host, port, login, passwd, "PASS:",
- command = "mkdir -p /tmp/nettest && tar -xvzf "
- "/tmp/nettest.tar.gz -C /tmp/nettest/ && echo PASS:",
- timeout=60)
+ command = "mkdir -p /%(ip)s/%(td)s && tar -xvjf "
+ "/%(ip)s/lnst.tar.bz2 -C /%(ip)s/%(td)s && echo PASS:" %
+ {"td":test_dir, "ip":install_path} , timeout=60)
if prompt is None:
prompt = "Started"
+ command = "/%s/%s/%s" % (install_path, test_dir, command)
return wait_for_login(host, port, login, passwd, prompt,
- command=command, timeout=10)
+ command=command, timeout=10)
\ No newline at end of file
diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py
index 7626157..b0b2437 100644
--- a/NetTest/NetTestController.py
+++ b/NetTest/NetTestController.py
@@ -52,9 +52,8 @@ class NetTestController:
passwd = info["rootpass"]
else:
passwd = None
- session = prepare_client_session(hostname, port,
- login, passwd,
- "/tmp/nettest/nettestslave.py")
+ session = prepare_client_session(hostname, port, login, passwd,
+ "nettestslave.py")
session.add_kill_handler(self._session_die)
info["session"] = session
12 years, 10 months