Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

bk commit into 5.0 tree (msvensson:1.2541) BUG#31004

From: <msvensson(at)mysql.com>
Date: Wed Oct 31 2007 - 14:10:27 EDT


Below is the list of changes that have just been committed into a local 5.0 repository of msvensson. When msvensson does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository.
For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@1.2541, 2007-10-31 19:10:23+01:00, msvensson@pilot.mysql.com +4 -0   Bug#31004 mysqltest needs a --mkdir command

  • Add new mysqltest command "mkdir" and "rmdir"

  client/CMakeLists.txt@1.11, 2007-10-31 19:10:20+01:00, msvensson@pilot.mysql.com +2 -1     Build mysys/my_mkdir.c with mysqltest

  client/Makefile.am@1.66, 2007-10-31 19:10:21+01:00, msvensson@pilot.mysql.com +2 -1     Build mysys/my_mkdir.c with mysqltest

  client/mysqltest.c@1.311, 2007-10-31 19:10:21+01:00, msvensson@pilot.mysql.com +67 -1     Add new mysqltest commands "mkdir" and "rmdir"

  mysql-test/t/mysqltest.test@1.71, 2007-10-31 19:10:21+01:00, msvensson@pilot.mysql.com +22 -0     Add tests for "mkdir" and ""rmdir"

diff -Nrup a/client/CMakeLists.txt b/client/CMakeLists.txt
--- a/client/CMakeLists.txt	2007-08-02 12:39:09 +02:00

+++ b/client/CMakeLists.txt 2007-10-31 19:10:20 +01:00
@@ -32,7 +32,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/
 ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)  TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)  
-ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c ../mysys/my_copy.c)

+ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c
+ ../mysys/my_copy.c ../mysys/my_mkdir.c)
TARGET_LINK_LIBRARIES(mysqltest mysqlclient_notls regex wsock32)

 ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)

diff -Nrup a/client/Makefile.am b/client/Makefile.am
--- a/client/Makefile.am	2007-05-02 14:01:46 +02:00

+++ b/client/Makefile.am 2007-10-31 19:10:21 +01:00
@@ -34,7 +34,8 @@ mysqladmin_SOURCES = mysqladmin.cc mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS) mysqltest_SOURCES= mysqltest.c \ $(top_srcdir)/mysys/my_getsystime.c \ - $(top_srcdir)/mysys/my_copy.c
+ $(top_srcdir)/mysys/my_copy.c \
+ $(top_srcdir)/mysys/my_mkdir.c
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD) mysqlbinlog_SOURCES = mysqlbinlog.cc \ diff -Nrup a/client/mysqltest.c b/client/mysqltest.c --- a/client/mysqltest.c 2007-10-31 18:44:27 +01:00
+++ b/client/mysqltest.c 2007-10-31 19:10:21 +01:00
@@ -277,7 +277,7 @@ enum enum_commands {
   Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
   Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
   Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
-  Q_SEND_QUIT, Q_CHANGE_USER,

+ Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
 
   Q_UNKNOWN,			       /* Unknown command.   */
   Q_COMMENT,			       /* Comments, ignored. */
@@ -367,6 +367,9 @@ const char *command_names[]=
   "diff_files",
   "send_quit",
   "change_user",

+ "mkdir",
+ "rmdir",
+

   0
 };  

Do you need help?X

@@ -2743,6 +2746,67 @@ void do_file_exist(struct st_command *co    

 /*
+ SYNOPSIS
+ do_mkdir
+ command called command
+
+ DESCRIPTION
+ mkdir <dir_name>
+ Create the directory <dir_name>
+*/
+
+void do_mkdir(struct st_command *command)
+{
+ int error;
+ static DYNAMIC_STRING ds_dirname;
+ const struct command_arg mkdir_args[] = {
+ "dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to create"
+ };
+ DBUG_ENTER("do_mkdir");
+
+ check_command_args(command, command->first_argument,
+ mkdir_args, sizeof(mkdir_args)/sizeof(struct command_arg),
+ ' ');
+
+ DBUG_PRINT("info", ("creating directory: %s", ds_dirname.str));
+ error= my_mkdir(ds_dirname.str, 0777, MYF(0)) != 0;
+ handle_command_error(command, error);
+ dynstr_free(&ds_dirname);
+ DBUG_VOID_RETURN;
+}
+
+/*
+ SYNOPSIS
+ do_rmdir
+ command called command
+
+ DESCRIPTION
+ rmdir <dir_name>
+ Remove the empty directory <dir_name>
+*/
+
+void do_rmdir(struct st_command *command)
+{
+ int error;
+ static DYNAMIC_STRING ds_dirname;
+ const struct command_arg rmdir_args[] = {
+ "dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to remove"
+ };
+ DBUG_ENTER("do_rmdir");
+
+ check_command_args(command, command->first_argument,
+ rmdir_args, sizeof(rmdir_args)/sizeof(struct command_arg),
+ ' ');
+
+ DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str));
+ error= rmdir(ds_dirname.str) != 0;
+ handle_command_error(command, error);
+ dynstr_free(&ds_dirname);
+ DBUG_VOID_RETURN;
+}
+
+
+/*

   Read characters from line buffer or file. This is needed to allow    my_ungetc() to buffer MAX_DELIMITER_LENGTH characters for a file  

@@ -6911,6 +6975,8 @@ int main(int argc, char **argv)

       case Q_ECHO: do_echo(command); command_executed++; break;
       case Q_SYSTEM: do_system(command); break;
       case Q_REMOVE_FILE: do_remove_file(command); break;

+ case Q_MKDIR: do_mkdir(command); break;
+ case Q_RMDIR: do_rmdir(command); break;
case Q_FILE_EXIST: do_file_exist(command); break; case Q_WRITE_FILE: do_write_file(command); break; case Q_APPEND_FILE: do_append_file(command); break; diff -Nrup a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test --- a/mysql-test/t/mysqltest.test 2007-10-31 18:44:28 +01:00
+++ b/mysql-test/t/mysqltest.test 2007-10-31 19:10:21 +01:00
@@ -2101,6 +2101,28 @@ drop table t1;
 --change_user root,,
 --change_user root,,test  

+# ----------------------------------------------------------------------------
+# Test mkdir and rmdir command
+# ----------------------------------------------------------------------------
+
+mkdir $MYSQLTEST_VARDIR/tmp/testdir;
+rmdir $MYSQLTEST_VARDIR/tmp/testdir;
+
+# Directory already exist
+mkdir $MYSQLTEST_VARDIR/tmp/testdir;
+--error 1
+mkdir $MYSQLTEST_VARDIR/tmp/testdir;
+
+# Remove dir with file inside
+write_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
+hello
+EOF
+--error 1
+rmdir $MYSQLTEST_VARDIR/tmp/testdir;
+
+remove_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
+rmdir $MYSQLTEST_VARDIR/tmp/testdir;
+
 

 --echo End of tests  

-- 
MySQL Code Commits Mailing List
For list archives: 
Do you need more help?X
http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Wed Oct 31 14:10:54 2007

This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 11:13:35 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library