Added a check for MySQL client libraries for the connection tests and re-enabled the tests.

This commit is contained in:
Markus Makela
2014-11-09 21:01:39 +02:00
parent 5490954e43
commit 37fa9668a9
5 changed files with 43 additions and 18 deletions

View File

@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(int argc, char** argv)
{
@ -12,17 +13,24 @@ int main(int argc, char** argv)
unsigned int port;
int rval, iterations,i;
clock_t begin,end;
double baseline,test;
double baseline,test, ratio, result, minimum;
if(argc < 6){
fprintf(stderr,"Usage: %s <iterations> <baseline host> <baseline port> <test host> <test port>\n",argv[0]);
if(argc < 7){
fprintf(stderr,"Usage: %s <iterations> <baseline host> <baseline port> <test host> <test port> <max result ratio>\n",argv[0]);
fprintf(stderr,"The ratio is measured as:\ntest CPU time / baseline CPU time\n");
fprintf(stderr,"The test fails if this ratio is exceeded.\n");
return 1;
}
iterations = atoi(argv[1]);
host = strdup(argv[2]);
port = atoi(argv[3]);
ratio = atof(argv[6]);
rval = 0;
if(ratio <= 0.0){
return 1;
}
/**Testing direct connection to master*/
@ -73,7 +81,17 @@ int main(int argc, char** argv)
test = (double)(end - begin)/CLOCKS_PER_SEC;
printf("CPU time used in seconds:\nDirect connection: %f\nThrough MaxScale: %f\n",baseline,test);
result = test / baseline;
if(rval){
printf("Test failed: Errors during test run.");
}else if(result > ratio){
printf("Test failed: CPU time ratio was %f which exceeded the limit of %f.\n", result, ratio);
rval = 1;
}else{
printf("Test passed: CPU time ratio was %f.\n",result);
}
free(host);
return rval;
}