diff --git a/extra/perror.c b/extra/perror.c index 82311c1b2c9..531d30dae86 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -218,8 +218,11 @@ int main(int argc,char *argv[]) On some system, like NETWARE, strerror(unknown_error) returns a string 'Unknown Error'. To avoid printing it we try to find the error string by asking for an impossible big error message. + + On Solaris 2.8 it might return NULL */ - msg= strerror(10000); + if ((msg= strerror(10000)) == NULL) + msg= "Unknown Error"; /* Allocate a buffer for unknown_error since strerror always returns diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 91a9a758d1d..95ce5dc1bb2 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -187,6 +187,7 @@ our $exe_mysqltest; our $exe_slave_mysqld; our $exe_im; our $exe_my_print_defaults; +our $exe_perror; our $lib_udf_example; our $exe_libtool; @@ -1048,6 +1049,8 @@ sub executable_setup () { $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets"); $exe_my_print_defaults= mtr_exe_exists("$path_client_bindir/my_print_defaults"); + $exe_perror= + mtr_exe_exists("$path_client_bindir/perror"); } else { @@ -1060,6 +1063,8 @@ sub executable_setup () { "$glob_basedir/server-tools/instance-manager/mysqlmanager"); $exe_my_print_defaults= mtr_exe_exists("$glob_basedir/extra/my_print_defaults"); + $exe_perror= + mtr_exe_exists("$glob_basedir/extra/perror"); } if ( $glob_use_embedded_server ) @@ -1107,6 +1112,8 @@ sub executable_setup () { "$glob_basedir/scripts/mysql_fix_privilege_tables"); $exe_my_print_defaults= mtr_exe_exists("$path_client_bindir/my_print_defaults"); + $exe_perror= + mtr_exe_exists("$path_client_bindir/perror"); $path_language= mtr_path_exists("$glob_basedir/share/mysql/english/", "$glob_basedir/share/english/"); @@ -3103,6 +3110,7 @@ sub run_mysqltest ($) { $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults; $ENV{'UDF_EXAMPLE_LIB'}= ($lib_udf_example ? basename($lib_udf_example) : ""); + $ENV{'MY_PERROR'}= $exe_perror; $ENV{'NDB_MGM'}= $exe_ndb_mgm; $ENV{'NDB_BACKUP_DIR'}= $path_ndb_data_dir; diff --git a/mysql-test/r/have_perror.require b/mysql-test/r/have_perror.require new file mode 100644 index 00000000000..260687c87f0 --- /dev/null +++ b/mysql-test/r/have_perror.require @@ -0,0 +1,2 @@ +have_perror +1 diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result new file mode 100644 index 00000000000..6539955bba6 --- /dev/null +++ b/mysql-test/r/perror.result @@ -0,0 +1,3 @@ +MySQL error code 150: Foreign key constraint is incorrectly formed +Is a named type file +Didn't find key on read or update diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test new file mode 100644 index 00000000000..81847f85c96 --- /dev/null +++ b/mysql-test/t/perror.test @@ -0,0 +1,11 @@ +# +# Check if the variable MY_PERROR is set +# +--require r/have_perror.require +disable_query_log; +eval select LENGTH("$MY_PERROR") > 0 as "have_perror"; +enable_query_log; + +--exec $MY_PERROR 150 +--exec $MY_PERROR --silent 120 +