commit d78273d1e53308c8fe78b9e067a88c43bd05e540
Author: Elena Stepanova <elenst@montyprogram.com>
Date:   Sun Nov 5 01:30:40 2017 +0200

    MDEV-14288 Add MTR option to run tests with real server defaults

diff --git a/mysql-test/include/hard_default_my.cnf b/mysql-test/include/hard_default_my.cnf
new file mode 100644
index 0000000..b89b69e
--- /dev/null
+++ b/mysql-test/include/hard_default_my.cnf
@@ -0,0 +1,43 @@
+# Copyright (c) 2017 MariaDB Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+
+# Use real default settings for mysqld processes
+
+[mysqld]
+open-files-limit=           1024
+log-basename=mysqld
+
+loose-ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
+loose-ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem
+loose-ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem
+
+[embedded]
+local-infile
+
+[client]
+plugin-dir=@mysqld.1.plugin-dir
+
+[mysqltest]
+loose-ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
+loose-ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem
+loose-ssl-key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem
+
+[mysqld.1]
+
+#!run-master-sh
+
+[ENV]
+MASTER_MYPORT=           @mysqld.1.port
+MASTER_MYSOCK=           @mysqld.1.socket
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index b8ce038..dcdb534 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -37,7 +37,9 @@ sub add_opt_values {
 
   # add auto-options
   $config->insert('OPT', 'port'   => sub { fix_port($self, $config) });
-  $config->insert('mysqld', "loose-skip-plugin-$_" => undef) for (@::optional_plugins);
+  if (!$::opt_default_server_options) {
+    $config->insert('mysqld', "loose-skip-plugin-$_" => undef) for (@::optional_plugins);
+  }
 }
 
 my @pre_rules=
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 38c52b7..26a4edd 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -876,7 +876,10 @@ sub collect_one_test_case {
     if (not $config)
     {
       # Suite has no config, autodetect which one to use
-      if ($tinfo->{rpl_test}) {
+      if ($::opt_default_server_options) {
+        $config= "include/hard_default_my.cnf";
+      }
+      elsif ($tinfo->{rpl_test}) {
         $config= "suite/rpl/my.cnf";
       } else {
         $config= "include/default_my.cnf";
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 33d9c7b..997fb82 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -131,6 +131,7 @@ our $plugindir;
 my $path_vardir_trace;          # unix formatted opt_vardir for trace files
 my $opt_tmpdir;                 # Path to use for tmp/ dir
 my $opt_tmpdir_pid;
+our $opt_default_server_options;
 
 my $opt_start;
 my $opt_start_dirty;
@@ -1106,6 +1107,9 @@ sub command_line_setup {
 	     # Extra config file to append to all generated configs
 	     'defaults-extra-file=s'    => \&collect_option,
 
+	     # Use hard defaults instead of heavily modified MTR configuration
+	     'default-server-options'    => \$opt_default_server_options,
+
              # Control what test suites or cases to run
              'force+'                   => \$opt_force,
              'with-ndbcluster-only'     => \&collect_option,
@@ -3473,11 +3477,15 @@ sub sql_to_bootstrap {
 sub default_mysqld {
   # Generate new config file from template
   environment_setup();
+  my $config_template= ($opt_default_server_options
+      ? 'include/hard_default_my.cnf'
+      : 'include/default_my.cnf'
+  );
   my $config= My::ConfigFactory->new_config
     ( {
        basedir         => $basedir,
        testdir         => $glob_mysql_test_dir,
-       template_path   => "include/default_my.cnf",
+       template_path   => $config_template,
        vardir          => $opt_vardir,
        tmpdir          => $opt_tmpdir,
        baseport        => 0,
@@ -3509,12 +3517,14 @@ sub mysql_install_db {
   mtr_add_arg($args, "--basedir=%s", $install_basedir);
   mtr_add_arg($args, "--datadir=%s", $install_datadir);
   mtr_add_arg($args, "--plugin-dir=%s", $plugindir);
-  mtr_add_arg($args, "--default-storage-engine=myisam");
-  mtr_add_arg($args, "--loose-skip-plugin-$_") for @optional_plugins;
-  # starting from 10.0 bootstrap scripts require InnoDB
-  mtr_add_arg($args, "--loose-innodb");
-  mtr_add_arg($args, "--loose-innodb-log-file-size=5M");
-  mtr_add_arg($args, "--disable-sync-frm");
+  if (!$opt_default_server_options) {
+    mtr_add_arg($args, "--default-storage-engine=myisam");
+    mtr_add_arg($args, "--loose-skip-plugin-$_") for @optional_plugins;
+    # starting from 10.0 bootstrap scripts require InnoDB
+    mtr_add_arg($args, "--loose-innodb");
+    mtr_add_arg($args, "--loose-innodb-log-file-size=5M");
+    mtr_add_arg($args, "--disable-sync-frm");
+  }
   mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/");
   mtr_add_arg($args, "--core-file");
   mtr_add_arg($args, "--console");
@@ -6438,6 +6448,8 @@ Options to control what engine/variation to run:
                         tests
   defaults-extra-file=<config template> Extra config template to add to
                         all generated configs
+  default-server-options Use hard server defaults instead of the usual
+                        heavily adjusted defaults-file
   combination=<opt>     Use at least twice to run tests with specified
                         options to mysqld
   dry-run               Don't run any tests, print the list of tests
