|
1 # |
|
2 # CDDL HEADER START |
|
3 # |
|
4 # The contents of this file are subject to the terms of the |
|
5 # Common Development and Distribution License (the "License"). |
|
6 # You may not use this file except in compliance with the License. |
|
7 # |
|
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 # or http://www.opensolaris.org/os/licensing. |
|
10 # See the License for the specific language governing permissions |
|
11 # and limitations under the License. |
|
12 # |
|
13 # When distributing Covered Code, include this CDDL HEADER in each |
|
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 # If applicable, add the following below this CDDL HEADER, with the |
|
16 # fields enclosed by brackets "[]" replaced with your own identifying |
|
17 # information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 # |
|
19 # CDDL HEADER END |
|
20 # |
|
21 |
|
22 # |
|
23 # Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
|
24 # |
|
25 |
|
26 # This variable has no impact on perl build, it is here merely to satisfy |
|
27 # "modernized" gate infrastructure. The bitness of the module is driven by the |
|
28 # bitness of perl interpreter itself. That is hardcoded in |
|
29 # $(WS_MAKE_RULES)/makemaker.mk |
|
30 BUILD_BITS = 64 |
|
31 |
|
32 include ../../../make-rules/shared-macros.mk |
|
33 |
|
34 COMPONENT_NAME= DBD-mysql |
|
35 COMPONENT_VERSION= 4.033 |
|
36 IPS_COMPONENT_VERSION= 4033 |
|
37 HUMAN_VERSION= $(COMPONENT_VERSION) |
|
38 COMPONENT_ARCHIVE_HASH= \ |
|
39 sha256:cc98bbcc33581fbc55b42ae681c6946b70a26f549b3c64466740dfe9a7eac91c |
|
40 COMPONENT_ARCHIVE_URL= http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/$(COMPONENT_ARCHIVE) |
|
41 COMPONENT_PROJECT_URL= https://github.com/perl5-dbi/DBD-mysql |
|
42 COMPONENT_BUGDB= perl-mod/dbd-mysql |
|
43 |
|
44 TPNO= 25495 |
|
45 |
|
46 BUILD_STYLE= makemaker |
|
47 LICENSE=DBD-mysql.license |
|
48 BUILD_TARGET= $(BUILD_$(MK_BITS)) $(LICENSE) |
|
49 include $(WS_MAKE_RULES)/common.mk |
|
50 |
|
51 CLEAN_PATHS += $(LICENSE) |
|
52 |
|
53 COMPONENT_TEST_TARGETS = test |
|
54 COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-all.master |
|
55 COMPONENT_TEST_TRANSFORMS += \ |
|
56 '-e "s/[0-9][0-9]* wallclock secs (.*CPU)$$/<TIMINGS REMOVED>/" ' \ |
|
57 '-e "s/^\(\# mysql_[a-z][a-z]* is: \).*/\1<REMOVED>/" ' \ |
|
58 '-e "s/^\(\# SQL_DBMS_VER is \).*/\1<REMOVED>/" ' \ |
|
59 '-e "s/^\(\# Driver version is \).*/\1<REMOVED>/" ' |
|
60 |
|
61 ASLR_MODE = $(ASLR_NOT_APPLICABLE) |
|
62 |
|
63 MYSQL_VERSION = 5.6 |
|
64 MYSQL_BINDIR = $(USRDIR)/mysql/$(MYSQL_VERSION)/bin |
|
65 MYSQL_TEST_USER = root |
|
66 MYSQL_TEST_PASSWORD = new-password |
|
67 MYSQL_TEST_DATADIR = $(COMPONENT_TEST_BUILD_DIR)/test_datadir |
|
68 |
|
69 COMPONENT_TEST_ENV += MYSQL_HISTFILE=/dev/null |
|
70 |
|
71 CONFIGURE_OPTIONS += --mysql_config="$(MYSQL_BINDIR)/mysql_config" |
|
72 CONFIGURE_OPTIONS += --testuser=$(MYSQL_TEST_USER) |
|
73 CONFIGURE_OPTIONS += --testpassword=$(MYSQL_TEST_PASSWORD) |
|
74 CONFIGURE_OPTIONS += --testsocket=CHANGEME |
|
75 |
|
76 # !!!!!!!!! workaround for 22552923 |
|
77 MYSQL_LIBS = $(shell $(MYSQL_BINDIR)/mysql_config --libs) |
|
78 CONFIGURE_OPTIONS += --libs="$(MYSQL_LIBS) -lCrun" |
|
79 # !!!!!!!!! workaround for 22552923 |
|
80 |
|
81 # For the testing we need to run mysql database first. The database needs it's |
|
82 # directory, which will be $(MYSQL_TEST_DATADIR). The directory will also |
|
83 # contain socket over which the testing will be performed. Problem is that the |
|
84 # path can be maximally 107 characters long. To overcome that limit, we'll |
|
85 # create a symlink in /tmp pointing to the directory and refer the database to |
|
86 # that symlink. The symlink must have random name, so that multiple tests may |
|
87 # be executed simultaneously. Problem is that we have to specify the symlink |
|
88 # name during configure. To overcome that I specify the socket name as |
|
89 # 'CHANGEME' and "fix" the tests once I know the name of symlink. |
|
90 |
|
91 # Second challenge is to make sure that the mysql daemon will be stopped once |
|
92 # the tests end (finish or are interrupted). There are three mechanisms to do |
|
93 # that. |
|
94 # a) mysql stores it's pid to $(MYSQL_TEST_DATADIR)/pid |
|
95 # b) the COMPONENT_PRE_TEST_ACTION runs a background task which kills the |
|
96 # daemon in 10 minutes no matter what. |
|
97 # c) the COMPONENT_POST_TEST_ACTION kills both the mysql daemon and the |
|
98 # background task |
|
99 |
|
100 # If you want to keep mysqld running for your own testing purposes, delete all |
|
101 # the lines containing 'kill' in COMPONENT_PRE_TEST_ACTION and |
|
102 # COMPONENT_POST_TEST_ACTION. Then run "gmake test" once which will both run |
|
103 # the DB and configure the module to use it. After that you can "cd builds/..." |
|
104 # and "gmake test" directly there. |
|
105 |
|
106 # Normally the noise from background jobs is sent to /dev/null so that it does |
|
107 # not clobber the terminal. For debugging you can leave SILENT empty which will |
|
108 # even turn on more output |
|
109 SILENT = >/dev/null 2>&1 |
|
110 ifeq ($(strip $(SILENT)),) |
|
111 SET_X = set -x; |
|
112 MYSQLD_VERBOSE = |
|
113 else |
|
114 SET_X = |
|
115 MYSQLD_VERBOSE = --verbose |
|
116 endif |
|
117 |
|
118 COMPONENT_PRE_TEST_ACTION = ( \ |
|
119 $(SET_X) cd "$(@D)"; \ |
|
120 \ |
|
121 : "Prepare the testing directory and create the symlink to it"; \ |
|
122 $(RM) -r "$(MYSQL_TEST_DATADIR)"; \ |
|
123 mkdir "$(MYSQL_TEST_DATADIR)"; \ |
|
124 TEST_LINK=`mktemp -t dbd-mysql-test.XXXXXX`; \ |
|
125 $(RM) "$$TEST_LINK"; \ |
|
126 ln -s $(MYSQL_TEST_DATADIR) "$$TEST_LINK"; \ |
|
127 echo "$$TEST_LINK" > "$$TEST_LINK"/test_link; \ |
|
128 \ |
|
129 : "alter the tests to use the path we just created"; \ |
|
130 $(PERL) -pi -e "s,CHANGEME,$$TEST_LINK/socket," t/mysql.mtest ;\ |
|
131 \ |
|
132 : "Initialize mysql DB"; \ |
|
133 "$(MYSQL_BINDIR)/mysql_install_db" \ |
|
134 --keep-my-cnf \ |
|
135 --datadir="$$TEST_LINK" \ |
|
136 --basedir=/usr/mysql/$(MYSQL_VERSION) $(SILENT) ; \ |
|
137 \ |
|
138 : "Run the daemon in background. --gdb makes it possible to terminate mysqld via Ctrl+C"; \ |
|
139 "$(MYSQL_BINDIR)/mysqld" \ |
|
140 $(MYSQLD_VERBOSE) \ |
|
141 --skip-networking \ |
|
142 --datadir="$$TEST_LINK" \ |
|
143 --socket="$$TEST_LINK"/socket \ |
|
144 --pid-file="$$TEST_LINK"/pid \ |
|
145 --gdb \ |
|
146 --log-warnings=0 \ |
|
147 $(SILENT) & \ |
|
148 : "Now wait for the database to be online"; \ |
|
149 sleep 10; \ |
|
150 if [ ! -e "$$TEST_LINK/socket" ]; then \ |
|
151 : "We were not able to bring up the database?"; \ |
|
152 PID=`cat "$$TEST_LINK"/pid`; \ |
|
153 ps -p $$PID && kill $$PID || : \ |
|
154 $(RM) "$$TEST_LINK"; \ |
|
155 exit 1; \ |
|
156 fi; \ |
|
157 \ |
|
158 : "Set admin password"; \ |
|
159 "$(MYSQL_BINDIR)/mysqladmin" \ |
|
160 --socket "$$TEST_LINK"/socket \ |
|
161 -u "$(MYSQL_TEST_USER)" \ |
|
162 password "$(MYSQL_TEST_PASSWORD)" ; \ |
|
163 \ |
|
164 : "Run job which will kill mysqld in 10 minutes"; \ |
|
165 ( $(SET_X) PID=`cat "$$TEST_LINK"/pid`; sleep 600; ps -p $$PID && kill $$PID || : ) $(SILENT) & \ |
|
166 echo $$! > "$$TEST_LINK"/pid_of_guard; \ |
|
167 ) |
|
168 |
|
169 COMPONENT_POST_TEST_ACTION = ( \ |
|
170 ( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \ |
|
171 ( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid_of_guard`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \ |
|
172 ( $(SET_X) if [ -e "$(MYSQL_TEST_DATADIR)/test_link" ]; then rm -f `cat "$(MYSQL_TEST_DATADIR)/test_link"`; fi ) $(SILENT); \ |
|
173 ) |
|
174 |
|
175 $(LICENSE): $(LICENSE).template |
|
176 $(PERL) -pe 's/COMPONENT_VERSION/$(COMPONENT_VERSION)/g' "$<" > "$@" |
|
177 |
|
178 REQUIRED_PACKAGES += database/mysql-56/library |
|
179 REQUIRED_PACKAGES += library/perl-5/database |
|
180 REQUIRED_PACKAGES += system/library/c++-runtime |