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.
This commit is contained in:
Markus Mäkelä
2018-11-04 21:07:04 +02:00
parent ff9b26b7fa
commit 4f3ae823a9

View File

@ -818,27 +818,25 @@ int TestConnections::copy_maxscale_logs(double timestamp)
system(sys); system(sys);
if (strcmp(maxscales->IP[i], "127.0.0.1") != 0) if (strcmp(maxscales->IP[i], "127.0.0.1") != 0)
{ {
maxscales->ssh_node_f(i, int rc = maxscales->ssh_node_f(i, true,
true, "rm -rf %s/logs;"
"rm -rf %s/logs; mkdir %s/logs; \ "mkdir %s/logs;"
%s cp %s/*.log %s/logs/; \ "cp %s/*.log %s/logs/;"
%s cp /tmp/core* %s/logs/;\ "cp /tmp/core* %s/logs/;"
%s cp %s %s/logs/;\ "cp %s %s/logs/;"
%s chmod 777 -R %s/logs", "chmod 777 -R %s/logs;"
"ls /tmp/core* && exit 42;",
maxscales->access_homedir[i], maxscales->access_homedir[i],
maxscales->access_homedir[i], maxscales->access_homedir[i],
maxscales->access_sudo[i],
maxscales->maxscale_log_dir[i], maxscales->maxscale_log_dir[i],
maxscales->access_homedir[i], maxscales->access_homedir[i],
maxscales->access_sudo[i],
maxscales->access_homedir[i], maxscales->access_homedir[i],
maxscales->access_sudo[i],
maxscales->maxscale_cnf[i], maxscales->maxscale_cnf[i],
maxscales->access_homedir[i], maxscales->access_homedir[i],
maxscales->access_sudo[i],
maxscales->access_homedir[i]); maxscales->access_homedir[i]);
sprintf(sys, "%s/logs/*", maxscales->access_homedir[i]); sprintf(sys, "%s/logs/*", maxscales->access_homedir[i]);
maxscales->copy_from_node(i, sys, log_dir_i); maxscales->copy_from_node(i, sys, log_dir_i);
expect(rc != 42, "Test should not generate core files");
} }
else 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, "cp %s %s/", maxscales->maxscale_cnf[i], log_dir_i);
maxscales->ssh_node_f(i, true, "chmod a+r -R %s", 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; return 0;
} }