From cc6f6910b1ad31d03b431460431f897a8c831d65 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 31 Jan 2008 20:14:13 +0000 Subject: [PATCH] used to run node test scripts on the specified node --- qaapi/qa/tests/node_run_tests.py | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 qaapi/qa/tests/node_run_tests.py diff --git a/qaapi/qa/tests/node_run_tests.py b/qaapi/qa/tests/node_run_tests.py new file mode 100755 index 0000000..375c470 --- /dev/null +++ b/qaapi/qa/tests/node_run_tests.py @@ -0,0 +1,53 @@ +#!/usr/bin/python +import os, sys +from Test import Test +from qa import utils + +class node_run_tests(Test): + """ + Attempt to copy the specified node test files onto a node using + the plc root key and execute them. If no test files are specified, + then all are used. + """ + + def call(self, hostname, tests = None, root_key_path = "/etc/planetlab/root_ssh_key.rsa"): + + # Verify root key exists + if not os.path.isfile(root_key_path): + raise Exception, "no such private key file %(root_key_path)s" % locals() + + node_tests_path = self.config.node_tests_path + node_test_files = self.config.node_tests_path + # Verify test files + if tests: + invalid_tests = set(tests).difference(node_test_files) + if invalid_tests: + raise Exception, "Invalid test(s) %s. File(s) not found in %s" % \ + (" ".join(list(invalid_tests)), node_tests_path) + else: + tests = test_files + + # Add full path to test files + test_files_abs = [node_tests_path + os.sep + file for file in tests] + + # Copy files onto node + copy_command = "scp -i %s %s root@%s:/tmp/ " % (root_key_path, " ".join(test_files_abs), hostname) + if self.config.verbose: + utils.header(copy_command) + (status, output) = utils.commands(copy_command) + + # execute each file individually + results = {} + exe_command = "ssh -i %(root_key_path)s root@%(hostname)s /tmp/%(file)s" + for file in test_files: + command = exe_command % locals() + if self.config.verbose: + utils.header(command) + (status, output) = utils.commands(command, False) + results[file] = (status, output) + + return 1 + +if __name__ == '__main__': + args = tuple(sys.argv[1:]) + plc_remote_call()(*args) -- 2.43.0