summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/my_manage.c10
-rw-r--r--mysql-test/mysql_test_run_new.c130
2 files changed, 86 insertions, 54 deletions
diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c
index 472b0d32683..1f006f7ab90 100644
--- a/mysql-test/my_manage.c
+++ b/mysql-test/my_manage.c
@@ -327,7 +327,7 @@ int spawn(char *path, arg_list_t *al, int join, char *input,
int spawn(char *path, arg_list_t *al, int join, char *input,
char *output, char *error, HANDLE *pid)
{
- intptr_t result;
+ bool result;
int i;
STARTUPINFO startup_info;
PROCESS_INFORMATION process_information;
@@ -665,7 +665,11 @@ void del_tree(char *dir)
rmdir(dir);
#else
struct _finddata_t parent;
+#if defined(_MSC_VER) && _MSC_VER > 1200
intptr_t handle;
+#else
+ long handle;
+#endif /* _MSC_VER && _MSC_VER > 1200 */
char temp[FN_REFLEN];
char mask[FN_REFLEN];
@@ -728,7 +732,11 @@ int removef(const char *format, ...)
va_list ap;
char path[FN_REFLEN];
struct _finddata_t parent;
+#if defined(_MSC_VER) && _MSC_VER > 1200
intptr_t handle;
+#else
+ long handle;
+#endif /* _MSC_VER && _MSC_VER > 1200 */
char temp[FN_REFLEN];
char *p;
diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c
index fe13d71c1c2..bdebe912b97 100644
--- a/mysql-test/mysql_test_run_new.c
+++ b/mysql-test/mysql_test_run_new.c
@@ -37,7 +37,8 @@
#include <sys/mode.h>
#endif
#ifdef __WIN__
-#include <Shlwapi.h>
+#include <windows.h>
+#include <shlwapi.h>
#include <direct.h>
#endif
@@ -89,15 +90,25 @@ static char master_socket[FN_REFLEN]= "./var/tmp/master.sock";
static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock";
#endif
+#define MAX_COUNT_TESTES 1024
+
+#ifdef __WIN__
+# define sting_compare_func _stricmp
+#else
+# ifdef HAVE_STRCASECMP
+# define sting_compare_func strcasecmp
+# else
+# define sting_compare_func strcmp
+# endif
+#endif
+
/* comma delimited list of tests to skip or empty string */
#ifndef __WIN__
static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix ";
#else
/*
The most ignore testes contain the calls of system command
-*/
-#define MAX_COUNT_TESTES 1024
-/*
+
lowercase_table3 is disabled by Gerg
system_mysql_db_fix is disabled by Gerg
sp contains a command system
@@ -1437,12 +1448,11 @@ void setup(char *file __attribute__((unused)))
/*
Compare names of testes for right order
*/
-#ifdef __WIN__
int compare( const void *arg1, const void *arg2 )
{
- return _stricmp( * ( char** ) arg1, * ( char** ) arg2 );
+ return sting_compare_func( * ( char** ) arg1, * ( char** ) arg2 );
}
-#endif
+
/******************************************************************************
@@ -1454,6 +1464,10 @@ int compare( const void *arg1, const void *arg2 )
int main(int argc, char **argv)
{
int is_ignore_list= 0;
+ char **names= 0;
+ char **testes= 0;
+ int name_index;
+ int index;
/* setup */
setup(argv[0]);
@@ -1517,6 +1531,11 @@ int main(int argc, char **argv)
else
{
/* run all tests */
+ testes= malloc(MAX_COUNT_TESTES*sizeof(void*));
+ if (!testes)
+ die("can not allcate memory for sorting");
+ names= testes;
+ name_index= 0;
#ifndef __WIN__
struct dirent *entry;
DIR *parent;
@@ -1534,74 +1553,79 @@ int main(int argc, char **argv)
/* find the test suffix */
if ((position= strinstr(test, TEST_SUFFIX)) != 0)
{
- /* null terminate at the suffix */
- *(test + position - 1)= '\0';
- /* run test */
- run_test(test);
+ if (name_index < MAX_COUNT_TESTES)
+ {
+ /* null terminate at the suffix */
+ *(test + position - 1)= '\0';
+ /* insert test */
+ *names= malloc(FN_REFLEN);
+ strcpy(*names,test);
+ names++;
+ name_index++;
+ }
+ else
+ die("can not sort files, array is overloaded");
}
}
closedir(parent);
}
#else
- struct _finddata_t dir;
- intptr_t handle;
- char test[FN_LEN];
- char mask[FN_REFLEN];
- char *p;
- int position;
- char **names= 0;
- char **testes= 0;
- int name_index;
- int index;
+ {
+ struct _finddata_t dir;
+ int* handle;
+ char test[FN_LEN];
+ char mask[FN_REFLEN];
+ char *p;
+ int position;
- /* single test */
- single_test= FALSE;
+ /* single test */
+ single_test= FALSE;
- snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
+ snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
- if ((handle=_findfirst(mask,&dir)) == -1L)
- {
- die("Unable to open tests directory.");
- }
+ if ((handle=_findfirst(mask,&dir)) == -1L)
+ {
+ die("Unable to open tests directory.");
+ }
- names= malloc(MAX_COUNT_TESTES*4);
- testes= names;
- name_index= 0;
- do
- {
- if (!(dir.attrib & _A_SUBDIR))
+ do
{
- strcpy(test, strlwr(dir.name));
-
- /* find the test suffix */
- if ((position= strinstr(test, TEST_SUFFIX)) != 0)
+ if (!(dir.attrib & _A_SUBDIR))
{
- p= test + position - 1;
- /* null terminate at the suffix */
- *p= 0;
-
- /* insert test */
- *names= malloc(FN_REFLEN);
- strcpy(*names,test);
- names++;
- name_index++;
+ strcpy(test, strlwr(dir.name));
+
+ /* find the test suffix */
+ if ((position= strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ if (name_index < MAX_COUNT_TESTES)
+ {
+ /* null terminate at the suffix */
+ *(test + position - 1)= '\0';
+ /* insert test */
+ *names= malloc(FN_REFLEN);
+ strcpy(*names,test);
+ names++;
+ name_index++;
+ }
+ else
+ die("can not sort files, array is overloaded");
+ }
}
- }
- }while (_findnext(handle,&dir) == 0);
-
- _findclose(handle);
+ }while (_findnext(handle,&dir) == 0);
+ _findclose(handle);
+ }
+#endif
qsort( (void *)testes, name_index, sizeof( char * ), compare );
- for (index= 0; index <= name_index; index++)
+ for (index= 0; index < name_index; index++)
{
run_test(testes[index]);
free(testes[index]);
}
free(testes);
-#endif
}
/* stop server */