Makefile revision 7391
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# CDDL HEADER START
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# The contents of this file are subject to the terms of the
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# Common Development and Distribution License (the "License").
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# You may not use this file except in compliance with the License.
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# See the License for the specific language governing permissions
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# and limitations under the License.
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# When distributing Covered Code, include this CDDL HEADER in each
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# If applicable, add the following below this CDDL HEADER, with the
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# fields enclosed by brackets "[]" replaced with your own identifying
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# information: Portions Copyright [yyyy] [name of copyright owner]
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# CDDL HEADER END
472780d8b1ec3f3f4ff78eb21a013136e5aa1cfeKay Sievers# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
472780d8b1ec3f3f4ff78eb21a013136e5aa1cfeKay Sievers# This variable has no impact on perl build, it is here merely to satisfy
25da63b9dac8f166ebf390ca92d1de18fbfc9d11Kay Sievers# "modernized" gate infrastructure. The bitness of the module is driven by the
25da63b9dac8f166ebf390ca92d1de18fbfc9d11Kay Sievers# bitness of perl interpreter itself. That is hardcoded in
ad37f393fa97f4274cc3bf97a0d8c388a429037eKay Sievers# $(WS_MAKE_RULES)/makemaker.mk
3058e017fced6d5c8712e10c8c1477421bc1e960Thadeu Lima de Souza Cascardo sha256:a3438bba3cce02b13870b146b9db76a519b98e978d9dfe8516a63daff2989040
1328f66ad16b5afeb5684858c27e121a46c1959eKay SieversCOMPONENT_ARCHIVE_URL= http://search.cpan.org/CPAN/authors/id/M/MI/MICHIELB/$(COMPONENT_ARCHIVE)
3058e017fced6d5c8712e10c8c1477421bc1e960Thadeu Lima de Souza CascardoCOMPONENT_PROJECT_URL= https://github.com/perl5-dbi/DBD-mysql
472780d8b1ec3f3f4ff78eb21a013136e5aa1cfeKay Sievers# MySQL 5.7 is not available in S11.
ad37f393fa97f4274cc3bf97a0d8c388a429037eKay SieversCOMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-all.master
f610d6de38119b372b377ec41b2a6089872d3294Kay Sievers '-e "s/[0-9][0-9]* wallclock secs (.*CPU)$$/<TIMINGS REMOVED>/" ' \
f610d6de38119b372b377ec41b2a6089872d3294Kay Sievers '-e "s/^\(\# mysql_[a-z][a-z]* is: \).*/\1<REMOVED>/" ' \
de892aea1c486b59e04884268b612081d1660514Kay Sievers '-e "s/^\(\# SQL_DBMS_VER is \).*/\1<REMOVED>/" ' \
f610d6de38119b372b377ec41b2a6089872d3294Kay Sievers '-e "s/^\(\# Driver version is \).*/\1<REMOVED>/" ' \
decd634e801bee2c554edb35383cc9d43417a850Kay Sievers '-e "/chmod 644 \"mysql.bs\"/d"' \
decd634e801bee2c554edb35383cc9d43417a850Kay Sievers '-e "/Running Mkbootstrap/d"'
decd634e801bee2c554edb35383cc9d43417a850Kay SieversMYSQL_BINDIR = $(USRDIR)/mysql/$(MYSQL_VERSION)/bin
f610d6de38119b372b377ec41b2a6089872d3294Kay SieversMYSQL_TEST_DATADIR = $(COMPONENT_TEST_BUILD_DIR)/test_datadir
f610d6de38119b372b377ec41b2a6089872d3294Kay SieversCONFIGURE_OPTIONS += --mysql_config="$(MYSQL_BINDIR)/mysql_config"
f610d6de38119b372b377ec41b2a6089872d3294Kay SieversCONFIGURE_OPTIONS += --testuser=$(MYSQL_TEST_USER)
f610d6de38119b372b377ec41b2a6089872d3294Kay SieversCONFIGURE_OPTIONS += --testpassword=$(MYSQL_TEST_PASSWORD)
f610d6de38119b372b377ec41b2a6089872d3294Kay Sievers# !!!!!!!!! workaround for 22552923
f610d6de38119b372b377ec41b2a6089872d3294Kay SieversMYSQL_LIBS = $(shell $(MYSQL_BINDIR)/mysql_config --libs)
f610d6de38119b372b377ec41b2a6089872d3294Kay SieversCONFIGURE_OPTIONS += --libs="$(MYSQL_LIBS) -lCrun"
f610d6de38119b372b377ec41b2a6089872d3294Kay Sievers# !!!!!!!!! workaround for 22552923
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sievers# For the testing we need to run mysql database first. The database needs it's
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# directory, which will be $(MYSQL_TEST_DATADIR). The directory will also
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# contain socket over which the testing will be performed. Problem is that the
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# path can be maximally 107 characters long. To overcome that limit, we'll
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# create a symlink in /tmp pointing to the directory and refer the database to
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# that symlink. The symlink must have random name, so that multiple tests may
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# be executed simultaneously. Problem is that we have to specify the symlink
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# name during configure. To overcome that I specify the socket name as
19aa72f74e41045510b4af3f1415b419d42ff20bTom Gundersen# 'CHANGEME' and "fix" the tests once I know the name of symlink.
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# Second challenge is to make sure that the mysql daemon will be stopped once
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# the tests end (finish or are interrupted). There are three mechanisms to do
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers# a) mysql stores it's pid to $(MYSQL_TEST_DATADIR)/pid
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# b) the COMPONENT_PRE_TEST_ACTION runs a background task which kills the
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# daemon in 10 minutes no matter what.
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# c) the COMPONENT_POST_TEST_ACTION kills both the mysql daemon and the
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# background task
e3d563346c4237af23335cc6904e0662efdf62adTom Gundersen# If you want to keep mysqld running for your own testing purposes, delete all
e0d4a0ac06afb856c9370c5c256f0f7bb7efdc8eHendrik Brueckner# the lines containing 'kill' in COMPONENT_PRE_TEST_ACTION and whole
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# COMPONENT_POST_TEST_ACTION. Then run "gmake test" once which will both run
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# the DB and configure the module to use it. After that you can "cd builds/..."
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# and "gmake test" directly there.
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# Normally the noise from background jobs is sent to /dev/null so that it does
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# not clobber the terminal. For debugging you can leave SILENT empty which will
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers# even turn on more output
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers : "Prepare the testing directory and create the symlink to it"; \
c0a43734ca84a3c9170d4a2d7f4d329b9ef47abcTom Gundersen TEST_LINK=`mktemp -t dbd-mysql-test.XXXXXX`; \
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers : "alter the tests to use the path we just created"; \
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers $(PERL) -pi -e "s,('testsocket' => ').*?',\$$1/$$TEST_LINK/socket'," t/mysql.mtest ;\
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers --basedir=/usr/mysql/$(MYSQL_VERSION) $(SILENT) ; \
c0a43734ca84a3c9170d4a2d7f4d329b9ef47abcTom Gundersen echo "$$TEST_LINK" > "$$TEST_LINK"/test_link; \
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers : "Run the daemon in background. --gdb makes it possible to terminate mysqld via Ctrl+C"; \
c0a43734ca84a3c9170d4a2d7f4d329b9ef47abcTom Gundersen : "We were not able to bring up the database?"; \
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers ps -p $$PID && kill $$PID || : \
de892aea1c486b59e04884268b612081d1660514Kay Sievers : "Run job which will kill mysqld in 10 minutes"; \
1328f66ad16b5afeb5684858c27e121a46c1959eKay Sievers ( $(SET_X) PID=`cat "$$TEST_LINK"/pid`; sleep 600; ps -p $$PID && kill $$PID || : ) $(SILENT) & \
de892aea1c486b59e04884268b612081d1660514Kay Sievers ( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers ( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid_of_guard`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \
0260944060426d54d9ecb40930baad985cbd02a1Kay Sievers ( $(SET_X) if [ -e "$(MYSQL_TEST_DATADIR)/test_link" ]; then rm -f `cat "$(MYSQL_TEST_DATADIR)/test_link"`; fi ) $(SILENT); \
1328f66ad16b5afeb5684858c27e121a46c1959eKay Sievers $(PERL) -pe 's/COMPONENT_VERSION/$(COMPONENT_VERSION)/g' "$<" > "$@"
b5dd8148730db080b48b874c214f8f74ae787d6bZbigniew Jędrzejewski-SzmekREQUIRED_PACKAGES += database/mysql-57/library