#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
# This variable has no impact on perl build, it is here merely to satisfy
# "modernized" gate infrastructure. The bitness of the module is driven by the
# bitness of perl interpreter itself. That is hardcoded in
# $(WS_MAKE_RULES)/makemaker.mk
# MySQL 5.7 is not available in S11.
else
CLEAN_PATHS += $(LICENSE)
COMPONENT_TEST_TARGETS = test
'-e "s/[0-9][0-9]* wallclock secs (.*CPU)$$/<TIMINGS REMOVED>/" ' \
'-e "s/^\(\# mysql_[a-z][a-z]* is: \).*/\1<REMOVED>/" ' \
'-e "s/^\(\# SQL_DBMS_VER is \).*/\1<REMOVED>/" ' \
'-e "s/^\(\# Driver version is \).*/\1<REMOVED>/" ' \
'-e "/chmod 644 \"mysql.bs\"/d"' \
'-e "/Running Mkbootstrap/d"'
# !!!!!!!!! workaround for 22552923
# !!!!!!!!! workaround for 22552923
# For the testing we need to run mysql database first. The database needs it's
# directory, which will be $(MYSQL_TEST_DATADIR). The directory will also
# contain socket over which the testing will be performed. Problem is that the
# path can be maximally 107 characters long. To overcome that limit, we'll
# create a symlink in /tmp pointing to the directory and refer the database to
# that symlink. The symlink must have random name, so that multiple tests may
# be executed simultaneously. Problem is that we have to specify the symlink
# name during configure. To overcome that I specify the socket name as
# 'CHANGEME' and "fix" the tests once I know the name of symlink.
# Second challenge is to make sure that the mysql daemon will be stopped once
# the tests end (finish or are interrupted). There are three mechanisms to do
# that.
# a) mysql stores it's pid to $(MYSQL_TEST_DATADIR)/pid
# b) the COMPONENT_PRE_TEST_ACTION runs a background task which kills the
# daemon in 10 minutes no matter what.
# c) the COMPONENT_POST_TEST_ACTION kills both the mysql daemon and the
# background task
# If you want to keep mysqld running for your own testing purposes, delete all
# the lines containing 'kill' in COMPONENT_PRE_TEST_ACTION and whole
# COMPONENT_POST_TEST_ACTION. Then run "gmake test" once which will both run
# the DB and configure the module to use it. After that you can "cd builds/..."
# and "gmake test" directly there.
# not clobber the terminal. For debugging you can leave SILENT empty which will
# even turn on more output
SET_X = set -x;
else
SET_X =
\
: "Prepare the testing directory and create the symlink to it"; \
\
: "alter the tests to use the path we just created"; \
\
: "Initialize mysql DB"; \
--initialize-insecure \
\
\
: "Run the daemon in background. --gdb makes it possible to terminate mysqld via Ctrl+C"; \
--skip-networking \
--gdb \
: "Now wait for the database to be online"; \
sleep 10; \
: "We were not able to bring up the database?"; \
exit 1; \
fi; \
\
: "Set admin password"; \
\
: "Create a database"; \
create test; \
\
: "Run job which will kill mysqld in 10 minutes"; \
)
( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \
( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid_of_guard`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \
( $(SET_X) if [ -e "$(MYSQL_TEST_DATADIR)/test_link" ]; then rm -f `cat "$(MYSQL_TEST_DATADIR)/test_link"`; fi ) $(SILENT); \
)