From 4f3ae823a9f7bfb65ad0f132baaf4b1ae8f3c5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sun, 4 Nov 2018 21:07:04 +0200 Subject: [PATCH] Speed up log copying The collection of the various artifacts generated by a test case and the core dump detection is now done in the same SSH command. This removes the extra overhead that it added. --- maxscale-system-test/testconnections.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 984599f4d..0cc9d5fcc 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -818,27 +818,25 @@ int TestConnections::copy_maxscale_logs(double timestamp) system(sys); if (strcmp(maxscales->IP[i], "127.0.0.1") != 0) { - maxscales->ssh_node_f(i, - true, - "rm -rf %s/logs; mkdir %s/logs; \ - %s cp %s/*.log %s/logs/; \ - %s cp /tmp/core* %s/logs/;\ - %s cp %s %s/logs/;\ - %s chmod 777 -R %s/logs", + int rc = maxscales->ssh_node_f(i, true, + "rm -rf %s/logs;" + "mkdir %s/logs;" + "cp %s/*.log %s/logs/;" + "cp /tmp/core* %s/logs/;" + "cp %s %s/logs/;" + "chmod 777 -R %s/logs;" + "ls /tmp/core* && exit 42;", maxscales->access_homedir[i], maxscales->access_homedir[i], - maxscales->access_sudo[i], maxscales->maxscale_log_dir[i], maxscales->access_homedir[i], - maxscales->access_sudo[i], maxscales->access_homedir[i], - maxscales->access_sudo[i], maxscales->maxscale_cnf[i], maxscales->access_homedir[i], - maxscales->access_sudo[i], maxscales->access_homedir[i]); sprintf(sys, "%s/logs/*", maxscales->access_homedir[i]); maxscales->copy_from_node(i, sys, log_dir_i); + expect(rc != 42, "Test should not generate core files"); } else { @@ -847,10 +845,6 @@ int TestConnections::copy_maxscale_logs(double timestamp) maxscales->ssh_node_f(i, true, "cp %s %s/", maxscales->maxscale_cnf[i], log_dir_i); maxscales->ssh_node_f(i, true, "chmod a+r -R %s", log_dir_i); } - - const char* command = "ls /tmp/core* && exit 42"; - int rc = maxscales->ssh_node_f(i, true, "%s", command); - expect(rc != 42, "Test should not generate core files"); } return 0; }