60 '-e "/chmod 644 \"mysql.bs\"/d"' \ |
60 '-e "/chmod 644 \"mysql.bs\"/d"' \ |
61 '-e "/Running Mkbootstrap/d"' |
61 '-e "/Running Mkbootstrap/d"' |
62 |
62 |
63 ASLR_MODE = $(ASLR_NOT_APPLICABLE) |
63 ASLR_MODE = $(ASLR_NOT_APPLICABLE) |
64 |
64 |
65 MYSQL_VERSION = 5.6 |
65 MYSQL_VERSION = 5.7 |
66 MYSQL_BINDIR = $(USRDIR)/mysql/$(MYSQL_VERSION)/bin |
66 MYSQL_BINDIR = $(USRDIR)/mysql/$(MYSQL_VERSION)/bin |
67 MYSQL_TEST_USER = root |
67 MYSQL_TEST_USER = root |
68 MYSQL_TEST_PASSWORD = new-password |
68 MYSQL_TEST_PASSWORD = new-password |
69 MYSQL_TEST_DATADIR = $(COMPONENT_TEST_BUILD_DIR)/test_datadir |
69 MYSQL_TEST_DATADIR = $(COMPONENT_TEST_BUILD_DIR)/test_datadir |
70 |
70 |
98 # daemon in 10 minutes no matter what. |
98 # daemon in 10 minutes no matter what. |
99 # c) the COMPONENT_POST_TEST_ACTION kills both the mysql daemon and the |
99 # c) the COMPONENT_POST_TEST_ACTION kills both the mysql daemon and the |
100 # background task |
100 # background task |
101 |
101 |
102 # If you want to keep mysqld running for your own testing purposes, delete all |
102 # If you want to keep mysqld running for your own testing purposes, delete all |
103 # the lines containing 'kill' in COMPONENT_PRE_TEST_ACTION and |
103 # the lines containing 'kill' in COMPONENT_PRE_TEST_ACTION and whole |
104 # COMPONENT_POST_TEST_ACTION. Then run "gmake test" once which will both run |
104 # COMPONENT_POST_TEST_ACTION. Then run "gmake test" once which will both run |
105 # the DB and configure the module to use it. After that you can "cd builds/..." |
105 # the DB and configure the module to use it. After that you can "cd builds/..." |
106 # and "gmake test" directly there. |
106 # and "gmake test" directly there. |
107 |
107 |
108 # Normally the noise from background jobs is sent to /dev/null so that it does |
108 # Normally the noise from background jobs is sent to /dev/null so that it does |
124 $(RM) -r "$(MYSQL_TEST_DATADIR)"; \ |
124 $(RM) -r "$(MYSQL_TEST_DATADIR)"; \ |
125 mkdir "$(MYSQL_TEST_DATADIR)"; \ |
125 mkdir "$(MYSQL_TEST_DATADIR)"; \ |
126 TEST_LINK=`mktemp -t dbd-mysql-test.XXXXXX`; \ |
126 TEST_LINK=`mktemp -t dbd-mysql-test.XXXXXX`; \ |
127 $(RM) "$$TEST_LINK"; \ |
127 $(RM) "$$TEST_LINK"; \ |
128 ln -s $(MYSQL_TEST_DATADIR) "$$TEST_LINK"; \ |
128 ln -s $(MYSQL_TEST_DATADIR) "$$TEST_LINK"; \ |
129 echo "$$TEST_LINK" > "$$TEST_LINK"/test_link; \ |
|
130 \ |
129 \ |
131 : "alter the tests to use the path we just created"; \ |
130 : "alter the tests to use the path we just created"; \ |
132 $(PERL) -pi -e "s,('testsocket' => ').*?',\$$1/$$TEST_LINK/socket'," t/mysql.mtest ;\ |
131 $(PERL) -pi -e "s,('testsocket' => ').*?',\$$1/$$TEST_LINK/socket'," t/mysql.mtest ;\ |
133 \ |
132 \ |
134 : "Initialize mysql DB"; \ |
133 : "Initialize mysql DB"; \ |
135 "$(MYSQL_BINDIR)/mysql_install_db" \ |
134 "$(MYSQL_BINDIR)/mysqld" \ |
136 --keep-my-cnf \ |
135 --initialize-insecure \ |
137 --datadir="$$TEST_LINK" \ |
136 --datadir="$$TEST_LINK" \ |
138 --basedir=/usr/mysql/$(MYSQL_VERSION) $(SILENT) ; \ |
137 --basedir=/usr/mysql/$(MYSQL_VERSION) $(SILENT) ; \ |
|
138 \ |
|
139 echo "$$TEST_LINK" > "$$TEST_LINK"/test_link; \ |
139 \ |
140 \ |
140 : "Run the daemon in background. --gdb makes it possible to terminate mysqld via Ctrl+C"; \ |
141 : "Run the daemon in background. --gdb makes it possible to terminate mysqld via Ctrl+C"; \ |
141 "$(MYSQL_BINDIR)/mysqld" \ |
142 "$(MYSQL_BINDIR)/mysqld" \ |
142 $(MYSQLD_VERBOSE) \ |
143 $(MYSQLD_VERBOSE) \ |
143 --skip-networking \ |
144 --skip-networking \ |
|
145 -u "$(MYSQL_TEST_USER)"\ |
144 --datadir="$$TEST_LINK" \ |
146 --datadir="$$TEST_LINK" \ |
145 --socket="$$TEST_LINK"/socket \ |
147 --socket="$$TEST_LINK"/socket \ |
146 --pid-file="$$TEST_LINK"/pid \ |
148 --pid-file="$$TEST_LINK"/pid \ |
147 --gdb \ |
149 --gdb \ |
148 --log-warnings=0 \ |
|
149 $(SILENT) & \ |
150 $(SILENT) & \ |
150 : "Now wait for the database to be online"; \ |
151 : "Now wait for the database to be online"; \ |
151 sleep 10; \ |
152 sleep 10; \ |
152 if [ ! -e "$$TEST_LINK/socket" ]; then \ |
153 if [ ! -e "$$TEST_LINK/socket" ]; then \ |
153 : "We were not able to bring up the database?"; \ |
154 : "We were not able to bring up the database?"; \ |
161 "$(MYSQL_BINDIR)/mysqladmin" \ |
162 "$(MYSQL_BINDIR)/mysqladmin" \ |
162 --socket "$$TEST_LINK"/socket \ |
163 --socket "$$TEST_LINK"/socket \ |
163 -u "$(MYSQL_TEST_USER)" \ |
164 -u "$(MYSQL_TEST_USER)" \ |
164 password "$(MYSQL_TEST_PASSWORD)" ; \ |
165 password "$(MYSQL_TEST_PASSWORD)" ; \ |
165 \ |
166 \ |
|
167 : "Create a database"; \ |
|
168 "$(MYSQL_BINDIR)/mysqladmin" \ |
|
169 --socket "$$TEST_LINK"/socket \ |
|
170 -u "$(MYSQL_TEST_USER)" \ |
|
171 --password="$(MYSQL_TEST_PASSWORD)" \ |
|
172 create test; \ |
|
173 \ |
166 : "Run job which will kill mysqld in 10 minutes"; \ |
174 : "Run job which will kill mysqld in 10 minutes"; \ |
167 ( $(SET_X) PID=`cat "$$TEST_LINK"/pid`; sleep 600; ps -p $$PID && kill $$PID || : ) $(SILENT) & \ |
175 ( $(SET_X) PID=`cat "$$TEST_LINK"/pid`; sleep 600; ps -p $$PID && kill $$PID || : ) $(SILENT) & \ |
168 echo $$! > "$$TEST_LINK"/pid_of_guard; \ |
176 echo $$! > "$$TEST_LINK"/pid_of_guard; \ |
169 ) |
177 ) |
170 |
178 |
175 ) |
183 ) |
176 |
184 |
177 $(LICENSE): $(LICENSE).template |
185 $(LICENSE): $(LICENSE).template |
178 $(PERL) -pe 's/COMPONENT_VERSION/$(COMPONENT_VERSION)/g' "$<" > "$@" |
186 $(PERL) -pe 's/COMPONENT_VERSION/$(COMPONENT_VERSION)/g' "$<" > "$@" |
179 |
187 |
180 REQUIRED_PACKAGES += database/mysql-56/library |
188 REQUIRED_PACKAGES += database/mysql-57/library |
181 REQUIRED_PACKAGES += library/perl-5/database |
189 REQUIRED_PACKAGES += library/perl-5/database |
182 REQUIRED_PACKAGES += system/library/c++-runtime |
190 REQUIRED_PACKAGES += system/library/c++-runtime |