summaryrefslogtreecommitdiff
path: root/netware
diff options
context:
space:
mode:
Diffstat (limited to 'netware')
-rwxr-xr-xnetware/BUILD/compile-linux-tools5
-rwxr-xr-xnetware/BUILD/compile-netware-END2
-rwxr-xr-xnetware/BUILD/mwenv8
-rwxr-xr-xnetware/BUILD/nwbootstrap10
-rw-r--r--netware/Makefile.am55
-rw-r--r--netware/isamchk.def1
-rw-r--r--netware/my_manage.c770
-rw-r--r--netware/myisamchk.def1
-rw-r--r--netware/myisamlog.def1
-rw-r--r--netware/myisampack.def1
-rw-r--r--netware/mysql_test_run.c787
-rw-r--r--netware/mysqlbinlog.def1
-rw-r--r--netware/mysqlcheck.def1
-rw-r--r--netware/mysqld_safe.c4
-rw-r--r--netware/mysqldump.def1
-rw-r--r--netware/mysqlimport.def1
16 files changed, 689 insertions, 960 deletions
diff --git a/netware/BUILD/compile-linux-tools b/netware/BUILD/compile-linux-tools
index 3590a900338..886f866d674 100755
--- a/netware/BUILD/compile-linux-tools
+++ b/netware/BUILD/compile-linux-tools
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/sh
# debug
#set -x
@@ -46,6 +46,9 @@ make clean config.h
(cd sql; make gen_lex_hash)
(cd strings; make conf_to_src)
+# so the file will be linked
+(cd sql; make sql_yacc.cc)
+
# copying required linux tools
cp extra/comp_err extra/comp_err.linux
cp libmysql/conf_to_src libmysql/conf_to_src.linux
diff --git a/netware/BUILD/compile-netware-END b/netware/BUILD/compile-netware-END
index 19d24ff8c6f..2bd59f97114 100755
--- a/netware/BUILD/compile-netware-END
+++ b/netware/BUILD/compile-netware-END
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/sh
# debug
#set -x
diff --git a/netware/BUILD/mwenv b/netware/BUILD/mwenv
index 4445bc5b2e5..e4e6d509100 100755
--- a/netware/BUILD/mwenv
+++ b/netware/BUILD/mwenv
@@ -6,9 +6,9 @@
# the default is "F:/mydev"
export MYDEV="WINE_BUILD_DIR"
-export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV/zlib-1.1.4"
-export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/mysql-VERSION/netware/BUILD;$MYDEV/zlib-1.1.4"
-export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;knetware.imp;libz.a"
+export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV;$MYDEV/zlib-1.1.4""
+export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/zlib-1.1.4;$MYDEV/mysql-VERSION/netware/BUILD"
+export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;libz.a;knetware.imp"
export WINEPATH="$MYDEV/mw/bin"
@@ -23,7 +23,7 @@ export CFLAGS='-align 8 -proc 686 -relax_pointers -dialect c'
export CXX='mwccnlm -gccincludes'
export CXXFLAGS='-align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T'
export LD='mwldnlm'
-export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -flags pseudopreemption'
+export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -map -flags pseudopreemption'
export RANLIB=:
export STRIP=:
diff --git a/netware/BUILD/nwbootstrap b/netware/BUILD/nwbootstrap
index 43b61d5254d..f54775bf054 100755
--- a/netware/BUILD/nwbootstrap
+++ b/netware/BUILD/nwbootstrap
@@ -11,7 +11,7 @@ path=`dirname $0`
# repository direcotry
repo_dir=`pwd`
-# build direcotry
+# build directory
build_dir="$HOME/mydev"
wine_build_dir="F:/mydev"
@@ -160,15 +160,15 @@ sed -e "s;WINE_BUILD_DIR;$wine_build_dir;g" \
-e "s;VERSION;$version;g" $mwenv.org > $mwenv
chmod +rwx $mwenv
-#edit the def file versions
+# edit the def file versions
echo "updating *.def file versions..."
nlm_version=`echo "$version" | sed -e "s;\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*;\1, \2, \3;"`
for file in ./netware/*.def
do
-mv -f $file $file.org
-sed -e "s;VERSION.*;VERSION $nlm_version;g" $file.org > $file
-rm $file.org
+ mv -f $file $file.org
+ sed -e "s;VERSION.*;VERSION $nlm_version;g" $file.org > $file
+ rm $file.org
done
# build linux tools
diff --git a/netware/Makefile.am b/netware/Makefile.am
index 5cc0e21f989..881dafe883e 100644
--- a/netware/Makefile.am
+++ b/netware/Makefile.am
@@ -11,37 +11,38 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
+# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES= -I$(srcdir)/../include -I../include -I..
-bin_PROGRAMS= mysqld_safe mysql_install_db mysql_test_run libmysql
-mysqld_safe_SOURCES= mysqld_safe.c my_manage.c
-mysql_install_db_SOURCES= mysql_install_db.c my_manage.c
-mysql_test_run_SOURCES= mysql_test_run.c my_manage.c
-libmysql_SOURCES= libmysqlmain.c
-libmysql_LDADD= ../libmysql/.libs/libmysqlclient.a
+INCLUDES = -I$(srcdir)/../include -I../include -I..
+bin_PROGRAMS = mysqld_safe mysql_install_db mysql_test_run libmysql
+mysqld_safe_SOURCES= mysqld_safe.c my_manage.c
+mysql_install_db_SOURCES= mysql_install_db.c my_manage.c
+mysql_test_run_SOURCES= mysql_test_run.c my_manage.c
+libmysql_SOURCES= libmysqlmain.c
+libmysql_LDADD = ../libmysql/.libs/libmysqlclient.a @openssl_libs@
+
+netware_build_files = client/mysql.def client/mysqladmin.def \
+ client/mysqlbinlog.def client/mysqlcheck.def \
+ client/mysqldump.def client/mysqlimport.def \
+ client/mysqlshow.def client/mysqltest.def \
+ extra/mysql_install.def extra/my_print_defaults.def \
+ extra/perror.def extra/replace.def \
+ extra/resolveip.def extra/comp_err.def \
+ isam/isamchk.def \
+ isam/isamlog.def isam/pack_isam.def \
+ libmysqld/libmysqld.def myisam/myisamchk.def \
+ myisam/myisamlog.def myisam/myisampack.def \
+ sql/mysqld.def
-netware_build_files = client/mysql.def client/mysqladmin.def \
- client/mysqlbinlog.def client/mysqlcheck.def \
- client/mysqldump.def client/mysqlimport.def \
- client/mysqlshow.def client/mysqltest.def \
- extra/mysql_install.def extra/my_print_defaults.def \
- extra/perror.def extra/replace.def \
- extra/resolveip.def extra/comp_err.def \
- isam/isamchk.def \
- isam/isamlog.def isam/pack_isam.def \
- libmysqld/libmysqld.def myisam/myisamchk.def \
- myisam/myisamlog.def myisam/myisampack.def \
- sql/mysqld.def
-
link_sources:
- set -x; \
- for f in $(netware_build_files); do \
- rm -f $(srcdir)/../$$f; \
- org=`echo $$f | sed -e 's/.*\/\(.*\)/\1/g'`; \
- @LN_CP_F@ $(srcdir)/$$org $(srcdir)/../$$f; \
- done;
+ set -x; \
+ for f in $(netware_build_files); do \
+ rm -f $(srcdir)/../$$f; \
+ org=`echo $$f | sed -e 's/.*\/\(.*\)/\1/g'`; \
+ @LN_CP_F@ $(srcdir)/$$org $(srcdir)/../$$f; \
+ done;
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/netware/isamchk.def b/netware/isamchk.def
index 8d756466609..69e8ac0405b 100644
--- a/netware/isamchk.def
+++ b/netware/isamchk.def
@@ -2,6 +2,7 @@
# ISAM Check
#------------------------------------------------------------------------------
MODULE libc.nlm
+SCREENNAME "MySQL ISAM Table Check Tool"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL ISAM Table Check Tool"
VERSION 4, 0
diff --git a/netware/my_manage.c b/netware/my_manage.c
index f5889766726..1c1e75990b4 100644
--- a/netware/my_manage.c
+++ b/netware/my_manage.c
@@ -1,104 +1,90 @@
/*
- Copyright (c) 2003 MySQL AB
- Copyright (c) 2003 Novell, Inc.
+ Copyright (c) 2003 Novell, Inc. All Rights Reserved.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-/*****************************************************************************
-** Utility functions for support programs
-*****************************************************************************/
-
-/* MySQL library headers */
-#include <my_global.h>
-#include <my_sys.h>
-#include <my_dir.h>
-#include <m_string.h>
-
-/* These 'should' be POSIX or ANSI */
-#include <assert.h> /* ASSERT */
-#include <stdarg.h> /* vsprintf, va_* */
-#include <sys/types.h> /* pid_t */
-#ifndef __WIN__
-#include <unistd.h> /* fork, rmdir, execve */
-#endif
-#include <stdio.h> /* freopen */
-#include <stdlib.h> /* FILE */
-#ifndef __WIN__
-#include <dirent.h> /* opendir, readdir */
-#endif
-
-#if !defined(__NETWARE__) && !defined(__WIN__)
-#include <sys/wait.h>
-#endif
-
-#if !defined(__NETWARE__)
-#include <signal.h>
-#endif
-
-/* For ASSERT -- Not totally sure about this one: */
-#if !defined(ASSERT)
-#define ASSERT(A) assert(A)
-#endif
+*/
+
+#include <stdio.h>
+#include <errno.h>
+#include <dirent.h>
+#include <string.h>
+#include <screen.h>
+#include <proc.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <assert.h>
#include "my_manage.h"
-#define __STDC__ 1
-#include "process.h"
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
/******************************************************************************
- init_args()
+ global variables
+
+******************************************************************************/
- Init an argument list.
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ init_args()
+
+ Init an argument list.
******************************************************************************/
void init_args(arg_list_t *al)
{
-#ifndef __WIN__
ASSERT(al != NULL);
-
+
al->argc = 0;
al->size = ARG_BUF;
- al->argv = (char **)my_malloc(al->size * sizeof(char *), MYF(MY_WME));
+ al->argv = malloc(al->size * sizeof(char *));
ASSERT(al->argv != NULL);
-#else
- win_args[0]= '\0';
- skip_first_param= TRUE;
-#endif
+
return;
}
/******************************************************************************
- add_arg()
-
- Add an argument to a list.
+ add_arg()
+
+ Add an argument to a list.
******************************************************************************/
-void add_arg(arg_list_t *al, const char *format, ...)
+void add_arg(arg_list_t *al, char *format, ...)
{
-#ifndef __WIN__
va_list ap;
char temp[PATH_MAX];
ASSERT(al != NULL);
- /* increase size */
- if (al->argc >= (int)al->size)
+ // increase size
+ if (al->argc >= al->size)
{
al->size += ARG_BUF;
- al->argv = (char **)my_realloc((char *)al->argv, al->size * sizeof(char *), MYF(MY_WME));
+ al->argv = realloc(al->argv, al->size * sizeof(char *));
ASSERT(al->argv != NULL);
}
@@ -108,7 +94,7 @@ void add_arg(arg_list_t *al, const char *format, ...)
vsprintf(temp, format, ap);
va_end(ap);
- al->argv[al->argc] = my_malloc(strlen(temp)+1, MYF(MY_WME));
+ al->argv[al->argc] = malloc(strlen(temp)+1);
ASSERT(al->argv[al->argc] != NULL);
strcpy(al->argv[al->argc], temp);
@@ -118,36 +104,19 @@ void add_arg(arg_list_t *al, const char *format, ...)
{
al->argv[al->argc] = NULL;
}
-#else
- va_list ap;
- char param[PATH_MAX];
- if (!skip_first_param)
- {
- va_start(ap, format);
- vsprintf(&param, format, ap);
- va_end(ap);
- strcat(win_args," ");
- strcat(win_args,param);
- }
- else
- {
- skip_first_param= FALSE;
- }
-#endif
return;
}
/******************************************************************************
- free_args()
-
- Free an argument list.
+ free_args()
+
+ Free an argument list.
******************************************************************************/
void free_args(arg_list_t *al)
{
-#ifndef __WIN__
int i;
ASSERT(al != NULL);
@@ -155,110 +124,74 @@ void free_args(arg_list_t *al)
for(i = 0; i < al->argc; i++)
{
ASSERT(al->argv[i] != NULL);
- my_free(al->argv[i], MYF(MY_WME));
+ free(al->argv[i]);
al->argv[i] = NULL;
}
- my_free((char *)al->argv, MYF(MY_WME));
+ free(al->argv);
al->argc = 0;
al->argv = NULL;
-#endif
+
return;
}
/******************************************************************************
- sleep_until_file_deleted()
-
- Sleep until the given file is no longer found.
+ sleep_until_file_deleted()
+
+ Sleep until the given file is no longer found.
******************************************************************************/
int sleep_until_file_deleted(char *pid_file)
{
- MY_STAT stat_info;
- int i, err = 0;
-#ifndef __WIN__
- for(i = 0; i < TRY_MAX; i++)
- {
- if (my_stat(pid_file, &stat_info, MYF(0)) == (MY_STAT *) NULL)
- {
- err = errno;
- break;
- }
- my_sleep(1);
- }
-#else
- switch (pid_mode)
- {
- case MASTER_PID:
- err= (WaitForSingleObject(master_server, TRY_MAX*1000) == WAIT_TIMEOUT);
- pid_mode= 0;
- break;
- case SLAVE_PID:
- err= (WaitForSingleObject(slave_server, TRY_MAX*1000) == WAIT_TIMEOUT);
- pid_mode= 0;
- break;
- };
-#endif
- return err;
+ struct stat buf;
+ int i, err;
+
+ for(i = 0; (i < TRY_MAX) && (err = !stat(pid_file, &buf)); i++) sleep(1);
+
+ if (err != 0) err = errno;
+
+ return err;
}
/******************************************************************************
- sleep_until_file_exists()
+ sleep_until_file_exists()
- Sleep until the given file exists.
+ Sleep until the given file exists.
******************************************************************************/
int sleep_until_file_exists(char *pid_file)
{
- MY_STAT stat_info;
- int i, err = 0;
-
-#ifndef __WIN__
- for(i = 0; i < TRY_MAX; i++)
- {
- if (my_stat(pid_file, &stat_info, MYF(0)) == (MY_STAT *) NULL)
- {
- err = errno;
- break;
- }
- my_sleep(1);
- }
-#else
- switch (pid_mode)
- {
- case MASTER_PID:
- WaitForSingleObject(master_server, TRY_MAX*1000);
- pid_mode= 0;
- break;
- case SLAVE_PID:
- WaitForSingleObject(slave_server, TRY_MAX*1000);
- pid_mode= 0;
- break;
- };
-#endif
-
- return err;
+ struct stat buf;
+ int i, err;
+
+ for(i = 0; (i < TRY_MAX) && (err = stat(pid_file, &buf)); i++) sleep(1);
+
+ if (err != 0) err = errno;
+
+ return err;
}
/******************************************************************************
- wait_for_server_start()
-
- Wait for the server on the given port to start.
+ wait_for_server_start()
+
+ Wait for the server on the given port to start.
******************************************************************************/
int wait_for_server_start(char *bin_dir, char *user, char *password, int port)
{
arg_list_t al;
- int err = 0, i;
+ int err, i;
+ char mysqladmin_file[PATH_MAX];
char trash[PATH_MAX];
- /* mysqladmin file */
- my_snprintf(trash, PATH_MAX, "/tmp/trash.out");
-
- /* args */
+ // mysqladmin file
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(trash, PATH_MAX, "/tmp/trash.out");
+
+ // args
init_args(&al);
add_arg(&al, "%s", mysqladmin_file);
add_arg(&al, "--no-defaults");
@@ -266,19 +199,23 @@ int wait_for_server_start(char *bin_dir, char *user, char *password, int port)
add_arg(&al, "--user=%s", user);
add_arg(&al, "--password=%s", password);
add_arg(&al, "--silent");
+
+ /** Not supported on NetWare
add_arg(&al, "-O");
add_arg(&al, "connect_timeout=10");
add_arg(&al, "-w");
+ **/
+
add_arg(&al, "--host=localhost");
add_arg(&al, "ping");
- /* NetWare does not support the connect timeout in the TCP/IP stack
- -- we will try the ping multiple times */
- for(i = 0; (i < TRY_MAX)
- && (err = spawn(mysqladmin_file, &al, TRUE, NULL,
- trash, NULL, NOT_NEED_PID)); i++) sleep(1);
-
- /* free args */
+ // NetWare does not support the connect timeout in the TCP/IP stack
+ // -- we will try the ping multiple times
+ for(i = 0; (i < TRY_MAX)
+ && (err = spawn(mysqladmin_file, &al, TRUE, NULL,
+ trash, NULL)); i++) sleep(1);
+
+ // free args
free_args(&al);
return err;
@@ -286,23 +223,20 @@ int wait_for_server_start(char *bin_dir, char *user, char *password, int port)
/******************************************************************************
- spawn()
-
- Spawn the executable at the given path with the given arguments.
+ spawn()
+
+ Spawn the given path with the given arguments.
******************************************************************************/
-
-#ifdef __NETWARE__
-
int spawn(char *path, arg_list_t *al, int join, char *input,
char *output, char *error)
{
- pid_t pid;
+ pid_t pid;
int result = 0;
wiring_t wiring = { FD_UNUSED, FD_UNUSED, FD_UNUSED };
unsigned long flags = PROC_CURRENT_SPACE | PROC_INHERIT_CWD;
- /* open wiring */
+ // open wiring
if (input)
wiring.infd = open(input, O_RDONLY);
@@ -312,14 +246,14 @@ int spawn(char *path, arg_list_t *al, int join, char *input,
if (error)
wiring.errfd = open(error, O_WRONLY | O_CREAT | O_TRUNC);
- /* procve requires a NULL */
+ // procve requires a NULL
add_arg(al, NULL);
- /* go */
+ // go
pid = procve(path, flags, NULL, &wiring, NULL, NULL, 0,
NULL, (const char **)al->argv);
- if (pid == -1)
+ if (pid == -1)
{
result = -1;
}
@@ -327,8 +261,8 @@ int spawn(char *path, arg_list_t *al, int join, char *input,
{
waitpid(pid, &result, 0);
}
-
- /* close wiring */
+
+ // close wiring
if (wiring.infd != -1)
close(wiring.infd);
@@ -338,411 +272,207 @@ int spawn(char *path, arg_list_t *al, int join, char *input,
if (wiring.errfd != -1)
close(wiring.errfd);
- return result;
+ return result;
}
-#else /* NOT __NETWARE__ */
-
-#ifdef __WIN__
-
-int my_vsnprintf_(char *to, size_t n, const char* value, ...)
-{
- char *start=to, *end=to+n-1;
- uint length, num_state, pre_zero;
- reg2 char *par;// = value;
- va_list args;
- va_start(args,value);
-
- par = va_arg(args, char *);
- while (par != NULL)
- {
- uint plen,left_len = (uint)(end-to)+1;
- if (!par) par = (char*)"(null)";
- plen = (uint) strlen(par);
- if (left_len <= plen)
- plen = left_len - 1;
- to=strnmov(to+strlen(to),par,plen);
- par = va_arg(args, char *);
- }
- va_end(args);
- DBUG_ASSERT(to <= end);
- *to='\0';
- return (uint) (to - start);
-}
-
-int spawn(char *path, arg_list_t *al, int join, char *input,
- char *output, char *error)
-{
- char *cl;
- char *arg;
- intptr_t result;
- int j;
- int err;
- STARTUPINFO startup_info;
- PROCESS_INFORMATION process_information;
- ULONG dosretval;
- int retval;
- DWORD exit_code;
- SECURITY_ATTRIBUTES process_attributes, thread_attributes;
- char command_line[1024]= "";
-
-
- memset(&startup_info,0,sizeof(STARTUPINFO));
- startup_info.cb = sizeof(STARTUPINFO);
-
- if (input)
- freopen(input, "rb", stdin);
-
- if (output)
- freopen(output, "wb", stdout);
-
- if (error)
- freopen(error, "wb", stderr);
-
- result= CreateProcess(
- path,
- &win_args,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &startup_info,
- &process_information
- );
-
- if (process_information.hProcess)
- {
- if (join)
- {
- if (WaitForSingleObject(process_information.hProcess, mysqld_timeout) == WAIT_TIMEOUT)
- {
- exit_code= -1;
- }
- else
- {
- GetExitCodeProcess(process_information.hProcess, &exit_code);
- }
- CloseHandle(process_information.hProcess);
- }
- else
- {
- exit_code= 0;
- }
- if (run_server)
- {
- switch (pid_mode)
- {
- case MASTER_PID:
- master_server= process_information.hProcess;
- break;
- case SLAVE_PID:
- slave_server= process_information.hProcess;
- break;
- };
- pid_mode= 0;
- run_server= FALSE;
- };
- }
- else
- {
- exit_code= -1;
- }
- if (input)
- freopen("CONIN$","rb",stdin);
- if (output)
- freopen("CONOUT$","wb",stdout);
- if (error)
- freopen("CONOUT$","wb",stderr);
-
- return exit_code;
-}
-
-#else /* NOT __NETWARE__, NOT __WIN__ */
-
-/* This assumes full POSIX.1 compliance */
-int spawn(char *path, arg_list_t *al, int join, char *input,
- char *output, char *error)
-{
- int result = 0;
- pid_t pid;
-
- if ((pid = fork()))
- {
- /* Remains in parent process */
- if (join && (pid != -1))
- waitpid(pid, &result, 0);
- }
- else
- {
- /* Child process */
-
- /* Reassign streams */
- if (input)
- freopen(input, "r", stdin);
-
- if (output)
- freopen(output, "w", stdout);
-
- if (error)
- freopen(error, "w", stderr);
-
- /* Spawn the process */
- execve(path, al->argv, environ);
- }
-
- return result;
-}
-
-#endif /* __WIN__ */
-
-#endif /* __NETWARE__ */
-
/******************************************************************************
- stop_server()
-
- Stop the server with the given port and pid file.
+ stop_server()
+
+ Stop the server with the given port and pid file.
******************************************************************************/
int stop_server(char *bin_dir, char *user, char *password, int port,
char *pid_file)
{
- arg_list_t al;
- int err;
+ arg_list_t al;
+ int err, i, argc = 0;
+ char mysqladmin_file[PATH_MAX];
char trash[PATH_MAX];
- my_snprintf(trash, PATH_MAX, "/tmp/trash.out");
-
- /* args */
+ // mysqladmin file
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(trash, PATH_MAX, "/tmp/trash.out");
+
+ // args
init_args(&al);
- add_arg(&al, "%s", mysqladmin_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--port=%u", port);
- add_arg(&al, "--user=%s", user);
- add_arg(&al, "--password=%s", password);
- add_arg(&al, "-O");
- add_arg(&al, "shutdown_timeout=20");
- add_arg(&al, "shutdown");
-
- /* spawn */
- if ((err = spawn(mysqladmin_file, &al, TRUE, NULL,
- trash, NULL)) == 0)
- {
- sleep_until_file_deleted(pid_file);
- }
- else
- {
+ add_arg(&al, "%s", mysqladmin_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", port);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "-O");
+ add_arg(&al, "shutdown_timeout=20");
+ add_arg(&al, "shutdown");
+
+ // spawn
+ if ((err = spawn(mysqladmin_file, &al, TRUE, NULL,
+ trash, NULL)) == 0)
+ {
+ sleep_until_file_deleted(pid_file);
+ }
+ else
+ {
pid_t pid = get_server_pid(pid_file);
+
+ // shutdown failed - kill server
+ kill_server(pid);
+
+ sleep(TRY_MAX);
- /* shutdown failed - kill server */
- kill_server(pid);
-
- sleep(TRY_MAX);
-
- /* remove pid file if possible */
- err = my_delete(pid_file, MYF(MY_WME));
+ // remove pid file if possible
+ err = remove(pid_file);
}
- /* free args */
+ // free args
free_args(&al);
- return err;
+ return err;
}
/******************************************************************************
- get_server_pid()
-
- Get the VM id with the given pid file.
+ get_server_pid()
+
+ Get the VM id with the given pid file.
******************************************************************************/
pid_t get_server_pid(char *pid_file)
{
- char buf[PATH_MAX];
- int err;
- File fd;
- char *p;
- pid_t id = 0;
-
- /* discover id */
- fd = my_open(pid_file, O_RDONLY, MYF(MY_WME));
-
- err = my_read(fd, buf, PATH_MAX, MYF(MY_WME));
-
- my_close(fd, MYF(MY_WME));
-
- if (err > 0)
- {
- /* terminate string */
- if ((p = strchr(buf, '\n')) != NULL)
- {
- *p = '\0';
-
- /* check for a '\r' */
- if ((p = strchr(buf, '\r')) != NULL)
- {
- *p = '\0';
- }
- }
- else
- {
- buf[err] = '\0';
- }
+ char buf[PATH_MAX];
+ int fd, err;
+ char *p;
+ pid_t id;
+
+ // discover id
+ fd = open(pid_file, O_RDONLY);
+
+ err = read(fd, buf, PATH_MAX);
+
+ close(fd);
+
+ if (err > 0)
+ {
+ // terminate string
+ if ((p = strchr(buf, '\n')) != NULL)
+ {
+ *p = NULL;
+
+ // check for a '\r'
+ if ((p = strchr(buf, '\r')) != NULL)
+ {
+ *p = NULL;
+ }
+ }
+ else
+ {
+ buf[err] = NULL;
+ }
+
+ id = strtol(buf, NULL, 0);
+ }
- id = strtol(buf, NULL, 0);
- }
-
return id;
}
+
/******************************************************************************
- kill_server()
-
- Force a kill of the server with the given pid.
+ kill_server()
+
+ Force a kill of the server with the given pid.
******************************************************************************/
void kill_server(pid_t pid)
{
if (pid > 0)
{
-
-#if !defined(__NETWARE__)
- /* Send SIGTERM to pid */
- kill(pid, SIGTERM);
-#else /* __NETWARE__ */
- /* destroy vm */
+ // destroy vm
NXVmDestroy(pid);
-
-#endif
-
}
}
/******************************************************************************
- del_tree()
-
- Delete the directory and subdirectories.
+ del_tree()
+
+ Delete the directory and subdirectories.
******************************************************************************/
void del_tree(char *dir)
{
- MY_DIR *current;
- uint i;
- char temp[PATH_MAX];
-
- current = my_dir(dir, MYF(MY_WME | MY_WANT_STAT));
-
- /* current is NULL if dir does not exist */
- if (current == NULL)
- return;
-
- for (i = 0; i < current->number_off_files; i++)
- {
- /* create long name */
- my_snprintf(temp, PATH_MAX, "%s/%s", dir, current->dir_entry[i].name);
-
- if (current->dir_entry[i].name[0] == '.')
- {
- /* Skip */
- }
- else if (MY_S_ISDIR(current->dir_entry[i].mystat.st_mode))
- {
- /* delete subdirectory */
- del_tree(temp);
- }
- else
- {
- /* remove file */
- my_delete(temp, MYF(MY_WME));
- }
- }
-
- my_dirend(current);
-
- /* remove directory */
- rmdir(dir);
+ DIR *parent = opendir(dir);
+ DIR *entry;
+ char temp[PATH_MAX];
+
+ if (parent == NULL)
+ {
+ return;
+ }
+
+ while((entry = readdir(parent)) != NULL)
+ {
+ // create long name
+ snprintf(temp, PATH_MAX, "%s/%s", dir, entry->d_name);
+
+ if (entry->d_name[0] == '.')
+ {
+ // Skip
+ }
+ else if (S_ISDIR(entry->d_type))
+ {
+ // delete subdirectory
+ del_tree(temp);
+ }
+ else
+ {
+ // remove file
+ remove(temp);
+ }
+ }
+
+ // remove directory
+ rmdir(dir);
}
/******************************************************************************
- removef()
-
+ removef()
+
******************************************************************************/
-int removef(const char *format, ...)
+int removef(char *format, ...)
{
- va_list ap;
+ va_list ap;
char path[PATH_MAX];
+
+ va_start(ap, format);
- va_start(ap, format);
-
- my_vsnprintf(path, PATH_MAX, format, ap);
+ vsnprintf(path, PATH_MAX, format, ap);
+
+ va_end(ap);
- va_end(ap);
-#ifdef __WIN__
- {
- MY_DIR *current;
- uint i;
- struct _finddata_t find;
- char temp[PATH_MAX];
-#ifdef _WIN64
- __int64 handle;
-#else
- long handle;
-#endif
- char *p;
-
- p= strrchr(path,'\\');
- if (p == NULL)
- {
- p= strrchr(path,'/');
- if (p == NULL)
- p= &path;
- else
- p++;
- }
- else
- p++;
-
- if ((handle=_findfirst(path,&find)) == -1L)
- return 0;
- do
- {
- strcpy(p,find.name);
- my_delete(path, MYF(MY_WME));
- } while (!_findnext(handle,&find));
- _findclose(handle);
- }
-#else
- return my_delete(path, MYF(MY_WME));
-#endif
+ return remove(path);
}
/******************************************************************************
- get_basedir()
-
+ get_basedir()
+
******************************************************************************/
void get_basedir(char *argv0, char *basedir)
{
- char temp[PATH_MAX];
- char *p;
-
- ASSERT(argv0 != NULL);
+ char temp[PATH_MAX];
+ char *p;
+
+ ASSERT(argv0 != NULL);
ASSERT(basedir != NULL);
- strcpy(temp, argv0);
-#ifndef __WIN__
- casedn_str(temp);
-#endif
- while((p = strchr(temp, '\\')) != NULL) *p = '/';
-
- if ((p = strstr(temp, "/bin/")) != NullS)
- {
- *p = '\0';
- strcpy(basedir, temp);
- }
+ strcpy(temp, strlwr(argv0));
+ while((p = strchr(temp, '\\')) != NULL) *p = '/';
+
+ if ((p = strindex(temp, "/bin/")) != NULL)
+ {
+ *p = NULL;
+ strcpy(basedir, temp);
+ }
}
diff --git a/netware/myisamchk.def b/netware/myisamchk.def
index 2222a1317e1..cdfe186058f 100644
--- a/netware/myisamchk.def
+++ b/netware/myisamchk.def
@@ -2,6 +2,7 @@
# MyISAM Check
#------------------------------------------------------------------------------
MODULE libc.nlm
+SCREENNAME "MySQL MyISAM Table Check Tool"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Check Tool"
VERSION 4, 0
diff --git a/netware/myisamlog.def b/netware/myisamlog.def
index bfa673e12be..5c4cbb23361 100644
--- a/netware/myisamlog.def
+++ b/netware/myisamlog.def
@@ -2,6 +2,7 @@
# MyISAM Log
#------------------------------------------------------------------------------
MODULE libc.nlm
+SCREENNAME "MySQL MyISAM Table Log Tool"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Log Tool"
VERSION 4, 0
diff --git a/netware/myisampack.def b/netware/myisampack.def
index 72403d2591e..9111538c2c0 100644
--- a/netware/myisampack.def
+++ b/netware/myisampack.def
@@ -2,6 +2,7 @@
# MyISAM Pack
#------------------------------------------------------------------------------
MODULE libc.nlm
+SCREENNAME "MySQL MyISAM Table Pack Tool"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Pack Tool"
VERSION 4, 0
diff --git a/netware/mysql_test_run.c b/netware/mysql_test_run.c
index fb914c355e4..e1a07baca6c 100644
--- a/netware/mysql_test_run.c
+++ b/netware/mysql_test_run.c
@@ -7,7 +7,7 @@
(at your option) any later version.
This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -16,29 +16,22 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-/* MySQL library headers */
-#include <my_global.h>
-#include <my_sys.h>
-#include <my_dir.h>
-#include <m_string.h>
-
-/* These 'should' be POSIX or ANSI */
+#include <stdlib.h>
#include <stdio.h>
-#include <stdarg.h>
-
-#ifdef __NETWARE__
+#include <errno.h>
+#include <dirent.h>
+#include <string.h>
#include <screen.h>
-#endif
+#include <nks/vm.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mode.h>
#include "my_config.h"
#include "my_manage.h"
-#ifdef __WIN__
-#include <Shlwapi.h>
-#endif
-
-
/******************************************************************************
macros
@@ -50,16 +43,16 @@
#define NW_TEST_SUFFIX ".nw-test"
#define NW_RESULT_SUFFIX ".nw-result"
-#define TEST_SUFFIX ".test"
-#define RESULT_SUFFIX ".result"
-#define REJECT_SUFFIX ".reject"
-#define OUT_SUFFIX ".out"
-#define ERR_SUFFIX ".err"
+#define TEST_SUFFIX ".test"
+#define RESULT_SUFFIX ".result"
+#define REJECT_SUFFIX ".reject"
+#define OUT_SUFFIX ".out"
+#define ERR_SUFFIX ".err"
-#define TEST_PASS "[ pass ]"
-#define TEST_SKIP "[ skip ]"
-#define TEST_FAIL "[ fail ]"
-#define TEST_BAD "[ bad ]"
+#define TEST_PASS "[ pass ]"
+#define TEST_SKIP "[ skip ]"
+#define TEST_FAIL "[ fail ]"
+#define TEST_BAD "[ bad ]"
/******************************************************************************
@@ -67,7 +60,7 @@
******************************************************************************/
-char base_dir[PATH_MAX] = "/mysql";
+char base_dir[PATH_MAX] = "sys:/mysql";
char db[PATH_MAX] = "test";
char user[PATH_MAX] = "root";
char password[PATH_MAX] = "";
@@ -75,7 +68,7 @@ char password[PATH_MAX] = "";
int master_port = 9306;
int slave_port = 9307;
-/* comma delimited list of tests to skip or empty string */
+// comma delimited list of tests to skip or empty string
char skip_test[PATH_MAX] = "";
char bin_dir[PATH_MAX];
@@ -88,6 +81,7 @@ char slave_dir[PATH_MAX];
char lang_dir[PATH_MAX];
char char_dir[PATH_MAX];
+char mysqladmin_file[PATH_MAX];
char mysqld_file[PATH_MAX];
char mysqltest_file[PATH_MAX];
char master_pid[PATH_MAX];
@@ -101,6 +95,13 @@ char slave_master_info[PATH_MAX] = "";
char master_init_script[PATH_MAX] = "";
char slave_init_script[PATH_MAX] = "";
+// OpenSSL
+char ca_cert[PATH_MAX];
+char server_cert[PATH_MAX];
+char server_key[PATH_MAX];
+char client_cert[PATH_MAX];
+char client_key[PATH_MAX];
+
int total_skip = 0;
int total_pass = 0;
int total_fail = 0;
@@ -108,6 +109,7 @@ int total_test = 0;
double total_time = 0;
+int use_openssl = FALSE;
int master_running = FALSE;
int slave_running = FALSE;
int skip_slave = TRUE;
@@ -116,30 +118,17 @@ int single_test = TRUE;
int restarts = 0;
FILE *log_fd = NULL;
-// WAX
-#include <my_getopt.h>
-
-const char* mysqld = "mysqld", *opt_exedir="client_debug";
-
-static struct my_option my_long_options[] =
-{
- {"mysqld", 'M', "Type of mysqld (without extention of file)- mysqld, mysql-nt, mysql-nt-max, mysqld-max.",
- (gptr*) &mysqld, (gptr*) &mysqld, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"exefiledir", 'e', "Directory of .exe files (client_debug or client_release).", (gptr*) &opt_exedir,
- (gptr*) &opt_exedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-};
-
/******************************************************************************
functions
-
+
******************************************************************************/
/******************************************************************************
prototypes
-
+
******************************************************************************/
void report_stats();
@@ -155,17 +144,17 @@ void mysql_restart();
int read_option(char *, char *);
void run_test(char *);
void setup(char *);
-void vlog(const char *, va_list);
-void mtr_log(const char *, ...);
-void mtr_log_info(const char *, ...);
-void mtr_log_error(const char *, ...);
-void mtr_log_errno(const char *, ...);
-void die(const char *);
+void vlog(char *, va_list);
+void log(char *, ...);
+void log_info(char *, ...);
+void log_error(char *, ...);
+void log_errno(char *, ...);
+void die(char *);
/******************************************************************************
report_stats()
-
+
Report the gathered statistics.
******************************************************************************/
@@ -173,55 +162,55 @@ void report_stats()
{
if (total_fail == 0)
{
- mtr_log("\nAll %d test(s) were successful.\n", total_test);
+ log("\nAll %d test(s) were successful.\n", total_test);
}
else
{
double percent = ((double)total_pass / total_test) * 100;
-
- mtr_log("\nFailed %u/%u test(s), %.02f%% successful.\n",
+
+ log("\nFailed %u/%u test(s), %.02f%% successful.\n",
total_fail, total_test, percent);
- mtr_log("\nThe .out and .err files in %s may give you some\n", result_dir);
- mtr_log("hint of what when wrong.\n");
- mtr_log("\nIf you want to report this error, please first read the documentation\n");
- mtr_log("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
+ log("\nThe .out and .err files in %s may give you some\n", result_dir);
+ log("hint of what when wrong.\n");
+ log("\nIf you want to report this error, please first read the documentation\n");
+ log("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
}
- mtr_log("\n%.02f total minutes elapsed in the test cases\n\n", total_time / 60);
+ log("\n%.02f total minutes elapsed in the test cases\n\n", total_time / 60);
}
/******************************************************************************
install_db()
-
+
Install the a database.
******************************************************************************/
void install_db(char *datadir)
{
arg_list_t al;
- int err;
+ int err, i;
char input[PATH_MAX];
char output[PATH_MAX];
char error[PATH_MAX];
-
+
// input file
- my_snprintf(input, PATH_MAX, "%s/bin/init_db.sql", base_dir);
- my_snprintf(output, PATH_MAX, "%s/install.out", datadir);
- my_snprintf(error, PATH_MAX, "%s/install.err", datadir);
+ snprintf(input, PATH_MAX, "%s/bin/init_db.sql", base_dir);
+ snprintf(output, PATH_MAX, "%s/install.out", datadir);
+ snprintf(error, PATH_MAX, "%s/install.err", datadir);
// args
init_args(&al);
add_arg(&al, mysqld_file);
+ add_arg(&al, "--no-defaults");
add_arg(&al, "--bootstrap");
add_arg(&al, "--skip-grant-tables");
add_arg(&al, "--basedir=%s", base_dir);
add_arg(&al, "--datadir=%s", datadir);
add_arg(&al, "--skip-innodb");
add_arg(&al, "--skip-bdb");
-
- // spawn
+ // spawn
if ((err = spawn(mysqld_file, &al, TRUE, input, output, error)) != 0)
{
die("Unable to create database.");
@@ -242,34 +231,34 @@ void mysql_install_db()
{
char temp[PATH_MAX];
- /* var directory */
- my_snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir);
+ // var directory
+ snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir);
- /* clean up old directory */
+ // clean up old direcotry
del_tree(temp);
- /* create var directory */
- my_mkdir(temp, 0700, MYF(MY_WME));
-
- /* create subdirectories */
- my_snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
- my_mkdir(temp, 0700, MYF(MY_WME));
- my_snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
- my_mkdir(temp, 0700, MYF(MY_WME));
- my_snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
- my_mkdir(temp, 0700, MYF(MY_WME));
- my_snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
- my_mkdir(temp, 0700, MYF(MY_WME));
- my_snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
- my_mkdir(temp, 0700, MYF(MY_WME));
- my_snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
- my_mkdir(temp, 0700, MYF(MY_WME));
- my_snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
- my_mkdir(temp, 0700, MYF(MY_WME));
- my_snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
- my_mkdir(temp, 0700, MYF(MY_WME));
-
- /* install databases */
+ // create var directory
+ mkdir(temp, S_IRWXU);
+
+ // create subdirectories
+ snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+
+ // install databases
install_db(master_dir);
install_db(slave_dir);
}
@@ -284,39 +273,66 @@ void mysql_install_db()
void start_master()
{
arg_list_t al;
- int err;
+ int err, i;
char master_out[PATH_MAX];
char master_err[PATH_MAX];
-
- /* remove old berkeley db log files that can confuse the server */
+ char temp[PATH_MAX], temp2[PATH_MAX];
+
+ // remove old berkeley db log files that can confuse the server
removef("%s/log.*", master_dir);
- /* remove stale binary logs */
- removef("%s/*-bin.*", master_dir);
+ // remove stale binary logs
+ removef("%s/var/log/*-bin.*", mysql_test_dir);
- /* remove stale binary logs */
- removef("%s/*.index", master_dir);
+ // remove stale binary logs
+ removef("%s/var/log/*.index", mysql_test_dir);
- /* remove master.info file */
+ // remove master.info file
removef("%s/master.info", master_dir);
- /* remove relay files */
+ // remove relay files
removef("%s/var/log/*relay*", mysql_test_dir);
- /* remove relay-log.info file */
+ // remove relay-log.info file
removef("%s/relay-log.info", master_dir);
-
- /* redirection files */
- my_snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out",
+
+ // init script
+ if (master_init_script[0] != NULL)
+ {
+ // run_init_script(master_init_script);
+
+ // TODO: use the scripts
+ if (strindex(master_init_script, "repair_part2-master.sh") != NULL)
+ {
+ FILE *fp;
+
+ // create an empty index file
+ snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir);
+ fp = fopen(temp, "wb+");
+
+ fputs("1", fp);
+
+ fclose(fp);
+ }
+
+ }
+
+ // redirection files
+ snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out",
mysql_test_dir, restarts);
- my_snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err",
+ snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err",
mysql_test_dir, restarts);
-
- /* args */
+
+ snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir);
+ mkdir(temp2,0);
+ snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir);
+ mkdir(temp2,0);
+
+ // args
init_args(&al);
add_arg(&al, "%s", mysqld_file);
add_arg(&al, "--no-defaults");
- add_arg(&al, "--log-bin=master-bin");
+ add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir);
add_arg(&al, "--server-id=1");
add_arg(&al, "--basedir=%s", base_dir);
add_arg(&al, "--port=%u", master_port);
@@ -327,12 +343,19 @@ void start_master()
add_arg(&al, "--character-sets-dir=%s", char_dir);
add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
add_arg(&al, "--language=%s", lang_dir);
-
- /* $MASTER_40_ARGS */
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ // $MASTER_40_ARGS
add_arg(&al, "--rpl-recovery-rank=1");
add_arg(&al, "--init-rpl-role=master");
-
- /* $SMALL_SERVER */
+
+ // $SMALL_SERVER
add_arg(&al, "-O");
add_arg(&al, "key_buffer_size=1M");
add_arg(&al, "-O");
@@ -340,49 +363,51 @@ void start_master()
add_arg(&al, "-O");
add_arg(&al, "max_heap_table_size=1M");
- /* $EXTRA_MASTER_OPT */
- if (master_opt[0] != '\0')
+ // $EXTRA_MASTER_OPT
+ if (master_opt[0] != NULL)
{
char *p;
+ char *temp;
p = (char *)strtok(master_opt, " \t");
- while(p)
+ if ((temp = strstr(p, "timezone")) == NULL)
{
- add_arg(&al, "%s", p);
-
- p = (char *)strtok(NULL, " \t");
+ while(p)
+ {
+ add_arg(&al, "%s", p);
+ p = (char *)strtok(NULL, " \t");
+ }
+ }
+ else
+ {
+ //do nothing
}
}
-
- /* remove the pid file if it exists */
-#ifndef __WIN__
- my_delete(master_pid, MYF(MY_WME));
-#else
- pid_mode= MASTER_PID;
- run_server= TRUE;
-#endif
-
- /* spawn */
+
+ // remove the pid file if it exists
+ remove(master_pid);
+
+ // spawn
if ((err = spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err)) == 0)
{
sleep_until_file_exists(master_pid);
-
- if ((err = wait_for_server_start(bin_dir, user, password, master_port)) == 0)
+
+ if ((err = wait_for_server_start(bin_dir, user, password, master_port)) == 0)
{
master_running = TRUE;
}
else
{
- mtr_log_error("The master server went down early.");
+ log_error("The master server went down early.");
}
}
else
{
- mtr_log_error("Unable to start master server.");
+ log_error("Unable to start master server.");
}
-
- /* free_args */
+
+ // free_args
free_args(&al);
}
@@ -396,48 +421,48 @@ void start_master()
void start_slave()
{
arg_list_t al;
- int err;
+ int err, i;
char slave_out[PATH_MAX];
char slave_err[PATH_MAX];
char temp[PATH_MAX];
- /* skip? */
+ // skip?
if (skip_slave) return;
- /* remove stale binary logs */
+ // remove stale binary logs
removef("%s/*-bin.*", slave_dir);
- /* remove stale binary logs */
+ // remove stale binary logs
removef("%s/*.index", slave_dir);
- /* remove master.info file */
+ // remove master.info file
removef("%s/master.info", slave_dir);
- /* remove relay files */
+ // remove relay files
removef("%s/var/log/*relay*", mysql_test_dir);
- /* remove relay-log.info file */
+ // remove relay-log.info file
removef("%s/relay-log.info", slave_dir);
- /* init script */
- if (slave_init_script[0] != '\0')
+ // init script
+ if (slave_init_script[0] != NULL)
{
- /* run_init_script(slave_init_script); */
+ // run_init_script(slave_init_script);
- /* TODO: use the scripts */
- if (strstr(slave_init_script, "rpl000016-slave.sh") != NULL)
+ // TODO: use the scripts
+ if (strindex(slave_init_script, "rpl000016-slave.sh") != NULL)
{
- /* create empty master.info file */
- my_snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
- my_close(my_open(temp, O_WRONLY | O_CREAT, MYF(0)), MYF(0));
+ // create empty master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
}
- else if (strstr(slave_init_script, "rpl000017-slave.sh") != NullS)
+ else if (strindex(slave_init_script, "rpl000017-slave.sh") != NULL)
{
FILE *fp;
- /* create a master.info file */
- my_snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
- fp = my_fopen(temp, (int)(O_WRONLY | O_BINARY | O_CREAT), MYF(MY_WME));
+ // create a master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ fp = fopen(temp, "wb+");
fputs("master-bin.001\n", fp);
fputs("4\n", fp);
@@ -448,20 +473,20 @@ void start_slave()
fputs("1\n", fp);
fputs("0\n", fp);
- my_fclose(fp, MYF(MY_WME));
+ fclose(fp);
}
- else if (strstr(slave_init_script, "rpl_rotate_logs-slave.sh") != NullS)
+ else if (strindex(slave_init_script, "rpl_rotate_logs-slave.sh") != NULL)
{
- /* create empty master.info file */
- my_snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
- my_close(my_open(temp, O_WRONLY | O_CREAT, MYF(0)), MYF(0));
+ // create empty master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
}
}
- /* redirection files */
- my_snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out",
+ // redirection files
+ snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out",
mysql_test_dir, restarts);
- my_snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err",
+ snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err",
mysql_test_dir, restarts);
// args
@@ -478,7 +503,7 @@ void start_slave()
add_arg(&al, "--core");
add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
add_arg(&al, "--language=%s", lang_dir);
-
+
add_arg(&al, "--exit-info=256");
add_arg(&al, "--log-slave-updates");
add_arg(&al, "--init-rpl-role=slave");
@@ -487,15 +512,22 @@ void start_slave()
add_arg(&al, "--slave-load-tmpdir=../../var/tmp");
add_arg(&al, "--report-user=%s", user);
- add_arg(&al, "--report-host=127.0.0.1");
+ add_arg(&al, "--report-host=127.0.0.1");
add_arg(&al, "--report-port=%u", slave_port);
add_arg(&al, "--master-retry-count=10");
add_arg(&al, "-O");
add_arg(&al, "slave_net_timeout=10");
- /* slave master info */
- if (slave_master_info[0] != '\0')
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ // slave master info
+ if (slave_master_info[0] != NULL)
{
char *p;
@@ -519,7 +551,7 @@ void start_slave()
add_arg(&al, "--rpl-recovery-rank=2");
}
- /* small server */
+ // small server
add_arg(&al, "-O");
add_arg(&al, "key_buffer_size=1M");
add_arg(&al, "-O");
@@ -527,8 +559,8 @@ void start_slave()
add_arg(&al, "-O");
add_arg(&al, "max_heap_table_size=1M");
- /* opt args */
- if (slave_opt[0] != '\0')
+ // opt args
+ if (slave_opt[0] != NULL)
{
char *p;
@@ -541,14 +573,9 @@ void start_slave()
p = (char *)strtok(NULL, " \t");
}
}
-
- /* remove the pid file if it exists */
-#ifndef __WIN__
- my_delete(slave_pid, MYF(MY_WME));
-#else
- pid_mode= SLAVE_PID;
- run_server= TRUE;
-#endif
+
+ // remove the pid file if it exists
+ remove(slave_pid);
// spawn
if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err)) == 0)
@@ -561,12 +588,12 @@ void start_slave()
}
else
{
- mtr_log_error("The slave server went down early.");
+ log_error("The slave server went down early.");
}
}
else
{
- mtr_log_error("Unable to start slave server.");
+ log_error("Unable to start slave server.");
}
// free args
@@ -582,99 +609,91 @@ void start_slave()
******************************************************************************/
void mysql_start()
{
+ log_info("Starting the MySQL server(s): %u", ++restarts);
start_master();
start_slave();
-
-#ifdef __NETWARE__
+
// activate the test screen
ActivateScreen(getscreenhandle());
-#endif
}
/******************************************************************************
stop_slave()
-
+
Stop the slave server.
******************************************************************************/
void stop_slave()
{
int err;
-
- /* running? */
+
+ // running?
if (!slave_running) return;
-#ifdef __WIN__
- pid_mode= SLAVE_PID;
-#endif
-
- /* stop */
+
+ // stop
if ((err = stop_server(bin_dir, user, password, slave_port, slave_pid)) == 0)
{
slave_running = FALSE;
}
else
{
- mtr_log_error("Unable to stop slave server.");
+ log_error("Unable to stop slave server.");
}
}
/******************************************************************************
stop_master()
-
+
Stop the master server.
******************************************************************************/
void stop_master()
{
int err;
-
- /* running? */
+
+ // running?
if (!master_running) return;
-#ifdef __WIN__
- pid_mode= MASTER_PID;
-#endif
+
if ((err = stop_server(bin_dir, user, password, master_port, master_pid)) == 0)
{
master_running = FALSE;
}
else
{
- mtr_log_error("Unable to stop master server.");
+ log_error("Unable to stop master server.");
}
}
/******************************************************************************
mysql_stop()
-
+
Stop the mysql servers.
******************************************************************************/
void mysql_stop()
{
+ log_info("Stopping the MySQL server(s)...");
stop_master();
stop_slave();
-
-#ifdef __NETWARE__
+
// activate the test screen
ActivateScreen(getscreenhandle());
-#endif
}
/******************************************************************************
mysql_restart()
-
+
Restart the mysql servers.
******************************************************************************/
void mysql_restart()
{
- mtr_log_info("Restarting the MySQL server(s): %u", ++restarts);
mysql_stop();
@@ -684,56 +703,51 @@ void mysql_restart()
/******************************************************************************
read_option()
-
+
Read the option file.
******************************************************************************/
int read_option(char *opt_file, char *opt)
{
- File fd;
- int err;
+ int fd, err;
+ int result;
char *p;
char buf[PATH_MAX];
-
- /* copy current option */
+
+ // copy current option
strncpy(buf, opt, PATH_MAX);
-
-#ifdef __WIN__
- if (PathFileExistsA(opt_file))
- {
-#endif
- /* open options file */
- fd = my_open(opt_file, O_RDONLY, MYF(MY_WME));
+ // open options file
+ fd = open(opt_file, O_RDONLY);
- err = my_read(fd, opt, PATH_MAX, MYF(MY_WME));
+ err = read(fd, opt, PATH_MAX);
- my_close(fd, MYF(MY_WME));
+ close(fd);
if (err > 0)
{
- /* terminate string */
+ // terminate string
if ((p = strchr(opt, '\n')) != NULL)
{
- *p = '\0';
+ *p = NULL;
- /* check for a '\r' */
+ // check for a '\r'
if ((p = strchr(opt, '\r')) != NULL)
{
- *p = '\0';
+ *p = NULL;
}
}
else
{
- opt[err] = '\0';
+ opt[err] = NULL;
}
- /* check for $MYSQL_TEST_DIR */
- if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NullS)
+ // check for $MYSQL_TEST_DIR
+ if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
{
char temp[PATH_MAX];
- *p = '\0';
+ *p = NULL;
strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
@@ -744,14 +758,11 @@ int read_option(char *opt_file, char *opt)
}
else
{
- /* clear option */
- *opt = '\0';
- }
-#ifdef __WIN__
+ // clear option
+ *opt = NULL;
}
-#endif
- /* compare current option with previous */
+ // compare current option with previous
return strcmp(opt, buf);
}
@@ -766,20 +777,21 @@ void run_test(char *test)
{
char temp[PATH_MAX];
char *rstr;
+ double elapsed = 0;
int skip = FALSE;
int restart = FALSE;
int flag = FALSE;
struct stat info;
-
- /* single test? */
+
+ // single test?
if (!single_test)
{
// skip tests in the skip list
- my_snprintf(temp, PATH_MAX, " %s ", test);
- skip = strinstr(skip_test, temp);
+ snprintf(temp, PATH_MAX, " %s ", test);
+ skip = (strindex(skip_test, temp) != NULL);
}
- /* skip test? */
+ // skip test?
if (!skip)
{
char test_file[PATH_MAX];
@@ -792,6 +804,7 @@ void run_test(char *test)
char err_file[PATH_MAX];
int err;
arg_list_t al;
+ NXTime_t start, stop;
// skip slave?
flag = skip_slave;
@@ -799,36 +812,41 @@ void run_test(char *test)
if (flag != skip_slave) restart = TRUE;
// create files
- my_snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test);
- my_snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test);
- my_snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test);
- my_snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX);
- my_snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX);
- my_snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX);
+ snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test);
+ snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test);
+ snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test);
+ snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX);
+ snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX);
+ snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX);
// netware specific files
- my_snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
+ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
if (stat(test_file, &info))
{
- my_snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX);
+ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX);
+ if(access(test_file,0))
+ {
+ printf("Invalid test name %s, %s file not found\n",test,test_file);
+ return;
+ }
}
-
- my_snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX);
+
+ snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX);
if (stat(result_file, &info))
{
- my_snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX);
+ snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX);
}
-
+
// init scripts
- my_snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test);
+ snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test);
if (stat(master_init_script, &info))
- master_init_script[0] = '\0';
+ master_init_script[0] = NULL;
else
restart = TRUE;
- my_snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test);
+ snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test);
if (stat(slave_init_script, &info))
- slave_init_script[0] = '\0';
+ slave_init_script[0] = NULL;
else
restart = TRUE;
@@ -850,7 +868,7 @@ void run_test(char *test)
sleep(1);
// show test
- mtr_log("%-46s ", test);
+ log("%-46s ", test);
// args
init_args(&al);
@@ -866,17 +884,34 @@ void run_test(char *test)
add_arg(&al, "-v");
add_arg(&al, "-R");
add_arg(&al, "%s", result_file);
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", client_cert);
+ add_arg(&al, "--ssl-key=%s", client_key);
+ }
+
+ // start timer
+ NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &start);
// spawn
err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file);
-
+
+ // stop timer
+ NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &stop);
+
+ // calculate
+ elapsed = ((double)(stop - start)) / NX_USECONDS;
+ total_time += elapsed;
+
// free args
free_args(&al);
if (err == 0)
{
// pass
- rstr = (char *)TEST_PASS;
+ rstr = TEST_PASS;
++total_pass;
// increment total
@@ -885,13 +920,13 @@ void run_test(char *test)
else if (err == 2)
{
// skip
- rstr = (char *)TEST_SKIP;
+ rstr = TEST_SKIP;
++total_skip;
}
else if (err == 1)
{
// fail
- rstr = (char *)TEST_FAIL;
+ rstr = TEST_FAIL;
++total_fail;
// increment total
@@ -899,21 +934,21 @@ void run_test(char *test)
}
else
{
- rstr = (char *)TEST_BAD;
+ rstr = TEST_BAD;
}
}
else // early skips
{
// show test
- mtr_log("%-46s ", test);
+ log("%-46s ", test);
// skip
- rstr = (char *)TEST_SKIP;
+ rstr = TEST_SKIP;
++total_skip;
}
// result
- mtr_log(" %-14s\n", rstr);
+ log("%10.06f %-14s\n", elapsed, rstr);
}
/******************************************************************************
@@ -923,7 +958,7 @@ void run_test(char *test)
Log the message.
******************************************************************************/
-void vlog(const char *format, va_list ap)
+void vlog(char *format, va_list ap)
{
vfprintf(stdout, format, ap);
fflush(stdout);
@@ -937,15 +972,15 @@ void vlog(const char *format, va_list ap)
/******************************************************************************
- mtr_log()
+ log()
Log the message.
******************************************************************************/
-void mtr_log(const char *format, ...)
+void log(char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
vlog(format, ap);
@@ -955,60 +990,60 @@ void mtr_log(const char *format, ...)
/******************************************************************************
- mtr_log_info()
+ log_info()
Log the given information.
******************************************************************************/
-void mtr_log_info(const char *format, ...)
+void log_info(char *format, ...)
{
va_list ap;
va_start(ap, format);
- mtr_log("-- INFO : ");
+ log("-- INFO : ");
vlog(format, ap);
- mtr_log("\n");
+ log("\n");
va_end(ap);
}
/******************************************************************************
- mtr_log_error()
+ log_error()
Log the given error.
******************************************************************************/
-void mtr_log_error(const char *format, ...)
+void log_error(char *format, ...)
{
va_list ap;
va_start(ap, format);
- mtr_log("-- ERROR: ");
+ log("-- ERROR: ");
vlog(format, ap);
- mtr_log("\n");
+ log("\n");
va_end(ap);
}
/******************************************************************************
- mtr_log_errno()
+ log_errno()
Log the given error and errno.
******************************************************************************/
-void mtr_log_errno(const char *format, ...)
+void log_errno(char *format, ...)
{
va_list ap;
va_start(ap, format);
- mtr_log("-- ERROR: (%003u) ", errno);
+ log("-- ERROR: (%003u) ", errno);
vlog(format, ap);
- mtr_log("\n");
+ log("\n");
va_end(ap);
}
@@ -1020,13 +1055,11 @@ void mtr_log_errno(const char *format, ...)
Exit the application.
******************************************************************************/
-void die(const char *msg)
+void die(char *msg)
{
- mtr_log_error(msg);
+ log_error(msg);
-#ifdef __NETWARE__
pressanykey();
-#endif
exit(-1);
}
@@ -1041,86 +1074,71 @@ void die(const char *msg)
void setup(char *file)
{
char temp[PATH_MAX];
+ char mysqldump_load[PATH_MAX*2],mysqlbinlog_load[PATH_MAX*2];
+
char *p;
-
+
// set the timezone for the timestamp test
-#ifdef __WIN__
- _putenv( "TZ=GMT-3" );
-#else
setenv("TZ", "GMT-3", TRUE);
-#endif
// find base dir
- strcpy(temp, file);
-#ifndef __WIN__
- casedn_str(temp);
-#endif
+ strcpy(temp, strlwr(file));
while((p = strchr(temp, '\\')) != NULL) *p = '/';
- if ((p = strstr(temp, "/mysql-test/")))
+ if ((p = strindex(temp, "/mysql-test/")) != NULL)
{
- *p = '\0';
- strcpy(base_dir, (const char *)temp);
+ *p = NULL;
+ strcpy(base_dir, temp);
}
-
+
// setup paths
-#ifdef __WIN__
- my_snprintf(bin_dir, PATH_MAX, "%s/%s", base_dir,opt_exedir);
-#else
- my_snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir);
-#endif
- my_snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
- my_snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
- my_snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
- my_snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
- my_snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
- my_snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
- my_snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
- my_snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
-
+ snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir);
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl = TRUE;
+#endif // HAVE_OPENSSL
+
+ // OpenSSL paths
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
// setup files
-#ifdef __WIN__
- my_snprintf(mysqld_file, PATH_MAX, "%s/%s.exe", bin_dir, mysqld);
- my_snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest.exe", bin_dir);
- my_snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin.exe", bin_dir);
- pid_mode= NOT_NEED_PID;
-#else
- my_snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir);
- my_snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
- my_snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
-#endif
- my_snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
- my_snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
+ snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
// create log file
- my_snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir);
+ snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir);
if ((log_fd = fopen(temp, "w+")) == NULL)
{
- mtr_log_errno("Unable to create log file.");
+ log_errno("Unable to create log file.");
}
-
+
// prepare skip test list
while((p = strchr(skip_test, ',')) != NULL) *p = ' ';
- strcpy(temp, skip_test);
-#ifndef __WIN__
- casedn_str(temp);
-#endif
- my_snprintf(skip_test, PATH_MAX, " %s ", temp);
-
- // enviornment
-#ifdef __WIN__
- my_snprintf(temp, PATH_MAX, "MYSQL_TEST_DIR=%s", mysql_test_dir);
- _putenv(temp);
-#else
- setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
-#endif
-}
-
-static my_bool
-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
- char *argument)
-{
- return(0);
+ strcpy(temp, strlwr(skip_test));
+ snprintf(skip_test, PATH_MAX, " %s ", temp);
+
+ snprintf(mysqlbinlog_load,PATH_MAX*2,"%s/mysqlbinlog --no-defaults --local-load=%s",bin_dir,mysql_tmp_dir);
+ snprintf(mysqldump_load,PATH_MAX*2,"%s/mysqldump --no-defaults -uroot --port=%d",bin_dir,master_port);
+ // environment
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ setenv("MYSQL_DUMP", mysqldump_load, 1);
+ setenv("MYSQL_BINLOG", mysqlbinlog_load, 1);
+ setenv("MASTER_MYPORT", "9306", 1);
}
/******************************************************************************
@@ -1130,59 +1148,31 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
******************************************************************************/
int main(int argc, char **argv)
{
- int i;
- uint ui;
-
-
-#ifdef __WIN__
- int ho_error;
- DWORD len= PATH_MAX;
- char current_dir[PATH_MAX] = ".";
-
- if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- exit(1);
- if (len= GetCurrentDirectory(&len,current_dir))
- {
- current_dir[len]= '\\';
- current_dir[len+1]='\0';
- };
- MY_INIT(current_dir);
-#endif
// setup
-#ifdef __WIN__
- setup(current_dir);
-#else
setup(argv[0]);
-#endif
+
// header
- mtr_log("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+ log("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
- mtr_log("Initializing Tests...\n");
+ log("Initializing Tests...\n");
// install test databases
mysql_install_db();
- mtr_log("Starting Tests...\n");
+ log("Starting Tests...\n");
- mtr_log("\n");
- mtr_log(HEADER);
- mtr_log(DASH);
+ log("\n");
+ log(HEADER);
+ log(DASH);
-#ifdef __WIN__
- if (argc > 0)
-#else
if (argc > 1)
-#endif
{
+ int i;
// single test
- single_test = TRUE;
+ single_test = TRUE;
-#ifdef __WIN__
- for (i = 0; i < argc; i++)
-#else
for (i = 1; i < argc; i++)
-#endif
{
// run given test
run_test(argv[i]);
@@ -1191,7 +1181,8 @@ int main(int argc, char **argv)
else
{
// run all tests
- MY_DIR *dir = my_dir(test_dir, MYF(MY_WME | MY_WANT_STAT));
+ DIR *dir = opendir(test_dir);
+ DIR *entry;
char test[NAME_MAX];
char *p;
@@ -1203,16 +1194,14 @@ int main(int argc, char **argv)
die("Unable to open tests directory.");
}
- for (ui = 0; ui < dir->number_off_files; ui++)
+ while((entry = readdir(dir)) != NULL)
{
- if (!MY_S_ISDIR(dir->dir_entry[ui].mystat.st_mode))
+ if (!S_ISDIR(entry->d_type))
{
- strcpy(test, dir->dir_entry[ui].name);
-#ifndef __WIN__
- casedn_str(test);
-#endif
+ strcpy(test, strlwr(entry->d_name));
+
// find the test suffix
- if ((p = strstr(test, TEST_SUFFIX)))
+ if ((p = strindex(test, TEST_SUFFIX)) != NULL)
{
// null terminate at the suffix
*p = '\0';
@@ -1222,28 +1211,26 @@ int main(int argc, char **argv)
}
}
}
-
- my_dirend(dir);
+
+ closedir(dir);
}
-
- mtr_log(DASH);
- mtr_log("\n");
-
- mtr_log("Ending Tests...\n");
// stop server
mysql_stop();
+ log(DASH);
+ log("\n");
+
+ log("Ending Tests...\n");
+
// report stats
report_stats();
-
+
// close log
if (log_fd) fclose(log_fd);
-
-#ifdef __NETWARE__
+
// keep results up
pressanykey();
-#endif
return 0;
}
diff --git a/netware/mysqlbinlog.def b/netware/mysqlbinlog.def
index 74d8e168b00..89677b4a353 100644
--- a/netware/mysqlbinlog.def
+++ b/netware/mysqlbinlog.def
@@ -2,6 +2,7 @@
# MySQL Binary Log
#------------------------------------------------------------------------------
MODULE libc.nlm
+SCREENNAME "MySQL Binary Log Dump Tool"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Binary Log Dump Tool"
VERSION 4, 0
diff --git a/netware/mysqlcheck.def b/netware/mysqlcheck.def
index 6e476556ffe..8820e9aae8e 100644
--- a/netware/mysqlcheck.def
+++ b/netware/mysqlcheck.def
@@ -2,6 +2,7 @@
# MySQL Client
#------------------------------------------------------------------------------
MODULE libc.nlm
+SCREENNAME "MySQL Check Tool"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Check Tool"
VERSION 4, 0
diff --git a/netware/mysqld_safe.c b/netware/mysqld_safe.c
index 845797e0022..a815497ac0f 100644
--- a/netware/mysqld_safe.c
+++ b/netware/mysqld_safe.c
@@ -456,10 +456,10 @@ void check_data_vol()
// retrieve information
netware_vol_info_from_name(&vol, buff);
-
+
if ((vol.flags & VOL_NSS_PRESENT) == 0)
{
- log("Error: The data directory is not on an NSS volume!\n\n");
+ log("Error: Either the data directory does not exist or is not on an NSS volume!\n\n");
exit(-1);
}
}
diff --git a/netware/mysqldump.def b/netware/mysqldump.def
index f267b60ff77..901c9b262dc 100644
--- a/netware/mysqldump.def
+++ b/netware/mysqldump.def
@@ -2,6 +2,7 @@
# MySQL Admin
#------------------------------------------------------------------------------
MODULE libc.nlm
+SCREENNAME "MySQL Dump Tool"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Dump Tool"
VERSION 4, 0
diff --git a/netware/mysqlimport.def b/netware/mysqlimport.def
index 69e9f6eada5..d6f7fcb6bbd 100644
--- a/netware/mysqlimport.def
+++ b/netware/mysqlimport.def
@@ -2,6 +2,7 @@
# MySQL Client
#------------------------------------------------------------------------------
MODULE libc.nlm
+SCREENNAME "MySQL Import"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Import Tool"
VERSION 4, 0