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
|
From: Mateusz Kijowski <mateusz@kijowski.info>
Date: Fri, 6 Jan 2017 00:22:36 +0100
Subject: autodetect mysql version in test_sandbox
---
bin/test_sandbox | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/bin/test_sandbox b/bin/test_sandbox
index 97be196..e96509e 100755
--- a/bin/test_sandbox
+++ b/bin/test_sandbox
@@ -50,7 +50,7 @@ if ($@) {
# defaults
#
# my @versions = ( '5.0.51', '5.0.64', '5.1.23', '5.1.24', '5.1.25', '5.1.26', '6.0.6' );
-my @versions = ( '5.0.86', '5.1.43');
+my @versions = ( );
my $verbose = $DEBUG || $ENV{'VERBOSE'} || 0;
my %tests = (
@@ -110,6 +110,18 @@ GetOptions(
help() if $get_help;
+my $detected_mysql_version;
+my @mysql_config_locations = ( $ENV{"HOME"} . '/bin/mysql_config', '/usr/local/bin/mysql_config', '/usr/bin/mysql_config' );
+for my $mysql_config_location (@mysql_config_locations) {
+ $detected_mysql_version = qx(mysql_config --version) if -x '/usr/bin/mysql_config';
+ if ($detected_mysql_version) {
+ chomp $detected_mysql_version;
+ print "autodetected version $detected_mysql_version from $mysql_config_location\n";
+ push @versions, $detected_mysql_version;
+ last;
+ }
+}
+
if ($user_versions) {
my @new_versions = grep {$_} split /,/, $user_versions;
die "at least one version is required\n" unless @new_versions;
@@ -125,7 +137,9 @@ if ($user_versions) {
push @versions, $ver;
}
}
+die "at least one version is required\n" unless @versions;
for my $ver (@versions) {
+ print "using version $ver\n";
$ver =~ s/^~/$ENV{'HOME'}/;
unless (( -d "/opt/mysql/$ver")
or ( -d "$ENV{'HOME'}/opt/mysql/$ver")
|