mysql@5.6: don't retain huge test folder, replace existing test
This commit is contained in:
parent
aa23b38ea7
commit
11bdf19dc4
1 changed files with 23 additions and 3 deletions
|
@ -101,6 +101,12 @@ class MysqlAT56 < Formula
|
|||
system "make"
|
||||
system "make", "install"
|
||||
|
||||
# We don't want to keep a 240MB+ folder around most users won't need.
|
||||
(prefix/"mysql-test").cd do
|
||||
system "./mysql-test-run.pl", "status", "--vardir=#{Dir.mktmpdir}"
|
||||
end
|
||||
rm_rf prefix/"mysql-test"
|
||||
|
||||
# Don't create databases inside of the prefix!
|
||||
# See: https://github.com/Homebrew/homebrew/issues/4975
|
||||
rm_rf prefix/"data"
|
||||
|
@ -167,9 +173,23 @@ class MysqlAT56 < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
system "/bin/sh", "-n", "#{bin}/mysqld_safe"
|
||||
(prefix/"mysql-test").cd do
|
||||
system "./mysql-test-run.pl", "status", "--vardir=#{testpath}"
|
||||
begin
|
||||
# Expects datadir to be a completely clean dir, which testpath isn't.
|
||||
dir = Dir.mktmpdir
|
||||
system bin/"mysql_install_db", "--user=#{ENV["USER"]}",
|
||||
"--basedir=#{prefix}", "--datadir=#{dir}", "--tmpdir=#{dir}"
|
||||
|
||||
pid = fork do
|
||||
exec bin/"mysqld", "--bind-address=127.0.0.1", "--datadir=#{dir}"
|
||||
end
|
||||
sleep 2
|
||||
|
||||
output = shell_output("curl 127.0.0.1:3306")
|
||||
output.force_encoding("ASCII-8BIT") if output.respond_to?(:force_encoding)
|
||||
assert_match version.to_s, output
|
||||
ensure
|
||||
Process.kill(9, pid)
|
||||
Process.wait(pid)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue