summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm11
-rw-r--r--mysql-test/lib/My/Find.pm20
-rw-r--r--mysql-test/lib/My/SafeProcess.pm18
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt14
-rwxr-xr-xmysql-test/lib/My/SafeProcess/safe_kill_win.cc1
-rwxr-xr-xmysql-test/lib/My/SafeProcess/safe_process_win.cc5
6 files changed, 53 insertions, 16 deletions
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index 505f93f1fec..1d2c606a6f7 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -29,6 +29,15 @@ sub get_basedir {
return $basedir;
}
+# Retrive build directory (which is different from basedir in out-of-source build)
+sub get_bindir {
+ if (defined $ENV{MTR_BINDIR})
+ {
+ return $ENV{MTR_BINDIR};
+ }
+ my ($self, $group)= @_;
+ return $self->get_basedir($group);
+}
sub fix_charset_dir {
my ($self, $config, $group_name, $group)= @_;
@@ -38,7 +47,7 @@ sub fix_charset_dir {
sub fix_language {
my ($self, $config, $group_name, $group)= @_;
- return my_find_dir($self->get_basedir($group),
+ return my_find_dir($self->get_bindir($group),
\@share_locations);
}
diff --git a/mysql-test/lib/My/Find.pm b/mysql-test/lib/My/Find.pm
index 8557584bbc8..b2fec0d77b8 100644
--- a/mysql-test/lib/My/Find.pm
+++ b/mysql-test/lib/My/Find.pm
@@ -167,16 +167,16 @@ sub my_find_paths {
}
# -------------------------------------------------------
- # Windows specific
- # -------------------------------------------------------
- if (IS_WINDOWS) {
- # Add the default extra build dirs unless a specific one has
- # already been selected
- push(@extra_dirs,
- ("release",
- "relwithdebinfo",
- "debug")) if @extra_dirs == 0;
- }
+ # CMake generator specific (Visual Studio and Xcode have multimode builds)
+ # -------------------------------------------------------
+
+ # Add the default extra build dirs unless a specific one has
+ # already been selected
+ push(@extra_dirs,
+ ("Release",
+ "Relwithdebinfo",
+ "Debug")) if @extra_dirs == 0;
+
#print "extra_build_dir: @extra_dirs\n";
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
index 7e102b628ca..0fac25b814b 100644
--- a/mysql-test/lib/My/SafeProcess.pm
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -84,19 +84,31 @@ sub is_child {
# Find the safe process binary or script
my @safe_process_cmd;
my $safe_kill;
+my $bindir;
+if(defined $ENV{MTR_BINDIR})
+{
+ # This is an out-of-source build. Build directory
+ # is given in MTR_BINDIR env.variable
+ $bindir = $ENV{MTR_BINDIR}."/mysql-test";
+}
+else
+{
+ $bindir = ".";
+}
+
if (IS_WIN32PERL or IS_CYGWIN){
# Use my_safe_process.exe
- my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
+ my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
# Use my_safe_kill.exe
- $safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
+ $safe_kill= my_find_bin($bindir, "lib/My/SafeProcess", "my_safe_kill");
}
else
{
# Use my_safe_process
- my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
+ my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
}
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index 97fab820f95..d22d4fddddf 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -13,5 +13,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
-ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
+IF (WIN32)
+ ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
+ ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
+ELSE()
+ ADD_EXECUTABLE(my_safe_process safe_process.cc)
+ENDIF()
+
+INSTALL(TARGETS my_safe_process DESTINATION "mysql-test/lib/My/SafeProcess")
+IF(WIN32)
+ INSTALL(TARGETS my_safe_kill DESTINATION "mysql-test/lib/My/SafeProcess")
+ENDIF()
+INSTALL(FILES safe_process.pl Base.pm DESTINATION "mysql-test/lib/My/SafeProcess")
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
index 963a02c8099..f72b851d0b6 100755
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
@@ -24,6 +24,7 @@
#include <windows.h>
#include <stdio.h>
#include <signal.h>
+#include <stdlib.h>
int main(int argc, const char** argv )
{
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
index 455262b29f5..ce5deb4d82a 100755
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
@@ -57,6 +57,7 @@
#include <stdio.h>
#include <tlhelp32.h>
#include <signal.h>
+#include <stdlib.h>
static int verbose= 0;
static char safe_process_name[32]= {0};
@@ -248,6 +249,10 @@ int main(int argc, const char** argv )
Make all processes associated with the job terminate when the
last handle to the job is closed.
*/
+#ifndef JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
+#define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
+#endif
+
jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
if (SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation,
&jeli, sizeof(jeli)) == 0)