Commit 9bb750f5 authored by unknown's avatar unknown

Merge mysql.com:/home/gluh/MySQL/Merge/5.0

into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt

parents a3083046 4a7724b7
......@@ -84,7 +84,16 @@ debug_extra_cflags="-O1 -Wuninitialized"
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline --with-big-tables"
base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables"
if test -d "$path/../cmd-line-utils/readline"
then
base_configs="$base_configs --with-readline"
elif test -d "$path/../cmd-line-utils/libedit"
then
base_configs="$base_configs --with-libedit"
fi
static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
amd64_configs=""
alpha_configs="" # Not used yet
......
# Microsoft Developer Studio Project File - Name="mysql_test_run_new" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=mysql_test_run_new - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mysql_test_run_new.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mysql_test_run_new.mak" CFG="mysql_test_run_new - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mysql_test_run_new - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "mysql_test_run_new - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "mysql_test_run_new - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_test_run_new.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /FD /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_test_run_new.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /FD /c /GX
# ADD BASE MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /win32
# ADD MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /win32
# ADD BASE RSC /l 1033
# ADD RSC /l 1033
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:yes /debug /pdb:".\Debug\mysql_test_run_new.pdb" /pdbtype:sept /map:".\Debug\mysql_test_run_new.map" /subsystem:console
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib zlib.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:yes /libpath:"..\lib_debug\" /debug /pdb:".\Debug\mysql_test_run_new.pdb" /pdbtype:sept /map:".\Debug\mysql_test_run_new.map" /subsystem:console
!ELSEIF "$(CFG)" == "mysql_test_run_new - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_test_run_new.pch" /Fo".\Release/" /Fd".\Release/" /FD /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_test_run_new.pch" /Fo".\Release/" /Fd".\Release/" /FD /c /GX
# ADD BASE MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /win32
# ADD MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /win32
# ADD BASE RSC /l 1033
# ADD RSC /l 1033
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib zlib.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console
!ENDIF
# Begin Target
# Name "mysql_test_run_new - Win32 Debug"
# Name "mysql_test_run_new - Win32 Release"
# Begin Source File
SOURCE=.\my_create_tables.c
# End Source File
# Begin Source File
SOURCE=.\my_manage.c
# End Source File
# Begin Source File
SOURCE=.\my_manage.h
# End Source File
# Begin Source File
SOURCE=.\mysql_test_run_new.c
# End Source File
# End Target
# End Project
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="mysql_test_run_new"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../"
PreprocessorDefinitions="_DEBUG;_WINDOWS;SAFE_MUTEX;USE_TLS;MYSQL_CLIENT;__WIN__;_WIN32"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/mysql_test_run_new.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib Ws2_32.lib zlib.lib"
OutputFile="..\mysql-test\mysql_test_run_new.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\lib_debug\"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/mysql_test_run_new.pdb"
GenerateMapFile="TRUE"
MapFileName=".\Debug/mysql_test_run_new.map"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/mysql_test_run_new.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../"
PreprocessorDefinitions="DBUG_OFF;_WINDOWS;SAFE_MUTEX;USE_TLS;MYSQL_CLIENT;__WIN__;_WIN32"
StringPooling="TRUE"
RuntimeLibrary="1"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/mysql_test_run_new.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib Ws2_32.lib zlib.lib"
OutputFile="..\mysql-test\mysql_test_run_new.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\lib_release\"
ProgramDatabaseFile=".\Release/mysql_test_run_new.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/mysql_test_run_new.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="my_create_tables.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="my_manage.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="my_manage.h">
</File>
<File
RelativePath="mysql_test_run_new.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
# Microsoft Developer Studio Project File - Name="mysql_test_run_new" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=mysql_test_run_new - WinIA64 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mysql_test_run_new_ia64.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mysql_test_run_new_ia64.mak" CFG="mysql_test_run_new - WinIA64 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mysql_test_run_new - WinIA64 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "mysql_test_run_new - WinIA64 Release" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mysql_test_run_new - WinIA64 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /WinIA64
# ADD MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /WinIA64
# ADD BASE CPP /nologo /G6 /MTd /W3 /GX /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN64" /GZ /c
# ADD CPP /nologo /MTd /W3 /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN64" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /GZ /G2 /EHsc /Wp64 /Zm600 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /map /debug /out:"..\mysql-test\mysql_test_run_new.exe" /machine:IA64
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib bufferoverflowU.lib zlib.lib /nologo /subsystem:console /incremental:no /libpath:"..\lib_debug\" /map /debug /out:"..\mysql-test\mysql_test_run_new.exe" /machine:IA64
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "mysql_test_run_new - WinIA64 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /WinIA64
# ADD MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /WinIA64
# ADD BASE CPP /nologo /G6 /MTd /W3 /GX /Ob1 /Gy /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN64" /GF /c
# ADD CPP /nologo /MTd /W3 /Zi /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN64" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /GF /G2 /EHsc /Wp64 /Zm600 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /out:"..\mysql-test\mysql_test_run_new.exe" /machine:IA64
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 t kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib bufferoverflowU.lib zlib.lib /nologo /subsystem:console /libpath:"..\lib_release\" /out:"..\mysql-test\mysql_test_run_new.exe" /machine:IA64
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "mysql_test_run_new - WinIA64 Debug"
# Name "mysql_test_run_new - WinIA64 Release"
# Begin Source File
SOURCE=.\my_create_tables.c
DEP_CPP_MY_CR=\
"..\include\config-netware.h"\
"..\include\config-os2.h"\
"..\include\config-win.h"\
"..\include\m_string.h"\
"..\include\my_config.h"\
"..\include\my_dbug.h"\
"..\include\my_global.h"\
".\my_manage.h"\
# End Source File
# Begin Source File
SOURCE=.\my_manage.c
DEP_CPP_MY_MA=\
"..\include\config-netware.h"\
"..\include\config-os2.h"\
"..\include\config-win.h"\
"..\include\m_string.h"\
"..\include\my_config.h"\
"..\include\my_dbug.h"\
"..\include\my_global.h"\
".\my_manage.h"\
# End Source File
# Begin Source File
SOURCE=.\my_manage.h
# End Source File
# Begin Source File
SOURCE=.\mysql_test_run_new.c
DEP_CPP_MYSQL=\
"..\include\config-netware.h"\
"..\include\config-os2.h"\
"..\include\config-win.h"\
"..\include\m_string.h"\
"..\include\my_config.h"\
"..\include\my_dbug.h"\
"..\include\my_global.h"\
".\my_manage.h"\
# End Source File
# End Target
# End Project
......@@ -808,28 +808,6 @@ Project: "mysql_client_test"=.\tests\mysql_client_test.dsp - Package Owner=<4>
{{{
}}}
###############################################################################
Project: "mysql_test_run_new"=".\mysql-test\mysql_test_run_new.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{ Begin Project Dependency
Project_Dep_Name mysqltest
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysqladmin
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysql_client_test
End Project Dependency
}}}
###############################################################################
Global:
......
......@@ -281,13 +281,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_client_test", "tests\
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_test_run_new", "mysql-test\mysql_test_run_new.vcproj", "{6189F838-21C6-42A1-B2D0-9146316573F7}"
ProjectSection(ProjectDependencies) = postProject
{8961F149-C68A-4154-A499-A2AB39E607E8} = {8961F149-C68A-4154-A499-A2AB39E607E8}
{DA224DAB-5006-42BE-BB77-16E8BE5326D5} = {DA224DAB-5006-42BE-BB77-16E8BE5326D5}
{D2B00DE0-F6E9-40AF-B90D-A257D014F098} = {D2B00DE0-F6E9-40AF-B90D-A257D014F098}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlmanager", "server-tools\instance-manager\mysqlmanager.vcproj", "{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}"
ProjectSection(ProjectDependencies) = postProject
{EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859}
......@@ -1467,33 +1460,6 @@ Global
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.pro nt.Build.0 = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Release.ActiveCfg = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Release.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.classic.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.classic.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.classic nt.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.classic nt.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Debug.ActiveCfg = Debug|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Debug.Build.0 = Debug|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_Classic.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_Debug.ActiveCfg = Debug|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_Pro.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_ProGPL.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_Release.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Max.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Max.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Max nt.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Max nt.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.nt.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.nt.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.pro.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.pro.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.pro gpl.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.pro gpl.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.pro gpl nt.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.pro gpl nt.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.pro nt.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.pro nt.Build.0 = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Release.ActiveCfg = Release|Win32
{6189F838-21C6-42A1-B2D0-9146316573F7}.Release.Build.0 = Release|Win32
{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic.ActiveCfg = Release|Win32
{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic.Build.0 = Release|Win32
{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic nt.ActiveCfg = Release|Win32
......
......@@ -1420,7 +1420,7 @@ static char **new_mysql_completion (const char *text, int start, int end);
#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_LIBEDIT_INTERFACE)
char *no_completion(const char*,int)
#else
int no_completion()
char *no_completion()
#endif
{
return 0; /* No filename completion */
......@@ -1508,10 +1508,10 @@ static void initialize_readline (char *name)
setlocale(LC_ALL,""); /* so as libedit use isprint */
#endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= (Function*)&no_completion;
rl_completion_entry_function= &no_completion;
#else
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= (Function*)&no_completion;
rl_completion_entry_function= &no_completion;
#endif
}
......
......@@ -112,7 +112,7 @@ int rl_attempted_completion_over = 0;
char *rl_basic_word_break_characters = break_chars;
char *rl_completer_word_break_characters = NULL;
char *rl_completer_quote_characters = NULL;
Function *rl_completion_entry_function = NULL;
CPFunction *rl_completion_entry_function = NULL;
CPPFunction *rl_attempted_completion_function = NULL;
Function *rl_pre_input_hook = NULL;
Function *rl_startup1_hook = NULL;
......@@ -1724,7 +1724,7 @@ rl_display_match_list (matches, len, max)
static int
_rl_complete_internal(int what_to_do)
{
Function *complet_func;
CPFunction *complet_func;
const LineInfo *li;
char *temp, **matches;
const char *ctemp;
......@@ -1737,7 +1737,7 @@ _rl_complete_internal(int what_to_do)
complet_func = rl_completion_entry_function;
if (!complet_func)
complet_func = (Function *)(void *)filename_completion_function;
complet_func = filename_completion_function;
/* We now look backwards for the start of a filename/variable word */
li = el_line(e);
......@@ -1764,7 +1764,7 @@ _rl_complete_internal(int what_to_do)
} else
matches = 0;
if (!rl_attempted_completion_function || !matches)
matches = completion_matches(temp, (CPFunction *)complet_func);
matches = completion_matches(temp, complet_func);
if (matches) {
int i, retval = CC_REFRESH;
......@@ -1789,8 +1789,7 @@ _rl_complete_internal(int what_to_do)
* object is a directory.
*/
size_t alen = strlen(matches[0]);
if ((complet_func !=
(Function *)filename_completion_function
if ((complet_func != filename_completion_function
|| (alen > 0 && (matches[0])[alen - 1] != '/'))
&& rl_completion_append_character) {
char buf[2];
......
......@@ -102,7 +102,7 @@ extern int max_input_history;
extern char *rl_basic_word_break_characters;
extern char *rl_completer_word_break_characters;
extern char *rl_completer_quote_characters;
extern Function *rl_completion_entry_function;
extern CPFunction *rl_completion_entry_function;
extern CPPFunction *rl_attempted_completion_function;
extern int rl_completion_type;
extern int rl_completion_query_items;
......
......@@ -2439,6 +2439,7 @@ readline_basedir=""
readline_dir=""
readline_h_ln_cmd=""
readline_link=""
want_to_use_readline="no"
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
# For NetWare, do not need readline
......@@ -2463,6 +2464,7 @@ then
readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline"
compile_readline=yes
want_to_use_readline="yes"
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
else
# Use system readline library
......@@ -2472,10 +2474,12 @@ else
MYSQL_CHECK_NEW_RL_INTERFACE
MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
AC_LANG_RESTORE
if [test "$mysql_cv_new_rl_interface" = "yes"]
if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "./cmd-line-utils/readline"]
then
# Use the new readline interface
# Use the new readline interface, but only if the package includes a bundled libreadline
# this way we avoid linking commercial source with GPL readline
readline_link="-lreadline"
want_to_use_readline="yes"
elif [test "$mysql_cv_libedit_interface" = "yes"]; then
# Use libedit
readline_link="-ledit"
......@@ -2485,6 +2489,15 @@ else
versions of libedit or readline])
fi
fi
# if there is no readline, but we want to build with readline, we fail
if [test "$want_to_use_readline" = "yes"] && [test ! -d "./cmd-line-utils/readline"]
then
AC_MSG_ERROR([This commercially licensed MySQL source package can't
be built with libreadline. Please use --with-libedit to use
the bundled version of libedit instead.])
fi
fi
AC_SUBST(readline_dir)
......@@ -2860,7 +2873,8 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
include/Makefile sql-bench/Makefile dnl
server-tools/Makefile server-tools/instance-manager/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl
support-files/MacOSX/Makefile mysql-test/Makefile dnl
support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
mysql-test/Makefile dnl
netware/Makefile dnl
include/mysql_version.h dnl
cmd-line-utils/Makefile dnl
......
......@@ -46,8 +46,6 @@ CLEANFILES = $(GENSCRIPTS) $(test_DATA)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
noinst_HEADERS = my_manage.h
dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
$(distdir)/std_data $(distdir)/lib
......
/* Copyright (C) 2004-2005 MySQL AB
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; version 2 of the License.
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
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <stdio.h>
#include <errno.h>
#ifndef __WIN__
#include <dirent.h>
#endif
#include <string.h>
#ifdef __NETWARE__
#include <screen.h>
#include <proc.h>
#else
#include <sys/types.h>
#ifndef __WIN__
#include <sys/wait.h>
#include <unistd.h>
#else
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#endif
#endif
#include <ctype.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include "my_manage.h"
/*
Synopsis:
This function testes a exist file
Arguments:
mdata: path to data
file_name: name of file
Output:
A zero value indicates that file is exist.
*/
bool test_sys_file(const char *mdata,const char *file_name)
{
struct stat file;
char path_file_name[PATH_MAX];
snprintf(path_file_name, PATH_MAX, "%s/%s", mdata, file_name);
return(stat(path_file_name,&file));
}
/*
Synopsis:
This function creates a file with sql requstes for creating
system data files.
Arguments:
mdata: path to data
output_file: file name for output file
test: to create system files with test data
Output:
A zero value indicates a success.
*/
bool create_system_files(const char *mdata,const char *output_file, bool test)
{
FILE *out;
out = fopen(output_file, "w+");
if (!out)
return 1;
if (test_sys_file(mdata,"mysql"))
{
fprintf(out,"CREATE DATABASE mysql;\n");
}
if (test && test_sys_file(mdata,"test"))
{
fprintf(out,"CREATE DATABASE test;\n");
}
fprintf(out,"USE mysql;\n");
if (test_sys_file(mdata,"mysql/db.frm"))
{
fprintf(out,
"CREATE TABLE db ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"Db char(64) binary DEFAULT '' NOT NULL,"
"User char(16) binary DEFAULT '' NOT NULL,"
"Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY Host (Host,Db,User),"
"KEY User (User))"
"engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Database privileges';\n");
if (test)
{
fprintf(out,"INSERT INTO db VALUES ('%%','test','','Y','Y','Y','Y'"
",'Y','Y','N','Y','Y','Y','Y','Y');\n");
fprintf(out,"INSERT INTO db VALUES ('%%','test\\_%%','','Y','Y','Y'"
",'Y','Y','Y','N','Y','Y','Y','Y','Y');\n");
}
}
if (test_sys_file(mdata,"mysql/host.frm"))
{
fprintf(out,
"CREATE TABLE host ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"Db char(64) binary DEFAULT '' NOT NULL,"
"Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY Host (Host,Db))"
"engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Host privileges; Merged with database privileges';\n");
}
if (test_sys_file(mdata,"mysql/user.frm"))
{
#ifdef __WIN__
WSADATA wsa_data;
#endif
char hostname[FN_REFLEN];
#ifdef __WIN__
if (WSAStartup(MAKEWORD( 2, 2 ),&wsa_data))
return 1;
#endif
if (gethostname(hostname, FN_REFLEN))
return 1;
#ifdef __WIN__
WSACleanup( );
#endif
if (strchr(hostname, '.') == NULL)
strcat(hostname, "%");
fprintf(out,
"CREATE TABLE user ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"User char(16) binary DEFAULT '' NOT NULL,"
"Password char(41) binary DEFAULT '' NOT NULL,"
"Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
"ssl_cipher BLOB NOT NULL,"
"x509_issuer BLOB NOT NULL,"
"x509_subject BLOB NOT NULL,"
"max_questions int(11) unsigned DEFAULT 0 NOT NULL,"
"max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
"max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
"PRIMARY KEY Host (Host,User)"
") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Users and global privileges';\n");
if (test)
{
fprintf(out,
"INSERT INTO user VALUES ('localhost','root',''"
",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'"
",'Y','Y','Y','Y','Y','','','','',0,0,0);\n");
fprintf(out,
"INSERT INTO user VALUES ('%s','root','','Y','Y',"
"'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',"
"'Y','Y','Y','Y','','','','',0,0,0);\n",hostname);
fprintf(out,
"REPLACE INTO user VALUES ('127.0.0.1','root','',"
"'Y','Y','Y','Y','Y','Y',"
"'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'"
",'Y','','','','',0,0,0);\n");
fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n");
fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname);
}
else
{
fprintf(out,
"INSERT INTO user VALUES ('localhost','root','',"
"'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',"
"'Y','Y','Y','Y','','','','',0,0,0);\n");
#ifndef __WIN__
fprintf(out,
"INSERT INTO user VALUES ('%s','root','','Y','Y',"
"'Y','Y','Y','Y','Y','Y'"
"'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','',''"
",'','',0,0,0);\n",hostname);
fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname);
fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n");
#else
fprintf(out,
"INSERT INTO user VALUES ('localhost','','','Y','Y','Y'"
",'Y','Y','Y','Y','Y','Y'"
",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','',"
"'','',0,0,0);\n");
#endif
}
}
if (test_sys_file(mdata,"mysql/func.frm"))
{
fprintf(out,
"CREATE TABLE func ("
"name char(64) binary DEFAULT '' NOT NULL,"
"ret tinyint(1) DEFAULT '0' NOT NULL,"
"dl char(128) DEFAULT '' NOT NULL,"
"type enum ('function','aggregate') NOT NULL,"
"PRIMARY KEY (name)"
") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='User defined functions';\n");
}
if (test_sys_file(mdata,"mysql/tables_priv.frm"))
{
fprintf(out,
"CREATE TABLE tables_priv ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"Db char(64) binary DEFAULT '' NOT NULL,"
"User char(16) binary DEFAULT '' NOT NULL,"
"Table_name char(64) binary DEFAULT '' NOT NULL,"
"Grantor char(77) DEFAULT '' NOT NULL,"
"Timestamp timestamp(14),"
"Table_priv set('Select','Insert','Update','Delete',"
"'Create','Drop','Grant','References','Index','Alter')"
" DEFAULT '' NOT NULL,"
"Column_priv set('Select','Insert','Update','References')"
" DEFAULT '' NOT NULL,"
"PRIMARY KEY (Host,Db,User,Table_name),"
"KEY Grantor (Grantor)"
") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Table privileges';\n");
}
if (test_sys_file(mdata,"mysql/columns_priv.frm"))
{
fprintf(out,
"CREATE TABLE columns_priv ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"Db char(64) binary DEFAULT '' NOT NULL,"
"User char(16) binary DEFAULT '' NOT NULL,"
"Table_name char(64) binary DEFAULT '' NOT NULL,"
"Column_name char(64) binary DEFAULT '' NOT NULL,"
"Timestamp timestamp(14),"
"Column_priv set('Select','Insert','Update','References')"
" DEFAULT '' NOT NULL,"
"PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Column privileges';\n");
}
if (test_sys_file(mdata,"mysql/help_topic.frm"))
{
fprintf(out,
"CREATE TABLE help_topic ("
"help_topic_id int unsigned not null,"
"name varchar(64) not null,"
"help_category_id smallint unsigned not null,"
"description text not null,"
"example text not null,"
"url varchar(128) not null,"
"primary key (help_topic_id),"
"unique index (name)"
") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help topics';\n");
}
if (test_sys_file(mdata,"mysql/help_category.frm"))
{
fprintf(out,
"CREATE TABLE help_category ("
"help_category_id smallint unsigned not null,"
"name varchar(64) not null,"
"parent_category_id smallint unsigned null,"
"url varchar(128) not null,"
"primary key (help_category_id),"
"unique index (name)"
") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help categories';\n");
}
if (test_sys_file(mdata,"mysql/help_keyword.frm"))
{
fprintf(out,
"CREATE TABLE help_keyword ("
"help_keyword_id int unsigned not null,"
"name varchar(64) not null,"
"primary key (help_keyword_id),"
"unique index (name)"
") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help keywords';\n");
}
if (test_sys_file(mdata,"mysql/help_relation.frm"))
{
fprintf(out,
"CREATE TABLE help_relation ("
"help_topic_id int unsigned not null references help_topic,"
"help_keyword_id int unsigned not null references help_keyword,"
"primary key (help_keyword_id, help_topic_id)"
") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='keyword-topic relation';\n");
}
if (test_sys_file(mdata,"mysql/time_zone_name.frm"))
{
fprintf(out,
"CREATE TABLE time_zone_name ("
"Name char(64) NOT NULL,"
"Time_zone_id int unsigned NOT NULL,"
"PRIMARY KEY Name (Name)"
") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone names';\n");
if (test)
{
fprintf(out,
"INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES"
"('MET', 1), ('UTC', 2), ('Universal', 2), "
"('Europe/Moscow',3), ('leap/Europe/Moscow',4),"
"('Japan', 5);\n");
}
}
if (test_sys_file(mdata,"mysql/time_zone.frm"))
{
fprintf(out,
"CREATE TABLE time_zone ("
"Time_zone_id int unsigned NOT NULL auto_increment,"
"Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY TzId (Time_zone_id)"
") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zones';\n");
if (test)
{
fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)"
"VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');\n");
}
}
if (test_sys_file(mdata,"mysql/time_zone_transition.frm"))
{
fprintf(out,
"CREATE TABLE time_zone_transition ("
"Time_zone_id int unsigned NOT NULL,"
"Transition_time bigint signed NOT NULL,"
"Transition_type_id int unsigned NOT NULL,"
"PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)"
") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone transitions';\n");
if (test)
{
fprintf(out,
"INSERT INTO time_zone_transition"
"(Time_zone_id, Transition_time, Transition_type_id)"
"VALUES"
" (1, -1693706400, 0) ,(1, -1680483600, 1)"
",(1, -1663455600, 2) ,(1, -1650150000, 3)"
",(1, -1632006000, 2) ,(1, -1618700400, 3)"
",(1, -938905200, 2) ,(1, -857257200, 3)"
",(1, -844556400, 2) ,(1, -828226800, 3)"
",(1, -812502000, 2) ,(1, -796777200, 3)"
",(1, 228877200, 2) ,(1, 243997200, 3)"
",(1, 260326800, 2) ,(1, 276051600, 3)"
",(1, 291776400, 2) ,(1, 307501200, 3)"
",(1, 323830800, 2) ,(1, 338950800, 3)"
",(1, 354675600, 2) ,(1, 370400400, 3)"
",(1, 386125200, 2) ,(1, 401850000, 3)"
",(1, 417574800, 2) ,(1, 433299600, 3)"
",(1, 449024400, 2) ,(1, 465354000, 3)"
",(1, 481078800, 2) ,(1, 496803600, 3)"
",(1, 512528400, 2) ,(1, 528253200, 3)"
",(1, 543978000, 2) ,(1, 559702800, 3)"
",(1, 575427600, 2) ,(1, 591152400, 3)"
",(1, 606877200, 2) ,(1, 622602000, 3)"
",(1, 638326800, 2) ,(1, 654656400, 3)"
",(1, 670381200, 2) ,(1, 686106000, 3)"
",(1, 701830800, 2) ,(1, 717555600, 3)"
",(1, 733280400, 2) ,(1, 749005200, 3)"
",(1, 764730000, 2) ,(1, 780454800, 3)"
",(1, 796179600, 2) ,(1, 811904400, 3)"
",(1, 828234000, 2) ,(1, 846378000, 3)"
",(1, 859683600, 2) ,(1, 877827600, 3)"
",(1, 891133200, 2) ,(1, 909277200, 3)"
",(1, 922582800, 2) ,(1, 941331600, 3)"
",(1, 954032400, 2) ,(1, 972781200, 3)"
",(1, 985482000, 2) ,(1, 1004230800, 3)"
",(1, 1017536400, 2) ,(1, 1035680400, 3)"
",(1, 1048986000, 2) ,(1, 1067130000, 3)"
",(1, 1080435600, 2) ,(1, 1099184400, 3)"
",(1, 1111885200, 2) ,(1, 1130634000, 3)"
",(1, 1143334800, 2) ,(1, 1162083600, 3)"
",(1, 1174784400, 2) ,(1, 1193533200, 3)"
",(1, 1206838800, 2) ,(1, 1224982800, 3)"
",(1, 1238288400, 2) ,(1, 1256432400, 3)"
",(1, 1269738000, 2) ,(1, 1288486800, 3)"
",(1, 1301187600, 2) ,(1, 1319936400, 3)"
",(1, 1332637200, 2) ,(1, 1351386000, 3)"
",(1, 1364691600, 2) ,(1, 1382835600, 3)"
",(1, 1396141200, 2) ,(1, 1414285200, 3)"
",(1, 1427590800, 2) ,(1, 1445734800, 3)"
",(1, 1459040400, 2) ,(1, 1477789200, 3)"
",(1, 1490490000, 2) ,(1, 1509238800, 3)"
",(1, 1521939600, 2) ,(1, 1540688400, 3)"
",(1, 1553994000, 2) ,(1, 1572138000, 3)"
",(1, 1585443600, 2) ,(1, 1603587600, 3)"
",(1, 1616893200, 2) ,(1, 1635642000, 3)"
",(1, 1648342800, 2) ,(1, 1667091600, 3)"
",(1, 1679792400, 2) ,(1, 1698541200, 3)"
",(1, 1711846800, 2) ,(1, 1729990800, 3)"
",(1, 1743296400, 2) ,(1, 1761440400, 3)"
",(1, 1774746000, 2) ,(1, 1792890000, 3)"
",(1, 1806195600, 2) ,(1, 1824944400, 3)"
",(1, 1837645200, 2) ,(1, 1856394000, 3)"
",(1, 1869094800, 2) ,(1, 1887843600, 3)"
",(1, 1901149200, 2) ,(1, 1919293200, 3)"
",(1, 1932598800, 2) ,(1, 1950742800, 3)"
",(1, 1964048400, 2) ,(1, 1982797200, 3)"
",(1, 1995498000, 2) ,(1, 2014246800, 3)"
",(1, 2026947600, 2) ,(1, 2045696400, 3)"
",(1, 2058397200, 2) ,(1, 2077146000, 3)"
",(1, 2090451600, 2) ,(1, 2108595600, 3)"
",(1, 2121901200, 2) ,(1, 2140045200, 3)"
",(3, -1688265000, 2) ,(3, -1656819048, 1)"
",(3, -1641353448, 2) ,(3, -1627965048, 3)"
",(3, -1618716648, 1) ,(3, -1596429048, 3)"
",(3, -1593829848, 5) ,(3, -1589860800, 4)"
",(3, -1542427200, 5) ,(3, -1539493200, 6)"
",(3, -1525323600, 5) ,(3, -1522728000, 4)"
",(3, -1491188400, 7) ,(3, -1247536800, 4)"
",(3, 354920400, 5) ,(3, 370728000, 4)"
",(3, 386456400, 5) ,(3, 402264000, 4)"
",(3, 417992400, 5) ,(3, 433800000, 4)"
",(3, 449614800, 5) ,(3, 465346800, 8)"
",(3, 481071600, 9) ,(3, 496796400, 8)"
",(3, 512521200, 9) ,(3, 528246000, 8)"
",(3, 543970800, 9) ,(3, 559695600, 8)"
",(3, 575420400, 9) ,(3, 591145200, 8)"
",(3, 606870000, 9) ,(3, 622594800, 8)"
",(3, 638319600, 9) ,(3, 654649200, 8)"
",(3, 670374000, 10) ,(3, 686102400, 11)"
",(3, 695779200, 8) ,(3, 701812800, 5)"
",(3, 717534000, 4) ,(3, 733273200, 9)"
",(3, 748998000, 8) ,(3, 764722800, 9)"
",(3, 780447600, 8) ,(3, 796172400, 9)"
",(3, 811897200, 8) ,(3, 828226800, 9)"
",(3, 846370800, 8) ,(3, 859676400, 9)"
",(3, 877820400, 8) ,(3, 891126000, 9)"
",(3, 909270000, 8) ,(3, 922575600, 9)"
",(3, 941324400, 8) ,(3, 954025200, 9)"
",(3, 972774000, 8) ,(3, 985474800, 9)"
",(3, 1004223600, 8) ,(3, 1017529200, 9)"
",(3, 1035673200, 8) ,(3, 1048978800, 9)"
",(3, 1067122800, 8) ,(3, 1080428400, 9)"
",(3, 1099177200, 8) ,(3, 1111878000, 9)"
",(3, 1130626800, 8) ,(3, 1143327600, 9)"
",(3, 1162076400, 8) ,(3, 1174777200, 9)"
",(3, 1193526000, 8) ,(3, 1206831600, 9)"
",(3, 1224975600, 8) ,(3, 1238281200, 9)"
",(3, 1256425200, 8) ,(3, 1269730800, 9)"
",(3, 1288479600, 8) ,(3, 1301180400, 9)"
",(3, 1319929200, 8) ,(3, 1332630000, 9)"
",(3, 1351378800, 8) ,(3, 1364684400, 9)"
",(3, 1382828400, 8) ,(3, 1396134000, 9)"
",(3, 1414278000, 8) ,(3, 1427583600, 9)"
",(3, 1445727600, 8) ,(3, 1459033200, 9)"
",(3, 1477782000, 8) ,(3, 1490482800, 9)"
",(3, 1509231600, 8) ,(3, 1521932400, 9)"
",(3, 1540681200, 8) ,(3, 1553986800, 9)"
",(3, 1572130800, 8) ,(3, 1585436400, 9)"
",(3, 1603580400, 8) ,(3, 1616886000, 9)"
",(3, 1635634800, 8) ,(3, 1648335600, 9)"
",(3, 1667084400, 8) ,(3, 1679785200, 9)"
",(3, 1698534000, 8) ,(3, 1711839600, 9)"
",(3, 1729983600, 8) ,(3, 1743289200, 9)"
",(3, 1761433200, 8) ,(3, 1774738800, 9)"
",(3, 1792882800, 8) ,(3, 1806188400, 9)"
",(3, 1824937200, 8) ,(3, 1837638000, 9)"
",(3, 1856386800, 8) ,(3, 1869087600, 9)"
",(3, 1887836400, 8) ,(3, 1901142000, 9)"
",(3, 1919286000, 8) ,(3, 1932591600, 9)"
",(3, 1950735600, 8) ,(3, 1964041200, 9)"
",(3, 1982790000, 8) ,(3, 1995490800, 9)"
",(3, 2014239600, 8) ,(3, 2026940400, 9)"
",(3, 2045689200, 8) ,(3, 2058390000, 9)"
",(3, 2077138800, 8) ,(3, 2090444400, 9)"
",(3, 2108588400, 8) ,(3, 2121894000, 9)"
",(3, 2140038000, 8)"
",(4, -1688265000, 2) ,(4, -1656819048, 1)"
",(4, -1641353448, 2) ,(4, -1627965048, 3)"
",(4, -1618716648, 1) ,(4, -1596429048, 3)"
",(4, -1593829848, 5) ,(4, -1589860800, 4)"
",(4, -1542427200, 5) ,(4, -1539493200, 6)"
",(4, -1525323600, 5) ,(4, -1522728000, 4)"
",(4, -1491188400, 7) ,(4, -1247536800, 4)"
",(4, 354920409, 5) ,(4, 370728010, 4)"
",(4, 386456410, 5) ,(4, 402264011, 4)"
",(4, 417992411, 5) ,(4, 433800012, 4)"
",(4, 449614812, 5) ,(4, 465346812, 8)"
",(4, 481071612, 9) ,(4, 496796413, 8)"
",(4, 512521213, 9) ,(4, 528246013, 8)"
",(4, 543970813, 9) ,(4, 559695613, 8)"
",(4, 575420414, 9) ,(4, 591145214, 8)"
",(4, 606870014, 9) ,(4, 622594814, 8)"
",(4, 638319615, 9) ,(4, 654649215, 8)"
",(4, 670374016, 10) ,(4, 686102416, 11)"
",(4, 695779216, 8) ,(4, 701812816, 5)"
",(4, 717534017, 4) ,(4, 733273217, 9)"
",(4, 748998018, 8) ,(4, 764722818, 9)"
",(4, 780447619, 8) ,(4, 796172419, 9)"
",(4, 811897219, 8) ,(4, 828226820, 9)"
",(4, 846370820, 8) ,(4, 859676420, 9)"
",(4, 877820421, 8) ,(4, 891126021, 9)"
",(4, 909270021, 8) ,(4, 922575622, 9)"
",(4, 941324422, 8) ,(4, 954025222, 9)"
",(4, 972774022, 8) ,(4, 985474822, 9)"
",(4, 1004223622, 8) ,(4, 1017529222, 9)"
",(4, 1035673222, 8) ,(4, 1048978822, 9)"
",(4, 1067122822, 8) ,(4, 1080428422, 9)"
",(4, 1099177222, 8) ,(4, 1111878022, 9)"
",(4, 1130626822, 8) ,(4, 1143327622, 9)"
",(4, 1162076422, 8) ,(4, 1174777222, 9)"
",(4, 1193526022, 8) ,(4, 1206831622, 9)"
",(4, 1224975622, 8) ,(4, 1238281222, 9)"
",(4, 1256425222, 8) ,(4, 1269730822, 9)"
",(4, 1288479622, 8) ,(4, 1301180422, 9)"
",(4, 1319929222, 8) ,(4, 1332630022, 9)"
",(4, 1351378822, 8) ,(4, 1364684422, 9)"
",(4, 1382828422, 8) ,(4, 1396134022, 9)"
",(4, 1414278022, 8) ,(4, 1427583622, 9)"
",(4, 1445727622, 8) ,(4, 1459033222, 9)"
",(4, 1477782022, 8) ,(4, 1490482822, 9)"
",(4, 1509231622, 8) ,(4, 1521932422, 9)"
",(4, 1540681222, 8) ,(4, 1553986822, 9)"
",(4, 1572130822, 8) ,(4, 1585436422, 9)"
",(4, 1603580422, 8) ,(4, 1616886022, 9)"
",(4, 1635634822, 8) ,(4, 1648335622, 9)"
",(4, 1667084422, 8) ,(4, 1679785222, 9)"
",(4, 1698534022, 8) ,(4, 1711839622, 9)"
",(4, 1729983622, 8) ,(4, 1743289222, 9)"
",(4, 1761433222, 8) ,(4, 1774738822, 9)"
",(4, 1792882822, 8) ,(4, 1806188422, 9)"
",(4, 1824937222, 8) ,(4, 1837638022, 9)"
",(4, 1856386822, 8) ,(4, 1869087622, 9)"
",(4, 1887836422, 8) ,(4, 1901142022, 9)"
",(4, 1919286022, 8) ,(4, 1932591622, 9)"
",(4, 1950735622, 8) ,(4, 1964041222, 9)"
",(4, 1982790022, 8) ,(4, 1995490822, 9)"
",(4, 2014239622, 8) ,(4, 2026940422, 9)"
",(4, 2045689222, 8) ,(4, 2058390022, 9)"
",(4, 2077138822, 8) ,(4, 2090444422, 9)"
",(4, 2108588422, 8) ,(4, 2121894022, 9)"
",(4, 2140038022, 8), (5, -1009875600, 1);\n");
}
}
if (test_sys_file(mdata,"mysql/time_zone_transition_type.frm"))
{
fprintf(out,
"CREATE TABLE time_zone_transition_type ("
"Time_zone_id int unsigned NOT NULL,"
"Transition_type_id int unsigned NOT NULL,"
"Offset int signed DEFAULT 0 NOT NULL,"
"Is_DST tinyint unsigned DEFAULT 0 NOT NULL,"
"Abbreviation char(8) DEFAULT '' NOT NULL,"
"PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)"
") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone transition types';\n");
if (test)
{
fprintf(out,
"INSERT INTO time_zone_transition_type (Time_zone_id,"
"Transition_type_id, Offset, Is_DST, Abbreviation) VALUES"
"(1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')"
",(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')"
",(2, 0, 0, 0, 'UTC')"
",(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')"
",(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')"
",(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')"
",(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')"
",(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')"
",(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')"
",(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')"
",(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')"
",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')"
",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')"
",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')"
",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')"
",(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');\n");
}
}
if (test_sys_file(mdata,"mysql/time_zone_leap_second.frm"))
{
fprintf(out,
"CREATE TABLE time_zone_leap_second ("
"Transition_time bigint signed NOT NULL,"
"Correction int signed NOT NULL,"
"PRIMARY KEY TranTime (Transition_time)"
") engine=MyISAM CHARACTER SET utf8 "
"comment='Leap seconds information for time zones';\n");
if (test)
{
fprintf(out,
"INSERT INTO time_zone_leap_second "
"(Transition_time, Correction) VALUES "
"(78796800, 1) ,(94694401, 2) ,(126230402, 3)"
",(157766403, 4) ,(189302404, 5) ,(220924805, 6)"
",(252460806, 7) ,(283996807, 8) ,(315532808, 9)"
",(362793609, 10) ,(394329610, 11) ,(425865611, 12)"
",(489024012, 13) ,(567993613, 14) ,(631152014, 15)"
",(662688015, 16) ,(709948816, 17) ,(741484817, 18)"
",(773020818, 19) ,(820454419, 20) ,(867715220, 21)"
",(915148821, 22);\n");
}
}
return fclose(out);
}
/*
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 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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <errno.h>
#ifndef __WIN__
#include <dirent.h>
#endif
#include <string.h>
#ifdef __NETWARE__
#include <screen.h>
#include <proc.h>
#else
#include <sys/types.h>
#ifndef __WIN__
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#include <fnmatch.h> /* FIXME HAVE_FNMATCH_H or something */
#else
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#endif
#endif
#include <ctype.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include "my_manage.h"
#ifndef __NETWARE__
#define ASSERT assert
extern char **environ;
#endif
/******************************************************************************
macros
******************************************************************************/
/******************************************************************************
global variables
******************************************************************************/
/******************************************************************************
functions
******************************************************************************/
/******************************************************************************
init_args()
Init an argument list.
******************************************************************************/
void init_args(arg_list_t *al)
{
ASSERT(al != NULL);
al->argc= 0;
al->size= ARG_BUF;
al->argv= malloc(al->size * sizeof(char *));
ASSERT(al->argv != NULL);
return;
}
/******************************************************************************
add_arg()
Add an argument to a list.
******************************************************************************/
void add_arg(arg_list_t *al, const char *format, ...)
{
va_list ap;
char temp[FN_REFLEN];
ASSERT(al != NULL);
/* increase size */
if (al->argc >= (int)al->size)
{
al->size+= ARG_BUF;
al->argv= realloc(al->argv, al->size * sizeof(char *));
ASSERT(al->argv != NULL);
}
if (format)
{
va_start(ap, format);
vsprintf(temp, format, ap);
va_end(ap);
al->argv[al->argc]= malloc(strlen(temp)+1);
ASSERT(al->argv[al->argc] != NULL);
strcpy(al->argv[al->argc], temp);
++(al->argc);
}
else
{
al->argv[al->argc]= NULL;
}
return;
}
/******************************************************************************
free_args()
Free an argument list.
******************************************************************************/
void free_args(arg_list_t *al)
{
int i;
ASSERT(al != NULL);
for (i= 0; i < al->argc; i++)
{
ASSERT(al->argv[i] != NULL);
free(al->argv[i]);
al->argv[i]= NULL;
}
free(al->argv);
al->argc= 0;
al->argv= NULL;
return;
}
/******************************************************************************
sleep_until_file_deleted()
Sleep until the given file is no longer found.
******************************************************************************/
#ifndef __WIN__
int sleep_until_file_deleted(char *pid_file)
#else
int sleep_until_file_deleted(HANDLE pid_file)
#endif
{
int err= 0; /* Initiate to supress warning */
#ifndef __WIN__
struct stat buf;
int i;
for (i= 0; (i < TRY_MAX) && (err= !stat(pid_file, &buf)); i++) sleep(1);
if (err != 0) err= errno;
#else
err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
#endif
return err;
}
/******************************************************************************
sleep_until_file_exists()
Sleep until the given file exists.
******************************************************************************/
#ifndef __WIN__
int sleep_until_file_exists(char *pid_file)
#else
int sleep_until_file_exists(HANDLE pid_file)
#endif
{
int err= 0; /* Initiate to supress warning */
#ifndef __WIN__
struct stat buf;
int i;
for (i= 0; (i < TRY_MAX) && (err= stat(pid_file, &buf)); i++) sleep(1);
if (err != 0) err= errno;
#else
err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
#endif
return err;
}
/******************************************************************************
wait_for_server_start()
Wait for the server on the given port to start.
******************************************************************************/
int wait_for_server_start(char *bin_dir __attribute__((unused)),
char *mysqladmin_file,
char *user, char *password, int port,char *tmp_dir)
{
arg_list_t al;
int err= 0;
char trash[FN_REFLEN];
/* mysqladmin file */
snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir);
/* 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, "--silent");
add_arg(&al, "--host=localhost");
#ifndef __NETWARE__
add_arg(&al, "--connect_timeout=10");
add_arg(&al, "-w");
add_arg(&al, "--protocol=tcp");
#endif
add_arg(&al, "ping");
/*
NetWare does not support the connect timeout in the TCP/IP stack
-- we will try the ping multiple times
*/
#ifndef __WIN__
{
int i;
for (i= 0;
(i < TRY_MAX) && (err= spawn(mysqladmin_file, &al, TRUE, NULL,
trash, NULL, NULL));
i++)
sleep(1);
}
#else
err= spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL);
#endif
/* free args */
free_args(&al);
return err;
}
/******************************************************************************
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, char *pid_file)
{
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 */
if (input)
wiring.infd= open(input, O_RDONLY);
if (output)
wiring.outfd= open(output, O_WRONLY | O_CREAT | O_TRUNC);
if (error)
wiring.errfd= open(error, O_WRONLY | O_CREAT | O_TRUNC);
/* procve requires a NULL */
add_arg(al, NULL);
/* go */
pid= procve(path, flags, NULL, &wiring, NULL, NULL, 0,
NULL, (const char **)al->argv);
/* close wiring */
if (wiring.infd != -1)
close(wiring.infd);
if (wiring.outfd != -1)
close(wiring.outfd);
if (wiring.errfd != -1)
close(wiring.errfd);
return result;
}
#elif __WIN__
int spawn(char *path, arg_list_t *al, int join, char *input,
char *output, char *error, HANDLE *pid)
{
bool result;
int i;
STARTUPINFO startup_info;
PROCESS_INFORMATION process_information;
DWORD exit_code;
char win_args[1024]= "";
/* Skip the first parameter */
for (i= 1; i < al->argc; i++)
{
ASSERT(al->argv[i] != NULL);
strcat(win_args,al->argv[i]);
strcat(win_args," ");
}
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,
(LPSTR)&win_args,
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&startup_info,
&process_information
);
if (result && 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 (pid != NULL)
*pid= process_information.hProcess;
}
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
int spawn(char *path, arg_list_t *al, int join, char *input,
char *output, char *error, char *pid_file __attribute__((unused)))
{
pid_t pid;
int res_exec= 0;
int result= 0;
pid= fork();
if (pid == -1)
{
fprintf(stderr, "fork was't created\n");
/* We can't create the fork...exit with error */
return EXIT_FAILURE;
}
if (pid > 0)
{
/* The parent process is waiting for child process if join is not zero */
if (join)
{
waitpid(pid, &result, 0);
if (WIFEXITED(result) != 0)
{
result= WEXITSTATUS(result);
}
else
{
result= EXIT_FAILURE;
}
}
}
else
{
/* Child process */
add_arg(al, NULL);
/* Reassign streams */
if (input)
freopen(input, "r", stdin);
if (output)
freopen(output, "w", stdout);
if (error)
freopen(error, "w", stderr);
/* Spawn the process */
if ((res_exec= execve(path, al->argv, environ)) < 0)
exit(EXIT_FAILURE);
/* Restore streams */
if (input)
freopen("/dev/tty", "r", stdin);
if (output)
freopen("/dev/tty", "w", stdout);
if (error)
freopen("/dev/tty", "w", stderr);
exit(0);
}
return result;
}
#endif
/******************************************************************************
stop_server()
Stop the server with the given port and pid file.
******************************************************************************/
int stop_server(char *bin_dir __attribute__((unused)), char *mysqladmin_file,
char *user, char *password, int port,
#ifndef __WIN__
char *pid_file,
#else
HANDLE pid_file,
#endif
char *tmp_dir)
{
arg_list_t al;
int err= 0;
char trash[FN_REFLEN];
snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir);
/* 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");
#ifndef __NETWARE__
add_arg(&al, "--protocol=tcp");
#endif
add_arg(&al, "shutdown");
/* spawn */
if ((err= spawn(mysqladmin_file, &al, TRUE, NULL,
trash, NULL, NULL)) == 0)
{
sleep_until_file_deleted(pid_file);
}
else
{
#ifndef __WIN__
pid_t pid= get_server_pid(pid_file);
/* shutdown failed - kill server */
kill_server(pid);
sleep(TRY_MAX);
/* remove pid file if possible */
err= remove(pid_file);
#else
TerminateProcess(pid_file,err);
#endif
}
/* free args */
free_args(&al);
return err;
}
/******************************************************************************
get_server_pid()
Get the VM id with the given pid file.
******************************************************************************/
#ifndef __WIN__
pid_t get_server_pid(char *pid_file)
{
char buf[FN_REFLEN];
int fd, err;
char *p;
pid_t id= 0;
/* discover id */
fd= open(pid_file, O_RDONLY);
err= read(fd, buf, FN_REFLEN);
close(fd);
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';
}
id= strtol(buf, NULL, 0);
}
return id;
}
/******************************************************************************
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 */
NXVmDestroy(pid);
#endif
}
}
#endif
/******************************************************************************
del_tree()
Delete the directory and subdirectories.
******************************************************************************/
void del_tree(char *dir)
{
#ifndef __WIN__
DIR *parent= opendir(dir);
struct dirent *entry;
char temp[FN_REFLEN];
if (parent == NULL)
{
return;
}
while ((entry= readdir(parent)) != NULL)
{
/* create long name */
snprintf(temp, FN_REFLEN, "%s/%s", dir, entry->d_name);
if (entry->d_name[0] == '.')
{
/* Skip */
}
else
{
/* FIXME missing test in acinclude.m4 */
#ifndef STRUCT_DIRENT_HAS_D_TYPE
struct stat st;
if (lstat(entry->d_name, &st) == -1)
{
/* FIXME error */
return;
}
if (S_ISDIR(st.st_mode))
#else
if (S_ISDIR(entry->d_type))
#endif
{
/* delete subdirectory */
del_tree(temp);
}
else
{
/* remove file */
remove(temp);
}
}
}
/* remove directory */
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];
snprintf(mask,FN_REFLEN,"%s/*.*",dir);
if ((handle=_findfirst(mask,&parent)) == -1L)
{
return;
}
do
{
/* create long name */
snprintf(temp, FN_REFLEN, "%s/%s", dir, parent.name);
if (parent.name[0] == '.')
{
/* Skip */
}
else
if (parent.attrib & _A_SUBDIR)
{
/* delete subdirectory */
del_tree(temp);
}
else
{
/* remove file */
remove(temp);
}
} while (_findnext(handle,&parent) == 0);
_findclose(handle);
/* remove directory */
_rmdir(dir);
#endif
}
/******************************************************************************
removef()
******************************************************************************/
int removef(const char *format, ...)
{
#ifdef __NETWARE__
va_list ap;
char path[FN_REFLEN];
va_start(ap, format);
vsnprintf(path, FN_REFLEN, format, ap);
va_end(ap);
return remove(path);
#elif __WIN__
{
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;
va_start(ap, format);
vsnprintf(path, FN_REFLEN, format, ap);
va_end(ap);
p= path + strlen(path);
while (*p != '\\' && *p != '/' && p > path) p--;
if ((handle=_findfirst(path,&parent)) == -1L)
{
/* if there is not files....it's ok */
return 0;
}
*p= '\0';
do
{
if (! (parent.attrib & _A_SUBDIR))
{
snprintf(temp, FN_REFLEN, "%s/%s", path, parent.name);
remove(temp);
}
}while (_findnext(handle,&parent) == 0);
_findclose(handle);
}
#else
DIR *parent;
struct dirent *entry;
char temp[FN_REFLEN];
va_list ap;
char path[FN_REFLEN];
char *p;
/* Get path with mask */
va_start(ap, format);
vsnprintf(path, FN_REFLEN, format, ap);
va_end(ap);
p= path + strlen(path);
while (*p != '\\' && *p != '/' && p > path) p--;
*p= '\0';
p++;
parent= opendir(path);
if (parent == NULL)
{
return 1; /* Error, directory missing */
}
while ((entry= readdir(parent)) != NULL)
{
/* entry is not directory and entry matches with mask */
#ifndef STRUCT_DIRENT_HAS_D_TYPE
struct stat st;
/* create long name */
snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name);
if (lstat(temp, &st) == -1)
{
return 1; /* Error couldn't lstat file */
}
if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0))
#else
if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0))
#endif
{
/* create long name */
snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name);
/* Delete only files */
remove(temp);
}
}
#endif
return 0;
}
/******************************************************************************
get_basedir()
******************************************************************************/
void get_basedir(char *argv0, char *basedir)
{
char temp[FN_REFLEN];
char *p;
int position;
ASSERT(argv0 != NULL);
ASSERT(basedir != NULL);
strcpy(temp, strlwr(argv0));
while ((p= strchr(temp, '\\')) != NULL) *p= '/';
if ((position= strinstr(temp, "/bin/")) != 0)
{
p= temp + position;
*p= '\0';
strcpy(basedir, temp);
}
}
uint strinstr(reg1 const char *str,reg4 const char *search)
{
reg2 my_string i,j;
my_string start= (my_string) str;
skipp:
while (*str != '\0')
{
if (*str++ == *search)
{
i=(my_string) str;
j= (my_string) search+1;
while (*j)
if (*i++ != *j++) goto skipp;
return ((uint) (str - start));
}
}
return (0);
}
/******************************************************************************
remove_empty_file()
******************************************************************************/
void remove_empty_file(const char *file_name)
{
struct stat file;
if (!stat(file_name,&file))
{
if (!file.st_size)
remove(file_name);
}
}
/*
Copyright (c) 2002 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 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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _MY_MANAGE
#define _MY_MANAGE
/******************************************************************************
includes
******************************************************************************/
#include <stdlib.h>
#ifndef __WIN__
#include <unistd.h>
#endif
#ifndef __NETWARE__
#include <string.h>
#include <my_global.h>
#include <m_string.h>
#ifndef __WIN__
#define strnicmp strncasecmp
#define strlwr(STRARG) (STRARG)
#else
int my_vsnprintf_(char *to, size_t n, const char* value, ...);
#endif
#endif
/******************************************************************************
macros
******************************************************************************/
#define ARG_BUF 10
#define TRY_MAX 5
#ifdef __WIN__
#define PATH_MAX _MAX_PATH
#define NAME_MAX _MAX_FNAME
#define kill(A,B) TerminateProcess((HANDLE)A,0)
#define NOT_NEED_PID 0
#define MASTER_PID 1
#define SLAVE_PID 2
#define mysqld_timeout 60000
int pid_mode;
bool run_server;
bool skip_first_param;
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
/******************************************************************************
structures
******************************************************************************/
typedef struct
{
int argc;
char **argv;
size_t size;
} arg_list_t;
#ifdef __WIN__
typedef int pid_t;
#endif
/******************************************************************************
global variables
******************************************************************************/
/******************************************************************************
prototypes
******************************************************************************/
void init_args(arg_list_t *);
void add_arg(arg_list_t *, const char *, ...);
void free_args(arg_list_t *);
#ifndef __WIN__
int sleep_until_file_exists(char *);
int sleep_until_file_deleted(char *);
#else
int sleep_until_file_exists(HANDLE);
int sleep_until_file_deleted(HANDLE);
#endif
int wait_for_server_start(char *, char *, char *, char *, int,char *);
#ifndef __WIN__
int spawn(char *, arg_list_t *, int, char *, char *, char *, char *);
#else
int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *);
#endif
#ifndef __WIN__
int stop_server(char *, char *, char *, char *, int, char *,char *);
pid_t get_server_pid(char *);
void kill_server(pid_t pid);
#else
int stop_server(char *, char *, char *, char *, int, HANDLE,char *);
#endif
void del_tree(char *);
int removef(const char *, ...);
void get_basedir(char *, char *);
void remove_empty_file(const char *file_name);
bool create_system_files(const char *mdata,const char *output_file, bool test);
#endif /* _MY_MANAGE */
/*
Copyright (c) 2002, 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 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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#ifndef __WIN__
#include <dirent.h>
#endif
#include <string.h>
#ifdef __NETWARE__
#include <screen.h>
#include <nks/vm.h>
#endif
#include <ctype.h>
#include <sys/stat.h>
#ifndef __WIN__
#include <unistd.h>
#endif
#include <fcntl.h>
#ifdef __NETWARE__
#include <sys/mode.h>
#endif
#ifdef __WIN__
#include <windows.h>
#include <shlwapi.h>
#include <direct.h>
#endif
#include "my_manage.h"
/******************************************************************************
macros
******************************************************************************/
#define HEADER "TEST RESULT \n"
#define DASH "-------------------------------------------------------\n"
#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"
const char *TEST_PASS= "[ pass ]";
const char *TEST_SKIP= "[ skip ]";
const char *TEST_FAIL= "[ fail ]";
const char *TEST_BAD= "[ bad ]";
const char *TEST_IGNORE= "[ignore]";
/******************************************************************************
global variables
******************************************************************************/
#ifdef __NETWARE__
static char base_dir[FN_REFLEN]= "sys:/mysql";
#else
static char base_dir[FN_REFLEN]= "..";
#endif
static char db[FN_LEN]= "test";
static char user[FN_LEN]= "root";
static char password[FN_LEN]= "";
int master_port= 9306;
int slave_port= 9307;
#if !defined(__NETWARE__) && !defined(__WIN__)
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
lowercase_table3 is disabled by Gerg
system_mysql_db_fix is disabled by Gerg
sp contains a command system
rpl_EE_error contains a command system
rpl_loaddatalocal contains a command system
ndb_autodiscover contains a command system
rpl_rotate_logs contains a command system
repair contains a command system
rpl_trunc_binlog contains a command system
mysqldump contains a command system
rpl000001 makes non-exit loop...temporary skiped
*/
static char skip_test[FN_REFLEN]=
" lowercase_table3 ,"
" system_mysql_db_fix ,"
" sp ,"
" rpl_EE_error ,"
" rpl_loaddatalocal ,"
" ndb_autodiscover ,"
" rpl_rotate_logs ,"
" repair ,"
" rpl_trunc_binlog ,"
" mysqldump ,"
" rpl000001 ,"
" derived ,"
" group_by ,"
" select ,"
" rpl000015 ,"
" subselect ";
#endif
static char ignore_test[FN_REFLEN]= "";
static char bin_dir[FN_REFLEN];
static char mysql_test_dir[FN_REFLEN];
static char test_dir[FN_REFLEN];
static char mysql_tmp_dir[FN_REFLEN];
static char result_dir[FN_REFLEN];
static char master_dir[FN_REFLEN];
static char slave_dir[FN_REFLEN];
static char slave1_dir[FN_REFLEN];
static char slave2_dir[FN_REFLEN];
static char lang_dir[FN_REFLEN];
static char char_dir[FN_REFLEN];
static char mysqladmin_file[FN_REFLEN];
static char mysqld_file[FN_REFLEN];
static char mysqltest_file[FN_REFLEN];
#ifndef __WIN__
static char master_pid[FN_REFLEN];
static char slave_pid[FN_REFLEN];
static char sh_file[FN_REFLEN]= "/bin/sh";
#else
static HANDLE master_pid;
static HANDLE slave_pid;
#endif
static char master_opt[FN_REFLEN]= "";
static char slave_opt[FN_REFLEN]= "";
static char slave_master_info[FN_REFLEN]= "";
static char master_init_script[FN_REFLEN]= "";
static char slave_init_script[FN_REFLEN]= "";
/* OpenSSL */
static char ca_cert[FN_REFLEN];
static char server_cert[FN_REFLEN];
static char server_key[FN_REFLEN];
static char client_cert[FN_REFLEN];
static char client_key[FN_REFLEN];
int total_skip= 0;
int total_pass= 0;
int total_fail= 0;
int total_test= 0;
int total_ignore= 0;
int use_openssl= FALSE;
int master_running= FALSE;
int slave_running= FALSE;
int skip_slave= TRUE;
int single_test= TRUE;
int restarts= 0;
FILE *log_fd= NULL;
static char argument[FN_REFLEN];
/******************************************************************************
functions
******************************************************************************/
/******************************************************************************
prototypes
******************************************************************************/
void report_stats();
void install_db(char *);
void mysql_install_db();
void start_master();
void start_slave();
void mysql_start();
void stop_slave();
void stop_master();
void mysql_stop();
void mysql_restart();
int read_option(char *, char *);
void run_test(char *);
void setup(char *);
void vlog(const char *, va_list);
void mlog(const char *, ...);
void log_info(const char *, ...);
void log_error(const char *, ...);
void log_errno(const char *, ...);
void die(const char *);
char *str_tok(char* dest, char *string, const char *delim);
#ifndef __WIN__
void run_init_script(const char *script_name);
#endif
/******************************************************************************
report_stats()
Report the gathered statistics.
******************************************************************************/
void report_stats()
{
if (total_fail == 0)
{
mlog("\nAll %d test(s) were successful.\n", total_test);
}
else
{
double percent= ((double)total_pass / total_test) * 100;
mlog("\nFailed %u/%u test(s), %.02f%% successful.\n",
total_fail, total_test, percent);
mlog("\nThe .out and .err files in %s may give you some\n", result_dir);
mlog("hint of what when wrong.\n");
mlog("\nIf you want to report this error, please first read "
"the documentation\n");
mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
}
}
/******************************************************************************
install_db()
Install the a database.
******************************************************************************/
void install_db(char *datadir)
{
arg_list_t al;
int err;
char input[FN_REFLEN];
char output[FN_REFLEN];
char error[FN_REFLEN];
/* input file */
#ifdef __NETWARE__
snprintf(input, FN_REFLEN, "%s/bin/init_db.sql", base_dir);
#else
snprintf(input, FN_REFLEN, "%s/mysql-test/init_db.sql", base_dir);
#endif
snprintf(output, FN_REFLEN, "%s/install.out", datadir);
snprintf(error, FN_REFLEN, "%s/install.err", datadir);
if (create_system_files(datadir,input, TRUE))
die("Unable to create init_db.sql.");
/* args */
init_args(&al);
/*
XXX: If mysqld is compiled with DISABLE_GRANT_OPTIONS defined, it
will not recognize the --bootstrap, --init-file or --skip-grant-
tables options. If this is needed here, please check
MYSQLD_BOOTSTRAP in the environment, and use its value instead of
mysqld_file if it is set. See mysql-test-run.pl and
mysql_install_db.
*/
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-ndbcluster");
add_arg(&al, "--skip-bdb");
#ifndef __NETWARE__
add_arg(&al, "--character-sets-dir=%s", char_dir);
add_arg(&al, "--language=%s", lang_dir);
#endif
// added
add_arg(&al, "--default-character-set=latin1");
add_arg(&al, "--innodb_data_file_path=ibdata1:50M");
/* spawn */
if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
{
die("Unable to create database.");
}
/* free args */
free_args(&al);
}
/******************************************************************************
mysql_install_db()
Install the test databases.
******************************************************************************/
void mysql_install_db()
{
char temp[FN_REFLEN];
/* var directory */
snprintf(temp, FN_REFLEN, "%s/var", mysql_test_dir);
/* create var directory */
#ifndef __WIN__
mkdir(temp, S_IRWXU);
/* create subdirectories */
mlog("Creating test-suite folders...\n");
snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
#else
mkdir(temp);
/* create subdirectories */
mlog("Creating test-suite folders...\n");
snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir);
mkdir(temp);
snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
mkdir(temp);
snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
mkdir(temp);
snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir);
mkdir(temp);
snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
mkdir(temp);
snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
mkdir(temp);
snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
mkdir(temp);
snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
mkdir(temp);
#endif
/* install databases */
mlog("Creating test databases for master... \n");
install_db(master_dir);
mlog("Creating test databases for slave... \n");
install_db(slave_dir);
install_db(slave1_dir);
install_db(slave2_dir);
}
/******************************************************************************
start_master()
Start the master server.
******************************************************************************/
void start_master()
{
arg_list_t al;
int err;
char master_out[FN_REFLEN];
char master_err[FN_REFLEN];
char temp2[FN_REFLEN];
/* remove old berkeley db log files that can confuse the server */
removef("%s/log.*", master_dir);
/* remove stale binary logs */
removef("%s/var/log/*-bin.*", mysql_test_dir);
/* remove stale binary logs */
removef("%s/var/log/*.index", mysql_test_dir);
/* remove master.info file */
removef("%s/master.info", master_dir);
/* remove relay files */
removef("%s/var/log/*relay*", mysql_test_dir);
/* remove relay-log.info file */
removef("%s/relay-log.info", master_dir);
/* init script */
if (master_init_script[0] != 0)
{
#ifdef __NETWARE__
/* TODO: use the scripts */
if (strinstr(master_init_script, "repair_part2-master.sh") != 0)
{
FILE *fp;
/* create an empty index file */
snprintf(temp, FN_REFLEN, "%s/test/t1.MYI", master_dir);
fp= fopen(temp, "wb+");
fputs("1", fp);
fclose(fp);
}
#elif !defined(__WIN__)
run_init_script(master_init_script);
#endif
}
/* redirection files */
snprintf(master_out, FN_REFLEN, "%s/var/run/master%u.out",
mysql_test_dir, restarts);
snprintf(master_err, FN_REFLEN, "%s/var/run/master%u.err",
mysql_test_dir, restarts);
#ifndef __WIN__
snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir);
mkdir(temp2,S_IRWXU);
snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir);
mkdir(temp2,S_IRWXU);
#else
snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir);
mkdir(temp2);
snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir);
mkdir(temp2);
#endif
/* args */
init_args(&al);
add_arg(&al, "%s", mysqld_file);
add_arg(&al, "--no-defaults");
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);
#if !defined(__NETWARE__) && !defined(__WIN__)
add_arg(&al, "--socket=%s",master_socket);
#endif
add_arg(&al, "--local-infile");
add_arg(&al, "--core");
add_arg(&al, "--log-bin-trust-function-creators");
add_arg(&al, "--datadir=%s", master_dir);
#ifndef __WIN__
add_arg(&al, "--pid-file=%s", master_pid);
#endif
add_arg(&al, "--character-sets-dir=%s", char_dir);
add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
add_arg(&al, "--language=%s", lang_dir);
add_arg(&al, "--rpl-recovery-rank=1");
add_arg(&al, "--init-rpl-role=master");
add_arg(&al, "--default-character-set=latin1");
// add_arg(&al, "--innodb_data_file_path=ibdata1:50M");
#ifdef DEBUG /* only for debug builds */
add_arg(&al, "--debug");
#endif
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 */
add_arg(&al, "-O");
add_arg(&al, "key_buffer_size=1M");
add_arg(&al, "-O");
add_arg(&al, "sort_buffer=256K");
add_arg(&al, "-O");
add_arg(&al, "max_heap_table_size=1M");
/* $EXTRA_MASTER_OPT */
if (master_opt[0] != 0)
{
char *p;
p= (char *)str_tok(argument, master_opt, " \t");
if (!strstr(master_opt, "timezone"))
{
while (p)
{
add_arg(&al, "%s", p);
p= (char *)str_tok(argument, NULL, " \t");
}
}
}
/* remove the pid file if it exists */
#ifndef __WIN__
remove(master_pid);
#endif
/* spawn */
#ifdef __WIN__
if ((err= spawn(mysqld_file, &al, FALSE, NULL,
master_out, master_err, &master_pid)) == 0)
#else
if ((err= spawn(mysqld_file, &al, FALSE, NULL,
master_out, master_err, master_pid)) == 0)
#endif
{
sleep_until_file_exists(master_pid);
if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
master_port, mysql_tmp_dir)) == 0)
{
master_running= TRUE;
}
else
{
log_error("The master server went down early.");
}
}
else
{
log_error("Unable to start master server.");
}
/* free_args */
free_args(&al);
}
/******************************************************************************
start_slave()
Start the slave server.
******************************************************************************/
void start_slave()
{
arg_list_t al;
int err;
char slave_out[FN_REFLEN];
char slave_err[FN_REFLEN];
/* skip? */
if (skip_slave) return;
/* remove stale binary logs */
removef("%s/*-bin.*", slave_dir);
/* remove stale binary logs */
removef("%s/*.index", slave_dir);
/* remove master.info file */
removef("%s/master.info", slave_dir);
/* remove relay files */
removef("%s/var/log/*relay*", mysql_test_dir);
/* remove relay-log.info file */
removef("%s/relay-log.info", slave_dir);
/* init script */
if (slave_init_script[0] != 0)
{
#ifdef __NETWARE__
/* TODO: use the scripts */
if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0)
{
/* create empty master.info file */
snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
}
else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0)
{
FILE *fp;
/* create a master.info file */
snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
fp= fopen(temp, "wb+");
fputs("master-bin.000001\n", fp);
fputs("4\n", fp);
fputs("127.0.0.1\n", fp);
fputs("replicate\n", fp);
fputs("aaaaaaaaaaaaaaab\n", fp);
fputs("9306\n", fp);
fputs("1\n", fp);
fputs("0\n", fp);
fclose(fp);
}
else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0)
{
/* create empty master.info file */
snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
}
#elif !defined(__WIN__)
run_init_script(slave_init_script);
#endif
}
/* redirection files */
snprintf(slave_out, FN_REFLEN, "%s/var/run/slave%u.out",
mysql_test_dir, restarts);
snprintf(slave_err, FN_REFLEN, "%s/var/run/slave%u.err",
mysql_test_dir, restarts);
/* args */
init_args(&al);
add_arg(&al, "%s", mysqld_file);
add_arg(&al, "--no-defaults");
add_arg(&al, "--log-bin=slave-bin");
add_arg(&al, "--relay_log=slave-relay-bin");
add_arg(&al, "--basedir=%s", base_dir);
#if !defined(__NETWARE__) && !defined(__WIN__)
add_arg(&al, "--socket=%s",slave_socket);
#endif
add_arg(&al, "--port=%u", slave_port);
add_arg(&al, "--datadir=%s", slave_dir);
#ifndef __WIN__
add_arg(&al, "--pid-file=%s", slave_pid);
#endif
add_arg(&al, "--character-sets-dir=%s", char_dir);
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");
add_arg(&al, "--skip-innodb");
add_arg(&al, "--skip-slave-start");
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-port=%u", slave_port);
add_arg(&al, "--master-retry-count=10");
add_arg(&al, "-O");
add_arg(&al, "slave_net_timeout=10");
add_arg(&al, "--log-slave-updates");
add_arg(&al, "--log=%s/var/log/slave.log", mysql_test_dir);
add_arg(&al, "--default-character-set=latin1");
add_arg(&al, "--skip-ndbcluster");
#ifdef DEBUG /* only for debug builds */
add_arg(&al, "--debug");
#endif
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] != 0)
{
char *p;
p= (char *)str_tok(argument, slave_master_info, " \t");
while (p)
{
add_arg(&al, "%s", p);
p= (char *)str_tok(argument, NULL, " \t");
}
}
else
{
add_arg(&al, "--master-user=%s", user);
add_arg(&al, "--master-password=%s", password);
add_arg(&al, "--master-host=127.0.0.1");
add_arg(&al, "--master-port=%u", master_port);
add_arg(&al, "--master-connect-retry=1");
add_arg(&al, "--server-id=2");
add_arg(&al, "--rpl-recovery-rank=2");
}
/* small server */
add_arg(&al, "-O");
add_arg(&al, "key_buffer_size=1M");
add_arg(&al, "-O");
add_arg(&al, "sort_buffer=256K");
add_arg(&al, "-O");
add_arg(&al, "max_heap_table_size=1M");
/* opt args */
if (slave_opt[0] != 0)
{
char *p;
p= (char *)str_tok(argument, slave_opt, " \t");
while (p)
{
add_arg(&al, "%s", p);
p= (char *)str_tok(argument, NULL, " \t");
}
}
/* remove the pid file if it exists */
#ifndef __WIN__
remove(slave_pid);
#endif
/* spawn */
#ifdef __WIN__
if ((err= spawn(mysqld_file, &al, FALSE, NULL,
slave_out, slave_err, &slave_pid)) == 0)
#else
if ((err= spawn(mysqld_file, &al, FALSE, NULL,
slave_out, slave_err, slave_pid)) == 0)
#endif
{
sleep_until_file_exists(slave_pid);
if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
slave_port, mysql_tmp_dir)) == 0)
{
slave_running= TRUE;
}
else
{
log_error("The slave server went down early.");
}
}
else
{
log_error("Unable to start slave server.");
}
/* free args */
free_args(&al);
}
/******************************************************************************
mysql_start()
Start the mysql servers.
******************************************************************************/
void mysql_start()
{
printf("loading master...\r");
start_master();
printf("loading slave...\r");
start_slave();
/* activate the test screen */
#ifdef __NETWARE__
ActivateScreen(getscreenhandle());
#endif
}
/******************************************************************************
stop_slave()
Stop the slave server.
******************************************************************************/
void stop_slave()
{
int err;
/* running? */
if (!slave_running) return;
/* stop */
if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
slave_port, slave_pid, mysql_tmp_dir)) == 0)
{
slave_running= FALSE;
}
else
{
log_error("Unable to stop slave server.");
}
}
/******************************************************************************
stop_master()
Stop the master server.
******************************************************************************/
void stop_master()
{
int err;
/* running? */
if (!master_running) return;
if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
master_port, master_pid, mysql_tmp_dir)) == 0)
{
master_running= FALSE;
}
else
{
log_error("Unable to stop master server.");
}
}
/******************************************************************************
mysql_stop()
Stop the mysql servers.
******************************************************************************/
void mysql_stop()
{
stop_master();
stop_slave();
/* activate the test screen */
#ifdef __NETWARE__
ActivateScreen(getscreenhandle());
#endif
}
/******************************************************************************
mysql_restart()
Restart the mysql servers.
******************************************************************************/
void mysql_restart()
{
/* log_info("Restarting the MySQL server(s): %u", ++restarts); */
mysql_stop();
mlog(DASH);
sleep(1);
mysql_start();
}
/******************************************************************************
read_option()
Read the option file.
******************************************************************************/
int read_option(char *opt_file, char *opt)
{
int fd, err;
char *p;
char buf[FN_REFLEN];
/* copy current option */
strncpy(buf, opt, FN_REFLEN);
/* open options file */
fd= open(opt_file, O_RDONLY);
err= read(fd, opt, FN_REFLEN);
close(fd);
if (err > 0)
{
/* terminate string */
if ((p= strchr(opt, '\n')) != NULL)
{
*p= 0;
/* check for a '\r' */
if ((p= strchr(opt, '\r')) != NULL)
{
*p= 0;
}
}
else
{
opt[err]= 0;
}
/* check for $MYSQL_TEST_DIR */
if ((p= strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
{
char temp[FN_REFLEN];
*p= 0;
strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
strcat(opt, mysql_test_dir);
strcat(opt, temp);
}
/* Check for double backslash and replace it with single bakslash */
if ((p= strstr(opt, "\\\\")) != NULL)
{
/* bmove is guranteed to work byte by byte */
bmove(p, p+1, strlen(p)+1);
}
}
else
{
/* clear option */
*opt= 0;
}
/* compare current option with previous */
return strcmp(opt, buf);
}
/******************************************************************************
run_test()
Run the given test case.
******************************************************************************/
void run_test(char *test)
{
char temp[FN_REFLEN];
const char *rstr;
int skip= FALSE, ignore=FALSE;
int restart= FALSE;
int flag= FALSE;
struct stat info;
/* skip tests in the skip list */
snprintf(temp, FN_REFLEN, " %s ", test);
skip= (strinstr(skip_test, temp) != 0);
if (skip == FALSE)
ignore= (strinstr(ignore_test, temp) != 0);
snprintf(master_init_script, FN_REFLEN, "%s/%s-master.sh", test_dir, test);
snprintf(slave_init_script, FN_REFLEN, "%s/%s-slave.sh", test_dir, test);
#ifdef __WIN__
if (! stat(master_init_script, &info))
skip= TRUE;
if (!stat(slave_init_script, &info))
skip= TRUE;
#endif
if (ignore)
{
/* show test */
mlog("%-46s ", test);
/* ignore */
rstr= TEST_IGNORE;
++total_ignore;
}
else if (!skip) /* skip test? */
{
char test_file[FN_REFLEN];
char master_opt_file[FN_REFLEN];
char slave_opt_file[FN_REFLEN];
char slave_master_info_file[FN_REFLEN];
char result_file[FN_REFLEN];
char reject_file[FN_REFLEN];
char out_file[FN_REFLEN];
char err_file[FN_REFLEN];
int err;
arg_list_t al;
/* skip slave? */
flag= skip_slave;
skip_slave= (strncmp(test, "rpl", 3) != 0);
if (flag != skip_slave) restart= TRUE;
/* create files */
snprintf(master_opt_file, FN_REFLEN, "%s/%s-master.opt", test_dir, test);
snprintf(slave_opt_file, FN_REFLEN, "%s/%s-slave.opt", test_dir, test);
snprintf(slave_master_info_file, FN_REFLEN, "%s/%s.slave-mi",
test_dir, test);
snprintf(reject_file, FN_REFLEN, "%s/%s%s",
result_dir, test, REJECT_SUFFIX);
snprintf(out_file, FN_REFLEN, "%s/%s%s", result_dir, test, OUT_SUFFIX);
snprintf(err_file, FN_REFLEN, "%s/%s%s", result_dir, test, ERR_SUFFIX);
/* netware specific files */
snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
if (stat(test_file, &info))
{
snprintf(test_file, FN_REFLEN, "%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;
}
}
snprintf(result_file, FN_REFLEN, "%s/%s%s",
result_dir, test, NW_RESULT_SUFFIX);
if (stat(result_file, &info))
{
snprintf(result_file, FN_REFLEN, "%s/%s%s",
result_dir, test, RESULT_SUFFIX);
}
/* init scripts */
if (stat(master_init_script, &info))
master_init_script[0]= 0;
else
restart= TRUE;
if (stat(slave_init_script, &info))
slave_init_script[0]= 0;
else
restart= TRUE;
/* read options */
if (read_option(master_opt_file, master_opt)) restart= TRUE;
if (read_option(slave_opt_file, slave_opt)) restart= TRUE;
if (read_option(slave_master_info_file, slave_master_info)) restart= TRUE;
/* cleanup previous run */
remove(reject_file);
remove(out_file);
remove(err_file);
/* start or restart? */
if (!master_running) mysql_start();
else if (restart) mysql_restart();
/* show test */
mlog("%-46s ", test);
/* args */
init_args(&al);
add_arg(&al, "%s", mysqltest_file);
add_arg(&al, "--no-defaults");
add_arg(&al, "--port=%u", master_port);
#if !defined(__NETWARE__) && !defined(__WIN__)
add_arg(&al, "--socket=%s", master_socket);
add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
#endif
add_arg(&al, "--database=%s", db);
add_arg(&al, "--user=%s", user);
add_arg(&al, "--password=%s", password);
add_arg(&al, "--silent");
add_arg(&al, "--basedir=%s/", mysql_test_dir);
add_arg(&al, "--host=127.0.0.1");
add_arg(&al, "--skip-safemalloc");
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);
}
/* spawn */
err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
/* free args */
free_args(&al);
remove_empty_file(out_file);
remove_empty_file(err_file);
if (err == 0)
{
/* pass */
rstr= TEST_PASS;
++total_pass;
/* increment total */
++total_test;
}
else if (err == 2)
{
/* skip */
rstr= TEST_SKIP;
++total_skip;
}
else if (err == 1)
{
/* fail */
rstr= TEST_FAIL;
++total_fail;
/* increment total */
++total_test;
}
else
{
rstr= TEST_BAD;
}
}
else /* early skips */
{
/* show test */
mlog("%-46s ", test);
/* skip */
rstr= TEST_SKIP;
++total_skip;
}
/* result */
mlog("%-14s\n", rstr);
}
/******************************************************************************
vlog()
Log the message.
******************************************************************************/
void vlog(const char *format, va_list ap)
{
vfprintf(stdout, format, ap);
fflush(stdout);
if (log_fd)
{
vfprintf(log_fd, format, ap);
fflush(log_fd);
}
}
/******************************************************************************
log()
Log the message.
******************************************************************************/
void mlog(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vlog(format, ap);
va_end(ap);
}
/******************************************************************************
log_info()
Log the given information.
******************************************************************************/
void log_info(const char *format, ...)
{
va_list ap;
va_start(ap, format);
mlog("-- INFO : ");
vlog(format, ap);
mlog("\n");
va_end(ap);
}
/******************************************************************************
log_error()
Log the given error.
******************************************************************************/
void log_error(const char *format, ...)
{
va_list ap;
va_start(ap, format);
mlog("-- ERROR: ");
vlog(format, ap);
mlog("\n");
va_end(ap);
}
/******************************************************************************
log_errno()
Log the given error and errno.
******************************************************************************/
void log_errno(const char *format, ...)
{
va_list ap;
va_start(ap, format);
mlog("-- ERROR: (%003u) ", errno);
vlog(format, ap);
mlog("\n");
va_end(ap);
}
/******************************************************************************
die()
Exit the application.
******************************************************************************/
void die(const char *msg)
{
log_error(msg);
#ifdef __NETWARE__
pressanykey();
#endif
exit(-1);
}
/******************************************************************************
setup()
Setup the mysql test enviornment.
******************************************************************************/
void setup(char *file __attribute__((unused)))
{
char temp[FN_REFLEN];
#if defined(__WIN__) || defined(__NETWARE__)
char file_path[FN_REFLEN*2];
#endif
char *p;
int position;
/* set the timezone for the timestamp test */
#ifdef __WIN__
_putenv( "TZ=GMT-3" );
#else
putenv((char *)"TZ=GMT-3");
#endif
/* find base dir */
#ifdef __NETWARE__
strcpy(temp, strlwr(file));
while ((p= strchr(temp, '\\')) != NULL) *p= '/';
#else
getcwd(temp, FN_REFLEN);
position= strlen(temp);
temp[position]= '/';
temp[position+1]= 0;
#ifdef __WIN__
while ((p= strchr(temp, '\\')) != NULL) *p= '/';
#endif
#endif
if ((position= strinstr(temp, "/mysql-test/")) != 0)
{
p= temp + position - 1;
*p= 0;
strcpy(base_dir, temp);
}
log_info("Currect directory: %s",base_dir);
#ifdef __NETWARE__
/* setup paths */
snprintf(bin_dir, FN_REFLEN, "%s/bin", base_dir);
snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir);
snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir);
#ifdef HAVE_OPENSSL
use_openssl= TRUE;
#endif /* HAVE_OPENSSL */
/* OpenSSL paths */
snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir);
snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir);
snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir);
snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir);
snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir);
/* setup files */
snprintf(mysqld_file, FN_REFLEN, "%s/mysqld", bin_dir);
snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir);
snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir);
snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir);
snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir);
#elif __WIN__
/* setup paths */
#ifdef _DEBUG
snprintf(bin_dir, FN_REFLEN, "%s/client_debug", base_dir);
#else
snprintf(bin_dir, FN_REFLEN, "%s/client_release", base_dir);
#endif
snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir);
snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir);
#ifdef HAVE_OPENSSL
use_openssl= TRUE;
#endif /* HAVE_OPENSSL */
/* OpenSSL paths */
snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir);
snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir);
snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir);
snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir);
snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir);
/* setup files */
#ifdef _DEBUG
snprintf(mysqld_file, FN_REFLEN, "%s/mysqld-debug.exe", bin_dir);
#else
snprintf(mysqld_file, FN_REFLEN, "%s/mysqld.exe", bin_dir);
#endif
snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest.exe", bin_dir);
snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin.exe", bin_dir);
#else
/* setup paths */
snprintf(bin_dir, FN_REFLEN, "%s/client", base_dir);
snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
snprintf(slave1_dir, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir);
snprintf(slave2_dir, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir);
snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir);
snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir);
#ifdef HAVE_OPENSSL
use_openssl= TRUE;
#endif /* HAVE_OPENSSL */
/* OpenSSL paths */
snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir);
snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir);
snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir);
snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir);
snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir);
/* setup files */
snprintf(mysqld_file, FN_REFLEN, "%s/sql/mysqld", base_dir);
snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir);
snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir);
snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir);
snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir);
snprintf(master_socket,FN_REFLEN, "%s/var/tmp/master.sock", mysql_test_dir);
snprintf(slave_socket,FN_REFLEN, "%s/var/tmp/slave.sock", mysql_test_dir);
#endif
/* create log file */
snprintf(temp, FN_REFLEN, "%s/mysql-test-run.log", mysql_test_dir);
if ((log_fd= fopen(temp, "w+")) == NULL)
{
log_errno("Unable to create log file.");
}
/* prepare skip test list */
while ((p= strchr(skip_test, ',')) != NULL) *p= ' ';
strcpy(temp, strlwr(skip_test));
snprintf(skip_test, FN_REFLEN, " %s ", temp);
/* environment */
#ifdef __NETWARE__
setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
snprintf(file_path, FN_REFLEN*2,
"%s/client/mysqldump --no-defaults -u root --port=%u",
bin_dir, master_port);
setenv("MYSQL_DUMP", file_path, 1);
snprintf(file_path, FN_REFLEN*2,
"%s/client/mysqlbinlog --no-defaults --local-load=%s",
bin_dir, mysql_tmp_dir);
setenv("MYSQL_BINLOG", file_path, 1);
#elif __WIN__
snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_DUMP=%s/mysqldump.exe --no-defaults -uroot --port=%u",
bin_dir, master_port);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s",
bin_dir, mysql_tmp_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"TESTS_BINDIR=%s/tests", base_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"CHARSETSDIR=%s/sql/share/charsets", base_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL=%s/mysql --port=%u ",
bin_dir, master_port);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults "
"--host=localhost --port=%u "
"--basedir=%s --bindir=%s --verbose",
base_dir,master_port, base_dir, bin_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"NDB_TOOLS_DIR=%s/ndb/tools", base_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"CLIENT_BINDIR=%s", bin_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase "
"--user=root --port=%u --silent",
base_dir, master_port);
_putenv(file_path);
#else
{
static char env_MYSQL_TEST_DIR[FN_REFLEN*2];
static char env_MYSQL_DUMP[FN_REFLEN*2];
static char env_MYSQL_BINLOG[FN_REFLEN*2];
static char env_MASTER_MYSOCK[FN_REFLEN*2];
static char env_TESTS_BINDIR[FN_REFLEN*2];
static char env_CHARSETSDIR[FN_REFLEN*2];
static char env_MYSQL[FN_REFLEN*2];
static char env_MYSQL_FIX_SYSTEM_TABLES[FN_REFLEN*2];
static char env_CLIENT_BINDIR[FN_REFLEN*2];
static char env_MYSQL_CLIENT_TEST[FN_REFLEN*2];
static char env_NDB_TOOLS_DIR[FN_REFLEN*2];
static char env_NDB_MGM[FN_REFLEN*2];
static char env_NDB_BACKUP_DIR[FN_REFLEN*2];
static char env_NDB_TOOLS_OUTPUT[FN_REFLEN*2];
snprintf(env_MYSQL_TEST_DIR,FN_REFLEN*2,
"MYSQL_TEST_DIR=%s",mysql_test_dir);
putenv(env_MYSQL_TEST_DIR);
snprintf(env_MYSQL_DUMP, FN_REFLEN*2,"MYSQL_DUMP=%s/mysqldump --no-defaults "
"-uroot --port=%u --socket=%s ",
bin_dir, master_port, master_socket);
putenv(env_MYSQL_DUMP);
snprintf(env_MYSQL_BINLOG, FN_REFLEN*2,
"MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s -uroot ",
bin_dir, mysql_tmp_dir);
putenv(env_MYSQL_BINLOG);
snprintf(env_MASTER_MYSOCK, FN_REFLEN*2,
"MASTER_MYSOCK=%s", master_socket);
putenv(env_MASTER_MYSOCK);
snprintf(env_TESTS_BINDIR, FN_REFLEN*2,
"TESTS_BINDIR=%s/tests", base_dir);
putenv(env_TESTS_BINDIR);
snprintf(env_CHARSETSDIR, FN_REFLEN*2,
"CHARSETSDIR=%s/sql/share/charsets", base_dir);
putenv(env_CHARSETSDIR);
snprintf(env_MYSQL, FN_REFLEN*2,
"MYSQL=%s/mysql --port=%u --socket=%s -uroot ",
bin_dir, master_port, master_socket);
putenv(env_MYSQL);
snprintf(env_MYSQL_FIX_SYSTEM_TABLES, FN_REFLEN*2,
"MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults "
"--host=localhost --port=%u --socket=%s "
"--basedir=%s --bindir=%s --verbose -uroot ",
base_dir,master_port, master_socket, base_dir, bin_dir);
putenv(env_MYSQL_FIX_SYSTEM_TABLES);
snprintf(env_CLIENT_BINDIR, FN_REFLEN*2,
"CLIENT_BINDIR=%s", bin_dir);
putenv(env_CLIENT_BINDIR);
snprintf(env_MYSQL_CLIENT_TEST, FN_REFLEN*2,
"MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase "
"--user=root --socket=%s --port=%u --silent",
base_dir, master_socket, master_port);
putenv(env_MYSQL_CLIENT_TEST);
// NDB
snprintf(env_NDB_TOOLS_DIR, FN_REFLEN*2,
"NDB_TOOLS_DIR=%s/ndb/tools", base_dir);
putenv(env_NDB_TOOLS_DIR);
snprintf(env_NDB_MGM, FN_REFLEN*2,
"NDB_MGM=%s/ndb/src/mgmclient/ndb_mgm", base_dir);
putenv(env_NDB_MGM);
//NDBCLUSTER_PORT=9350
snprintf(env_NDB_BACKUP_DIR, FN_REFLEN*2,
"NDB_BACKUP_DIR=%s/var/ndbcluster-%i", mysql_test_dir, 9350);
putenv(env_NDB_BACKUP_DIR);
snprintf(env_NDB_TOOLS_OUTPUT, FN_REFLEN*2,
"NDB_TOOLS_OUTPUT=%s/var/log/ndb_tools.log", mysql_test_dir);
putenv(env_NDB_TOOLS_OUTPUT);
putenv((char *)"NDB_STATUS_OK=1");
// NDB_MGM="$BASEDIR/ndb/src/mgmclient/ndb_mgm"
// NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
// NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
}
#endif
#ifndef __WIN__
putenv((char *)"MASTER_MYPORT=9306");
putenv((char *)"SLAVE_MYPORT=9307");
putenv((char *)"MYSQL_TCP_PORT=3306");
#else
_putenv("MASTER_MYPORT=9306");
_putenv("SLAVE_MYPORT=9307");
_putenv("MYSQL_TCP_PORT=3306");
#endif
}
/*
Compare names of testes for right order
*/
int compare( const void *arg1, const void *arg2 )
{
return sting_compare_func( * ( char** ) arg1, * ( char** ) arg2 );
}
/******************************************************************************
main()
******************************************************************************/
int main(int argc, char **argv)
{
int is_ignore_list= 0;
char **names= 0;
char **testes= 0;
int name_index;
int index;
char var_dir[FN_REFLEN];
/* setup */
setup(argv[0]);
/* delete all file in var */
snprintf(var_dir,FN_REFLEN,"%s/var",mysql_test_dir);
del_tree(var_dir);
/*
The --ignore option is comma saperated list of test cases to skip and
should be very first command line option to the test suite.
The usage is now:
mysql_test_run --ignore=test1,test2 test3 test4
where test1 and test2 are test cases to ignore
and test3 and test4 are test cases to run.
*/
if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
{
char *temp, *token;
temp= strdup(strchr(argv[1],'=') + 1);
for (token=str_tok(argument, temp, ","); token != NULL;
token=str_tok(argument, NULL, ","))
{
if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1)
sprintf(ignore_test+strlen(ignore_test), " %s ", token);
else
{
free(temp);
die("ignore list too long.");
}
}
free(temp);
is_ignore_list= 1;
}
/* header */
#ifndef __WIN__
mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
#else
mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE);
#endif
mlog("Initializing Tests...\n");
/* install test databases */
mysql_install_db();
mlog("Starting Tests...\n");
mlog("\n");
mlog(HEADER);
mlog(DASH);
if ( argc > 1 + is_ignore_list )
{
int i;
/* single test */
single_test= TRUE;
for (i= 1 + is_ignore_list; i < argc; i++)
{
/* run given test */
run_test(argv[i]);
}
}
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;
char test[FN_LEN];
int position;
/* FIXME are we sure the list is sorted if using readdir()? */
if ((parent= opendir(test_dir)) == NULL) /* Not thread safe */
die("Unable to open tests directory.");
else
{
while ((entry= readdir(parent)) != NULL) /* Not thread safe */
{
strcpy(test, strlwr(entry->d_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");
}
}
closedir(parent);
}
#else
{
struct _finddata_t dir;
int* handle;
char test[FN_LEN];
char mask[FN_REFLEN];
int position;
/* single test */
single_test= FALSE;
snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
if ((handle=_findfirst(mask,&dir)) == -1L)
{
die("Unable to open tests directory.");
}
do
{
if (!(dir.attrib & _A_SUBDIR))
{
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);
}
#endif
qsort( (void *)testes, name_index, sizeof( char * ), compare );
for (index= 0; index < name_index; index++)
{
run_test(testes[index]);
free(testes[index]);
}
free(testes);
}
/* stop server */
mysql_stop();
mlog(DASH);
mlog("\n");
mlog("Ending Tests...\n");
/* report stats */
report_stats();
/* close log */
if (log_fd) fclose(log_fd);
/* keep results up */
#ifdef __NETWARE__
pressanykey();
#endif
return 0;
}
/*
Synopsis:
This function breaks the string into a sequence of tokens. The difference
between this function and strtok is that it respects the quoted string i.e.
it skips any delimiter character within the quoted part of the string.
It return tokens by eliminating quote character. It modifies the input string
passed. It will work with whitespace delimeter but may not work properly with
other delimeter. If the delimeter will contain any quote character, then
function will not tokenize and will return null string.
e.g. if input string is
--init-slave="set global max_connections=500" --skip-external-locking
then the output will two string i.e.
--init-slave=set global max_connections=500
--skip-external-locking
Arguments:
string: input string
delim: set of delimiter character
Output:
return the null terminated token of NULL.
*/
char *str_tok(char* dest, char *string, const char *delim)
{
char *token;
char *ptr_end_token= NULL;
char *ptr_quote= NULL;
char *ptr_token= NULL;
int count_quotes= 0;
*dest = '\0';
if (strchr(delim,'\'') || strchr(delim,'\"'))
return NULL;
token= (char*)strtok(string, delim);
if (token)
{
/* double quote is found */
if (strchr(token,'\"'))
{
do
{
if (count_quotes & 1)
{
if (*dest == '\0')
sprintf(dest,"%s", ptr_token);
else
sprintf(dest,"%s %s", dest, ptr_token);
ptr_token= (char*)strtok(NULL, delim);
if (!ptr_token)
break;
}
else
{
ptr_token= token;
}
if (ptr_quote = strchr(ptr_token,'\"'))
{
ptr_end_token= ptr_token + strlen(ptr_token);
do
{
#ifndef __WIN__
bmove(ptr_quote, ptr_quote+1, ptr_end_token - ptr_quote);
#endif
count_quotes++;
} while (ptr_quote != NULL && (ptr_quote = strchr(ptr_quote+1,'\"')));
}
/* there are unpair quotes we have to search next quote*/
} while (count_quotes & 1);
if (ptr_token != NULL)
{
if (*dest == '\0')
sprintf(dest,"%s", ptr_token);
else
sprintf(dest,"%s %s",dest,ptr_token);
}
}
else
{
sprintf(dest,"%s",token);
}
}
return token ? dest : NULL;
}
#ifndef __WIN__
/*
Synopsis:
This function run scripts files on Linux and Netware
Arguments:
script_name: name of script file
Output:
nothing
*/
void run_init_script(const char *script_name)
{
arg_list_t al;
int err;
/* args */
init_args(&al);
add_arg(&al, sh_file);
add_arg(&al, script_name);
/* spawn */
if ((err= spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0)
{
die("Unable to run script.");
}
/* free args */
free_args(&al);
}
#endif
#!/bin/sh
# Copyright (C) 1979-1996 TcX AB & Monty Program KB & Detron HB
# Copyright (C) 1979-2007 MySQL AB
#
# This software is distributed with NO WARRANTY OF ANY KIND. No author or
# distributor accepts any responsibility for the consequences of using it, or
# for whether it serves any particular purpose or works at all, unless he or
# she says so in writing. Refer to the Free Public License (the "License")
# for full details.
# 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; version 2 of the License.
#
# Every copy of this file must include a copy of the License, normally in a
# plain ASCII text file named PUBLIC. The License grants you the right to
# copy, modify and redistribute this file, but only under certain conditions
# described in the License. Among other things, the License requires that
# the copyright notice and this notice be preserved on all copies.
# 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; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
# MA 02110-1301 USA.
@bindir@/replace msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $*
......@@ -445,10 +445,24 @@ int main(int argc,char **argv)
/* Broken up to indicate that it's not advice to you, gentle reader. */
printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
printf("/* Copyright (C) 2001-2004 MySQL AB\n\
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
and you are welcome to modify and redistribute it under the GPL license\n\
\n*/\n\n");
printf("\
/* Copyright (C) 2001-2004 MySQL AB\n\
\n\
This program is free software; you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
the Free Software Foundation; version 2 of the License.\n\
\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\
\n\
You should have received a copy of the GNU General Public License\n\
along with this program; see the file COPYING. If not, write to the\n\
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston\n\
MA 02110-1301 USA. */\n\
\n\
");
/* Broken up to indicate that it's not advice to you, gentle reader. */
printf("/* Do " "not " "edit " "this " "file! This is generated by "
......
......@@ -30,7 +30,7 @@ EXTRA_DIST = mysql.spec.sh \
MySQL-shared-compat.spec.sh \
ndb-config-2-node.ini.sh
SUBDIRS = MacOSX
SUBDIRS = MacOSX RHEL4-SElinux
pkgdata_DATA = my-small.cnf \
my-medium.cnf \
......
# Copyright (C) 2000-2001, 2003-2006 MySQL AB
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
#
# This library 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
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
## Process this file with automake to create Makefile.in
EXTRA_DIST = mysql.fc mysql.te
# Don't update the files from bitkeeper
%::SCCS/s.%
# MySQL Database Server
#
# /etc
#
/etc/my\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0)
/etc/mysql(/.*)? gen_context(system_u:object_r:mysqld_etc_t,s0)
#
# /usr
# Red Hat compatibility
/usr/libexec/mysqld -- gen_context(system_u:object_r:mysqld_exec_t,s0)
# MySQL AB compatibility
/usr/sbin/mysqld(-max)? -- gen_context(system_u:object_r:mysqld_exec_t,s0)
#
# /var
#
/var/lib/mysql(/.*)? gen_context(system_u:object_r:mysqld_db_t,s0)
/var/lib/mysql/mysql\.sock -s gen_context(system_u:object_r:mysqld_var_run_t,s0)
/var/log/mysql.* -- gen_context(system_u:object_r:mysqld_log_t,s0)
/var/run/mysqld(/.*)? gen_context(system_u:object_r:mysqld_var_run_t,s0)
policy_module(mysql,1.0.0)
########################################
#
# Declarations
#
type mysqld_t;
type mysqld_exec_t;
init_daemon_domain(mysqld_t,mysqld_exec_t)
type mysqld_var_run_t;
files_pid_file(mysqld_var_run_t)
type mysqld_db_t;
files_type(mysqld_db_t)
type mysqld_etc_t alias etc_mysqld_t;
files_config_file(mysqld_etc_t)
type mysqld_log_t;
logging_log_file(mysqld_log_t)
type mysqld_tmp_t;
files_tmp_file(mysqld_tmp_t)
########################################
#
# Local policy
#
allow mysqld_t self:capability { dac_override setgid setuid sys_resource net_bind_service };
dontaudit mysqld_t self:capability sys_tty_config;
allow mysqld_t self:process { setsched getsched setrlimit signal_perms rlimitinh };
allow mysqld_t self:fifo_file { read write };
allow mysqld_t self:unix_stream_socket create_stream_socket_perms;
allow mysqld_t self:tcp_socket create_stream_socket_perms;
allow mysqld_t self:udp_socket create_socket_perms;
allow mysqld_t mysqld_db_t:dir create_dir_perms;
allow mysqld_t mysqld_db_t:file create_file_perms;
allow mysqld_t mysqld_db_t:lnk_file create_lnk_perms;
files_var_lib_filetrans(mysqld_t,mysqld_db_t,{ dir file })
allow mysqld_t mysqld_etc_t:file { getattr read };
allow mysqld_t mysqld_etc_t:lnk_file { getattr read };
allow mysqld_t mysqld_etc_t:dir list_dir_perms;
allow mysqld_t mysqld_log_t:file create_file_perms;
logging_log_filetrans(mysqld_t,mysqld_log_t,file)
allow mysqld_t mysqld_tmp_t:dir create_dir_perms;
allow mysqld_t mysqld_tmp_t:file create_file_perms;
files_tmp_filetrans(mysqld_t, mysqld_tmp_t, { file dir })
allow mysqld_t mysqld_var_run_t:dir rw_dir_perms;
allow mysqld_t mysqld_var_run_t:sock_file create_file_perms;
allow mysqld_t mysqld_var_run_t:file create_file_perms;
files_pid_filetrans(mysqld_t,mysqld_var_run_t,file)
kernel_read_system_state(mysqld_t)
kernel_read_kernel_sysctls(mysqld_t)
corenet_non_ipsec_sendrecv(mysqld_t)
corenet_tcp_sendrecv_all_if(mysqld_t)
corenet_udp_sendrecv_all_if(mysqld_t)
corenet_tcp_sendrecv_all_nodes(mysqld_t)
corenet_udp_sendrecv_all_nodes(mysqld_t)
corenet_tcp_sendrecv_all_ports(mysqld_t)
corenet_udp_sendrecv_all_ports(mysqld_t)
corenet_tcp_bind_all_nodes(mysqld_t)
corenet_tcp_bind_mysqld_port(mysqld_t)
corenet_tcp_connect_mysqld_port(mysqld_t)
corenet_sendrecv_mysqld_client_packets(mysqld_t)
corenet_sendrecv_mysqld_server_packets(mysqld_t)
dev_read_sysfs(mysqld_t)
fs_getattr_all_fs(mysqld_t)
fs_search_auto_mountpoints(mysqld_t)
term_dontaudit_use_console(mysqld_t)
domain_use_interactive_fds(mysqld_t)
files_getattr_var_lib_dirs(mysqld_t)
files_read_etc_runtime_files(mysqld_t)
files_read_etc_files(mysqld_t)
files_read_usr_files(mysqld_t)
files_search_var_lib(mysqld_t)
auth_use_nsswitch(mysqld_t)
init_use_fds(mysqld_t)
init_use_script_ptys(mysqld_t)
libs_use_ld_so(mysqld_t)
libs_use_shared_libs(mysqld_t)
logging_send_syslog_msg(mysqld_t)
miscfiles_read_localization(mysqld_t)
sysnet_read_config(mysqld_t)
userdom_dontaudit_use_unpriv_user_fds(mysqld_t)
# for /root/.my.cnf - should not be needed:
userdom_read_sysadm_home_content_files(mysqld_t)
ifdef(`distro_redhat',`
# because Fedora has the sock_file in the database directory
type_transition mysqld_t mysqld_db_t:sock_file mysqld_var_run_t;
')
ifdef(`targeted_policy',`
term_dontaudit_use_unallocated_ttys(mysqld_t)
term_dontaudit_use_generic_ptys(mysqld_t)
files_dontaudit_read_root_files(mysqld_t)
')
optional_policy(`
daemontools_service_domain(mysqld_t, mysqld_exec_t)
')
optional_policy(`
seutil_sigchld_newrole(mysqld_t)
')
optional_policy(`
udev_read_db(mysqld_t)
')
# Copyright (C) 2000-2007 MySQL AB
#
# 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; version 2 of the License.
#
# 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; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
# MA 02110-1301 USA.
%define mysql_version @VERSION@
# use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x)
......@@ -70,12 +86,9 @@ is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
Copyright (C) 2000-2007 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
......@@ -95,12 +108,9 @@ is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
Copyright (C) 2000-2007 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
......@@ -345,6 +355,8 @@ then
fi
( cd mysql-test
MTR_BUILD_THREAD=auto
export MTR_BUILD_THREAD
perl ./mysql-test-run.pl --force --report-features
perl ./mysql-test-run.pl --force --ps-protocol
true )
......@@ -407,6 +419,8 @@ then
fi
( cd mysql-test
MTR_BUILD_THREAD=auto
export MTR_BUILD_THREAD
perl ./mysql-test-run.pl --force --report-features
perl ./mysql-test-run.pl --force --ps-protocol
true )
......@@ -755,6 +769,10 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
* Wed Jan 31 2007 Daniel Fischer <df@mysql.com>
- add MTR_BUILD_THREAD=auto to test runs.
* Fri Jan 05 2007 Kent Boortz <kent@mysql.com>
- Add CFLAGS to gcc call with --print-libgcc-file, to make sure the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment