Skip to content

Commit a98b7bb

Browse files
committed
Test against mysql55 on OSX and allow failures
See #633.
1 parent 5067cf0 commit a98b7bb

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ bundler_args: --without benchmarks development
33
before_install:
44
- gem --version
55
- bash .travis_setup.sh
6-
- mysqld --version
7-
- mysql -u $USER -e "CREATE DATABASE IF NOT EXISTS test"
86
os:
97
- linux
108
rvm:
@@ -24,4 +22,8 @@ matrix:
2422
- rvm: 2.0.0
2523
env: DB=mysql57
2624
- rvm: 2.0.0
25+
env: DB=mysql
26+
os: osx
27+
- rvm: 2.0.0
28+
env: DB=mysql55
2729
os: osx

.travis_setup.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ fi
1414

1515
# Install MySQL if OS=darwin
1616
if [[ x$OSTYPE =~ ^xdarwin ]]; then
17-
brew install mysql
18-
mysql.server start
17+
brew update
18+
brew install "$DB"
19+
$(brew --prefix "$DB")/bin/mysql.server start
1920
fi
2021

2122
# TODO: get SSL working on OS X in Travis
@@ -25,3 +26,12 @@ if ! [[ x$OSTYPE =~ ^xdarwin ]]; then
2526
fi
2627

2728
sudo mysql -e "CREATE USER '$USER'@'localhost'" || true
29+
30+
# Print the MySQL version and create the test DB
31+
if [[ x$OSTYPE =~ ^xdarwin ]]; then
32+
$(brew --prefix "$DB")/bin/mysqld --version
33+
$(brew --prefix "$DB")/bin/mysql -u $USER -e "CREATE DATABASE IF NOT EXISTS test"
34+
else
35+
mysqld --version
36+
mysql -u $USER -e "CREATE DATABASE IF NOT EXISTS test"
37+
fi

ext/mysql2/extconf.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def asplode lib
3434
/usr/local/mysql
3535
/usr/local/mysql-*
3636
/usr/local/lib/mysql5*
37+
/usr/local/opt/mysql5*
3738
].map{|dir| "#{dir}/bin" }
3839

3940
GLOB = "{#{dirs.join(',')}}/{mysql_config,mysql_config5,mariadb_config}"
@@ -73,14 +74,8 @@ def asplode lib
7374
rpath_dir = libs
7475
else
7576
inc, lib = dir_config('mysql', '/usr/local')
76-
libs = ['m', 'z', 'socket', 'nsl', 'mygcc']
77-
found = false
78-
while not find_library('mysqlclient', 'mysql_query', lib, "#{lib}/mysql") do
79-
exit 1 if libs.empty?
80-
found ||= have_library(libs.shift)
81-
end
8277

83-
asplode("mysql client") unless found
78+
asplode("mysql client") unless find_library('mysqlclient', 'mysql_query', lib, "#{lib}/mysql")
8479

8580
rpath_dir = lib
8681
end

spec/mysql2/client_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,13 +478,21 @@ def run_gc
478478
end
479479

480480
it "should handle Timeouts without leaving the connection hanging if reconnect is true" do
481+
if RUBY_PLATFORM.include?('darwin') && Mysql2::Client.info.fetch(:version).start_with?('5.5')
482+
pending('libmysqlclient 5.5 on OSX is afflicted by an unknown bug that breaks this test. See #633 and #634.')
483+
end
484+
481485
client = Mysql2::Client.new(DatabaseCredentials['root'].merge(:reconnect => true))
482486

483487
expect { Timeout.timeout(0.1, ArgumentError) { client.query('SELECT SLEEP(1)') } }.to raise_error(ArgumentError)
484488
expect { client.query('SELECT 1') }.to_not raise_error
485489
end
486490

487491
it "should handle Timeouts without leaving the connection hanging if reconnect is set to true after construction" do
492+
if RUBY_PLATFORM.include?('darwin') && Mysql2::Client.info.fetch(:version).start_with?('5.5')
493+
pending('libmysqlclient 5.5 on OSX is afflicted by an unknown bug that breaks this test. See #633 and #634.')
494+
end
495+
488496
client = Mysql2::Client.new(DatabaseCredentials['root'])
489497

490498
expect { Timeout.timeout(0.1, ArgumentError) { client.query('SELECT SLEEP(1)') } }.to raise_error(ArgumentError)

0 commit comments

Comments
 (0)