summaryrefslogtreecommitdiff
blob: 9e3479e1114d34be9bba65a133ae7b16c463a64e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Based on MariaDB commit:

From d185f1d68bb1f37bea10d8ac6188e5a04faf4522 Mon Sep 17 00:00:00 2001
From: Oleksandr Byelkin <sanja@mariadb.com>
Date: Wed, 19 Apr 2017 14:30:52 +0200
Subject: [PATCH] Fix use of `require` in mysql-test-run.

The motivation for this is that Perl is moving towards not having
current directory ./ in @INC by default. This is causing
mysql-test-run.pl to fail in latest Debian Unstable:

  https://lists.debian.org/debian-devel-announce/2016/08/msg00013.html

However, we have `use "lib"`, there is no need for current directory
in @INC, except for a gross hack. In mtr_cases.pm, there is a
`require "mtr_misc.pl"`, which hides mtr_misc.pl away in mtr_cases
namespace. And things only work because mysql-test-run.pl loads it
with a different name, `require "lib/mtr_misc.pl"`! (Perl will
`require` only once for each unique filename).

Fix this by only using `require` in main program, and referencing
functions with :: scope from other namespaces. For multi-use in
different namespaces, proper `use` modules should be used.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>

diff -aurN a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
--- a/mysql-test/lib/mtr_cases.pm	2017-09-13 11:20:41.000000000 -0400
+++ b/mysql-test/lib/mtr_cases.pm	2017-10-18 13:26:23.071250558 -0400
@@ -68,8 +68,6 @@
 use My::Test;
 use My::Find;
 
-require "mtr_misc.pl";
-
 # Precompiled regex's for tests to do or skip
 my $do_test_reg;
 my $skip_test_reg;
diff -aurN a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
--- a/mysql-test/lib/mtr_report.pm	2017-09-13 11:20:41.000000000 -0400
+++ b/mysql-test/lib/mtr_report.pm	2017-10-18 13:23:22.589301656 -0400
@@ -33,7 +33,6 @@
 use My::Platform;
 use POSIX qw[ _exit ];
 use IO::Handle qw[ flush ];
-require "mtr_io.pl";
 use mtr_results;
 
 my $tot_real_time= 0;
@@ -95,7 +94,7 @@
   my $timer_str=  "";
   if ( $timer and -f "$::opt_vardir/log/timer" )
   {
-    $timer_str= mtr_fromfile("$::opt_vardir/log/timer");
+    $timer_str= ::mtr_fromfile("$::opt_vardir/log/timer");
     $tinfo->{timer}= $timer_str;
     resfile_test_info('duration', $timer_str) if $::opt_resfile;
   }
diff -aurN a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
--- a/mysql-test/mysql-test-run.pl	2017-09-13 11:20:41.000000000 -0400
+++ b/mysql-test/mysql-test-run.pl	2017-10-18 13:22:05.012314793 -0400
@@ -100,11 +100,11 @@
 use IO::Socket::INET;
 use IO::Select;
 
-require "lib/mtr_process.pl";
-require "lib/mtr_io.pl";
-require "lib/mtr_gcov.pl";
-require "lib/mtr_gprof.pl";
-require "lib/mtr_misc.pl";
+require "mtr_process.pl";
+require "mtr_io.pl";
+require "mtr_gcov.pl";
+require "mtr_gprof.pl";
+require "mtr_misc.pl";
 
 $SIG{INT}= sub { mtr_error("Got ^C signal"); };