summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.blaudden>2007-02-28 16:40:50 +0100
committerunknown <msvensson@pilot.blaudden>2007-02-28 16:40:50 +0100
commit46c7120eb269c1995f254b0022a74171c644fd64 (patch)
tree9d6069104a2ed60ede7d073e389670c50c91c569 /mysql-test
parentda0946f8f1a44866e708eab4c43d4da55322821d (diff)
parentd1250efff1cfeb118b68d492a0d5ad66b6f89fdb (diff)
downloadmariadb-git-46c7120eb269c1995f254b0022a74171c644fd64.tar.gz
Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint-bug20166
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint mysql-test/mysql-test-run.pl: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/lib/mtr_process.pl39
-rwxr-xr-xmysql-test/mysql-test-run.pl10
-rw-r--r--mysql-test/r/func_str.result14
-rw-r--r--mysql-test/t/func_str.test22
4 files changed, 68 insertions, 17 deletions
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index f63009cd24c..690ca8313dd 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -22,7 +22,7 @@ use Socket;
use Errno;
use strict;
-use POSIX 'WNOHANG';
+use POSIX qw(WNOHANG SIGHUP);
sub mtr_run ($$$$$$;$);
sub mtr_spawn ($$$$$$;$);
@@ -139,19 +139,18 @@ sub spawn_impl ($$$$$$$$) {
{
if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
{
- mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo");
+ mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
sleep(1);
redo FORK;
}
- else
- {
- mtr_error("$path ($pid) can't be forked");
- }
+
+ mtr_error("$path ($pid) can't be forked, error: $!");
+
}
if ( $pid )
{
- spawn_parent_impl($pid,$mode,$path);
+ return spawn_parent_impl($pid,$mode,$path);
}
else
{
@@ -216,8 +215,11 @@ sub spawn_impl ($$$$$$$$) {
{
mtr_child_error("failed to execute \"$path\": $!");
}
+ mtr_error("Should never come here 1!");
}
+ mtr_error("Should never come here 2!");
}
+ mtr_error("Should never come here 3!");
}
@@ -230,12 +232,21 @@ sub spawn_parent_impl {
{
if ( $mode eq 'run' )
{
- # Simple run of command, we wait for it to return
+ # Simple run of command, wait blocking for it to return
my $ret_pid= waitpid($pid,0);
if ( $ret_pid != $pid )
{
- mtr_error("waitpid($pid, 0) returned $ret_pid " .
- "when waiting for '$path'");
+ # The "simple" waitpid has failed, print debug info
+ # and try to handle the error
+ mtr_warning("waitpid($pid, 0) returned $ret_pid " .
+ "when waiting for '$path', error: '$!'");
+ if ( $ret_pid == -1 )
+ {
+ # waitpid returned -1, that would indicate the process
+ # no longer exist and waitpid couldn't wait for it.
+ return 1;
+ }
+ mtr_error("Error handling failed");
}
return mtr_process_exit_status($?);
@@ -1109,12 +1120,6 @@ sub mtr_kill_processes ($) {
#
##############################################################################
-# FIXME something is wrong, we sometimes terminate with "Hangup" written
-# to tty, and no STDERR output telling us why.
-
-# FIXME for some reason, setting HUP to 'IGNORE' will cause exit() to
-# write out "Hangup", and maybe loose some output. We insert a sleep...
-
sub mtr_exit ($) {
my $code= shift;
mtr_timer_stop_all($::glob_timers);
@@ -1126,7 +1131,7 @@ sub mtr_exit ($) {
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
- kill('HUP', -$$) if !$::glob_win32_perl and $$ == getpgrp();
+ POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp();
exit($code);
}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index b1c042fdcde..78218bcbd28 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2136,6 +2136,16 @@ sub remove_stale_vardir () {
mtr_verbose("Removing $opt_vardir/");
rmtree("$opt_vardir/");
}
+
+ if ( $opt_mem )
+ {
+ # A symlink from var/ to $opt_mem will be set up
+ # remove the $opt_mem dir to assure the symlink
+ # won't point at an old directory
+ mtr_verbose("Removing $opt_mem");
+ rmtree($opt_mem);
+ }
+
}
else
{
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index e6c323276ea..d6eb1ab06cf 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2273,4 +2273,18 @@ abcxx
select lpad('abc', cast(5 as unsigned integer), 'x');
lpad('abc', cast(5 as unsigned integer), 'x')
xxabc
+DROP TABLE IF EXISTS t1;
+CREATE TABLE `t1` (
+`id` varchar(20) NOT NULL,
+`tire` tinyint(3) unsigned NOT NULL,
+PRIMARY KEY (`id`)
+);
+INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);
+SELECT REPEAT( '#', tire ) AS A,
+REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`;
+A B tire
+ 0
+# # 1
+## ## 2
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 535af6907ad..ddab3d03454 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1115,4 +1115,26 @@ select repeat('a', cast(2 as unsigned int));
select rpad('abc', cast(5 as unsigned integer), 'x');
select lpad('abc', cast(5 as unsigned integer), 'x');
+
+#
+# Bug #25197 :repeat function returns null when using table field directly as count
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE `t1` (
+ `id` varchar(20) NOT NULL,
+ `tire` tinyint(3) unsigned NOT NULL,
+ PRIMARY KEY (`id`)
+);
+
+INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);
+
+SELECT REPEAT( '#', tire ) AS A,
+ REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests