forked from zabbix/zabbix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
602 lines (562 loc) · 23.9 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
<?xml version="1.0" encoding="UTF-8"?>
<project name="Zabbix" default="build" basedir=".">
<target name="init-common">
<condition property="phpunit_filter" value=" --filter='${PHPUNIT_FILTER}'" else="">
<and>
<isset property="PHPUNIT_FILTER" />
<length string="${PHPUNIT_FILTER}" when="greater" length="0"/>
</and>
</condition>
<!-- Cleanup from the previous run -->
<delete dir="build/logs" failonerror="off"/>
<mkdir dir="build/logs"/>
<mkdir dir="runtime"/>
</target>
<target name="create-frontend-configs">
<property name="dbtype" value="${DBTYPE}"/>
<property name="dbhost" value="${DBHOST}"/>
<property name="dbport" value="${DBPORT}"/>
<property name="dbname" value="${DBNAME}"/>
<property name="dbuser" value="${DBUSER}"/>
<property name="dbpassword" value="${DBPASSWORD}"/>
<property name="phpunit_error_log" value="${PHPUNIT_ERROR_LOG}"/>
<property name="phpunit_port_prefix" value="${PHPUNIT_PORT_PREFIX}"/>
<!-- Create PHP config file -->
<copy overwrite="true" file="ui/tests/templates/zabbix.conf.php" tofile="ui/conf/zabbix.conf.php"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBTYPE}" value="${dbtype}"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBHOST}" value="${dbhost}"/>
<replace file="ui/conf/zabbix.conf.php" token="'{DBPORT}'" value="${dbport}"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBNAME}" value="${dbname}"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBUSER}" value="${dbuser}"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBPASSWORD}" value="${dbpassword}"/>
<replace file="ui/conf/zabbix.conf.php" token="{PHPUNIT_ERROR_LOG}" value="${phpunit_error_log}"/>
<replace file="ui/conf/zabbix.conf.php" token="{SERVER_PORT}" value="${phpunit_port_prefix}51"/> <!-- 51 - CIntegrationTest::SERVER_PORT_SUFFIX -->
<chmod file="ui/conf/zabbix.conf.php" perm="go+rw"/>
</target>
<target name="create-configs" depends="init-common,create-frontend-configs">
<property name="url" value="${URL}"/>
<property name="screenshot_dir" value="${SCREENSHOT_DIR}"/>
<property name="screenshot_url" value="${SCREENSHOT_URL}"/>
<property name="phpunit_port_prefix" value="${PHPUNIT_PORT_PREFIX}"/>
<property name="screenshot_references_dir" value="${SCREENSHOT_REFERENCES_DIR}"/>
<condition property="phpunit_driver_address" value="${PHPUNIT_DRIVER_ADDRESS}" else="localhost">
<and>
<isset property="PHPUNIT_DRIVER_ADDRESS" />
<length string="${PHPUNIT_DRIVER_ADDRESS}" when="greater" length="0"/>
</and>
</condition>
<property environment="env"/>
<property name="phpunit_browser_log_dir" value="${PHPUNIT_BROWSER_LOG_DIR}"/>
<!-- Create bootstrap.php -->
<copy overwrite="true" file="ui/tests/bootstrap.php.template" tofile="ui/tests/bootstrap.php"/>
<replace file="ui/tests/bootstrap.php" token="{URL}" value="${url}"/>
<replace file="ui/tests/bootstrap.php" token="{BASEDIR}" value="${basedir}"/>
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_DIR}" value="${screenshot_dir}"/>
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_URL}" value="${screenshot_url}"/>
<replace file="ui/tests/bootstrap.php" token="{BINARY_DIR}" value="${basedir}/sbin/"/>
<replace file="ui/tests/bootstrap.php" token="{CONFIG_SOURCE_DIR}" value="${basedir}/conf/"/>
<replace file="ui/tests/bootstrap.php" token="{CONFIG_DIR}" value="${basedir}/etc/"/>
<replace file="ui/tests/bootstrap.php" token="{COMPONENT_DIR}" value="${basedir}/runtime/"/>
<replace file="ui/tests/bootstrap.php" token="{PORT_PREFIX}" value="${phpunit_port_prefix}"/>
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_REFERENCES_DIR}" value="${screenshot_references_dir}"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_DRIVER_ADDRESS}" value="${phpunit_driver_address}"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_DATA_SOURCES_DIR}" value="${basedir}/ui/tests/selenium/data/sources/"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_BROWSER_LOG_DIR}" value="${phpunit_browser_log_dir}"/>
</target>
<target name="show-browser-info">
<exec executable="php" failonerror="on">
<arg line="ui/tests/browser.php"/>
</exec>
</target>
<target name="create-saml-configs">
<property name="phpunit_simplesaml_baseurl" value="${PHPUNIT_SIMPLESAML_BASEURL}"/>
<property name="phpunit_sp_entity_id" value="${PHPUNIT_SP_ENTITY_ID}"/>
<property name="url" value="${URL}"/>
<!-- SAML settings -->
<replace file="ui/tests/bootstrap.php" token="'PHPUNIT_SAML_TESTS_ENABLED', false" value="'PHPUNIT_SAML_TESTS_ENABLED', true"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_IDP_ENTITY_ID}" value="${phpunit_simplesaml_baseurl}/saml2/idp/metadata.php"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SSO_SERVICE_URL}" value="${phpunit_simplesaml_baseurl}/saml2/idp/SSOService.php"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SLO_SERVICE_URL}" value="${phpunit_simplesaml_baseurl}/saml2/idp/SingleLogoutService.php"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SP_ENTITY_ID}" value="${phpunit_sp_entity_id}"/>
<!-- Download SAML X509 certificates -->
<get src="${phpunit_simplesaml_baseurl}/module.php/saml/idp/certs.php/idp.crt" dest="ui/conf/certs"/>
<copy overwrite="true" file="${SIMPLESAMLPHP_CFG_FILE}.template" tofile="${SIMPLESAMLPHP_CFG_FILE}"/>
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{ENTITY_ID}" value="${phpunit_sp_entity_id}"/>
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{ASSERTION_CONSUMER_SERVICE}" value="${url}index_sso.php?acs"/>
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{SINGLE_LOGOUT_SERVICE}" value="${url}index_sso.php?sls"/>
<chmod file="${SIMPLESAMLPHP_CFG_FILE}" perm="go+r"/>
</target>
<target name="create-ldap-configs">
<property name="phpunit_ldap_host" value="${PHPUNIT_LDAP_HOST}"/>
<property name="phpunit_ldap_bind_password" value="${PHPUNIT_LDAP_BIND_PASSWORD}"/>
<property name="phpunit_ldap_username" value="${PHPUNIT_LDAP_USERNAME}"/>
<property name="phpunit_ldap_user_password" value="${PHPUNIT_LDAP_USER_PASSWORD}"/>
<!-- LDAP settings -->
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_LDAP_HOST}" value="${phpunit_ldap_host}"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_LDAP_BIND_PASSWORD}" value="${phpunit_ldap_bind_password}"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_LDAP_USERNAME}" value="${phpunit_ldap_username}"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_LDAP_USER_PASSWORD}" value="${phpunit_ldap_user_password}"/>
</target>
<target name="init-integration">
<exec executable="go" failonerror="on">
<arg line="clean -cache"/>
</exec>
<!-- Copy agent2 configuration file -->
<copy overwrite="true" file="src/go/conf/zabbix_agent2.conf" tofile="conf/zabbix_agent2.conf"/>
</target>
<target name="init-frontend-modules">
<!-- Copy modules directory for selenium tests -->
<copy todir="ui/modules" overwrite="true">
<fileset dir="ui/tests/selenium/modules"/>
</copy>
</target>
<target name="make-dbschema">
<!-- Create database schema -->
<exec executable="./bootstrap.sh" failonerror="on"/>
<exec executable="./configure" failonerror="on">
<arg line="--quiet"/>
</exec>
<exec executable="make" failonerror="on">
<arg line="-j4"/>
<arg line="-s"/>
<arg line="dbschema"/>
</exec>
</target>
<target name="make-gettext">
<!-- Build translation strings -->
<exec executable="make" failonerror="on">
<arg line="-j4"/>
<arg line="-s"/>
<arg line="gettext"/>
</exec>
</target>
<target name="make-binary-agent-3.0">
<exec executable="git" outputproperty="git.initial_rev" failonerror="on">
<arg value="rev-parse"/>
<arg value="--verify"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" failonerror="on">
<arg line="checkout"/>
<arg line="df9ee823715d4caccf63f402a126d2f039b31057"/>
</exec>
<exec executable="./bootstrap.sh" failonerror="on"/>
<exec executable="./configure" failonerror="on">
<arg line="--quiet"/>
<arg line="--enable-agent"/>
<arg line="--prefix=${basedir}"/>
</exec>
<exec executable="make" failonerror="on">
<arg line="-j4"/>
<arg line="-s"/>
<arg line="install"/>
</exec>
<move file="${basedir}/conf/zabbix_agentd.conf" tofile="${basedir}/conf/zabbix_agentd_3.0.conf"/>
<move file="${basedir}/sbin/zabbix_agentd" tofile="${basedir}/sbin/zabbix_agentd_3.0"/>
<exec executable="git" failonerror="on">
<arg line="checkout"/>
<arg line="${git.initial_rev}"/>
</exec>
</target>
<target name="make-binaries-postgresql">
<!-- Binaries for integration tests -->
<exec executable="./bootstrap.sh" failonerror="on"/>
<exec executable="./configure" failonerror="on">
<arg line="--quiet"/>
<arg line="--enable-server"/>
<arg line="--enable-proxy"/>
<arg line="--enable-agent"/>
<arg line="--enable-agent2"/>
<arg line="--with-postgresql"/>
<arg line="--prefix=${basedir}"/>
<arg line="--with-libcurl"/>
<arg line="--with-stacksize=128"/>
<arg line="--with-openssl"/>
<arg line="--with-net-snmp"/>
<arg line="--with-ssh2"/>
</exec>
<exec executable="make" failonerror="on">
<arg line="-j4"/>
<arg line="-s"/>
<arg line="dbschema"/>
</exec>
<exec executable="make" failonerror="on">
<arg line="-j4"/>
<arg line="-s"/>
<arg line="install"/>
</exec>
</target>
<target name="create-db-postgresql" depends="drop-db-postgresql">
<!-- Create PostgreSQL database -->
<exec executable="psql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="-c 'create database ${dbname} ENCODING = UTF8 TEMPLATE = template0'"/>
</exec>
<exec executable="psql" input="database/postgresql/schema.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="-1"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}"/>
</exec>
<exec executable="psql" input="database/postgresql/images.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="-1"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}"/>
</exec>
<exec executable="psql" input="database/postgresql/data.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}"/>
</exec>
<exec executable="psql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}"/>
<arg line="-c 'VACUUM ANALYZE'"/>
</exec>
</target>
<target name="drop-db-postgresql">
<!-- Drop PostgreSQL database -->
<exec executable="psql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="-c 'drop database if exists ${dbname}'"/>
</exec>
</target>
<target name="create-db-tsdb" depends="create-db-postgresql">
<!-- Create PostgreSQL database with TimescaleDB extension-->
<exec executable="psql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-d '${dbname}'"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="-c 'create extension if not exists timescaledb cascade;'"/>
</exec>
<exec executable="psql" input="database/postgresql/timescaledb/schema.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}"/>
</exec>
</target>
<target name="init-proxy-postgresql" depends="">
<!-- Create PostgreSQL database -->
<exec executable="psql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="-c 'drop database if exists ${dbname}_proxy'"/>
</exec>
<exec executable="psql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="-c 'drop database if exists ${dbname}_proxy_ha1'"/>
</exec>
<exec executable="psql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="-c 'create database ${dbname}_proxy ENCODING = UTF8 TEMPLATE = template0'"/>
</exec>
<exec executable="psql" input="database/postgresql/schema.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="-1"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}_proxy"/>
</exec>
<exec executable="psql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="-c 'create database ${dbname}_proxy_ha1 ENCODING = UTF8 TEMPLATE = template0'"/>
</exec>
<exec executable="psql" input="database/postgresql/schema.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="-1"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}_proxy_ha1"/>
</exec>
</target>
<target name="init-frontend-postgresql" depends="create-configs,create-saml-configs,create-ldap-configs,make-dbschema,make-gettext,create-db-postgresql,init-frontend-modules">
<exec executable="psql" input="ui/tests/selenium/data/data_test.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="-1"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}"/>
</exec>
</target>
<target name="init-api-postgresql" depends="create-configs,make-dbschema,create-db-postgresql">
<exec executable="psql" input="ui/tests/api_json/data/data_test.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="-1"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}"/>
</exec>
</target>
<target name="init-integration-postgresql" depends="create-configs,init-integration,make-binary-agent-3.0,make-binaries-postgresql,create-db-postgresql,init-proxy-postgresql">
<exec executable="psql" input="ui/tests/integration/data/data_test.sql" failonerror="on">
<env key="PGPASSWORD" value="${dbpassword}"/>
<arg line="-q"/>
<arg line="-h '${dbhost}'"/>
<arg line="-p '${dbport}'"/>
<arg line="-U '${dbuser}'"/>
<arg line="-1"/>
<arg line="--set ON_ERROR_STOP=1"/>
<arg line="${dbname}"/>
</exec>
</target>
<target name="init-integration-tsdb" depends="create-configs,init-integration,make-binary-agent-3.0,make-binaries-postgresql,create-db-tsdb,init-proxy-postgresql"/>
<target name="init-dast-postgresql" depends="create-frontend-configs,make-dbschema,create-db-postgresql"/>
<target name="make-binaries-mysql">
<!-- Binaries for integration tests -->
<exec executable="./bootstrap.sh" failonerror="on"/>
<exec executable="./configure" failonerror="on">
<arg line="--quiet"/>
<arg line="--enable-server"/>
<arg line="--enable-proxy"/>
<arg line="--enable-agent"/>
<arg line="--enable-agent2"/>
<arg line="--with-mysql"/>
<arg line="--prefix=${basedir}"/>
<arg line="--with-libcurl"/>
<arg line="--with-stacksize=128"/>
<arg line="--with-openssl"/>
<arg line="--with-net-snmp"/>
<arg line="--with-ssh2"/>
</exec>
<exec executable="make" failonerror="on">
<arg line="-j4"/>
<arg line="-s"/>
<arg line="dbschema"/>
</exec>
<exec executable="make" failonerror="on">
<arg line="-j4"/>
<arg line="-s"/>
<arg line="install"/>
</exec>
</target>
<target name="create-db-mysql" depends="drop-db-mysql">
<!-- Create MySQL database -->
<exec executable="mysql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="--execute='create database ${dbname} character set utf8mb4 collate utf8mb4_bin'"/>
</exec>
<exec executable="mysql" input="database/mysql/schema.sql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="${dbname}"/>
</exec>
<exec executable="mysql" input="database/mysql/images.sql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="${dbname}"/>
</exec>
<exec executable="mysql" input="database/mysql/data.sql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="${dbname}"/>
</exec>
</target>
<target name="drop-db-mysql">
<!-- Drop MySQL database -->
<exec executable="mysql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="--execute='drop database if exists ${dbname}'"/>
</exec>
</target>
<target name="init-proxy-mysql" depends="">
<!-- Create MySQL database -->
<exec executable="mysql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="--execute='drop database if exists ${dbname}_proxy'"/>
</exec>
<exec executable="mysql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="--execute='drop database if exists ${dbname}_proxy_ha1'"/>
</exec>
<exec executable="mysql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="--execute='create database ${dbname}_proxy character set utf8mb4 collate utf8mb4_bin'"/>
</exec>
<exec executable="mysql" input="database/mysql/schema.sql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="${dbname}_proxy"/>
</exec>
<exec executable="mysql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="--execute='create database ${dbname}_proxy_ha1 character set utf8mb4 collate utf8mb4_bin'"/>
</exec>
<exec executable="mysql" input="database/mysql/schema.sql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="${dbname}_proxy_ha1"/>
</exec>
</target>
<target name="init-frontend-mysql" depends="create-configs,create-saml-configs,create-ldap-configs,make-dbschema,make-gettext,create-db-mysql,init-frontend-modules">
<exec executable="mysql" input="ui/tests/selenium/data/data_test.sql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="${dbname}"/>
</exec>
</target>
<target name="init-api-mysql" depends="create-configs,make-dbschema,create-db-mysql">
<exec executable="mysql" input="ui/tests/api_json/data/data_test.sql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="${dbname}"/>
</exec>
</target>
<target name="init-integration-mysql" depends="create-configs,init-integration,make-binary-agent-3.0,make-binaries-mysql,create-db-mysql,init-proxy-mysql">
<exec executable="mysql" input="ui/tests/integration/data/data_test.sql" failonerror="on">
<env key="MYSQL_PWD" value="${dbpassword}"/>
<arg line="--host=${dbhost}"/>
<arg line="--port=${dbport}"/>
<arg line="--user=${dbuser}"/>
<arg line="${dbname}"/>
</exec>
</target>
<target name="init-dast-mysql" depends="create-frontend-configs,make-dbschema,create-db-mysql"/>
<target name="test-phpunit" depends="init-common">
<exec executable="phpunit" dir="ui/tests/unit" failonerror="off">
<arg line="--log-junit=${basedir}/build/logs/phpunit.xml"/>
<arg line="--do-not-cache-result"/>
<arg line="${phpunit_filter}"/>
<arg line="include/"/>
</exec>
</target>
<target name="test-frontend">
<exec executable="phpunit" dir="ui/tests" failonerror="off">
<arg line="--log-junit=${basedir}/build/logs/phpunit.xml"/>
<arg line="--bootstrap=bootstrap.php"/>
<arg line="--do-not-cache-result"/>
<arg line="--dont-report-useless-tests"/>
<arg line="${phpunit_filter}"/>
<arg line="frontend.php"/>
</exec>
</target>
<target name="test-api">
<exec executable="phpunit" dir="ui/tests" failonerror="off">
<arg line="--log-junit=${basedir}/build/logs/phpunit.xml"/>
<arg line="--bootstrap=bootstrap.php"/>
<arg line="--do-not-cache-result"/>
<arg line="${phpunit_filter}"/>
<arg line="api_json/ApiJsonTests.php"/>
</exec>
</target>
<target name="test-integration">
<exec executable="phpunit" dir="ui/tests" failonerror="off">
<arg line="--log-junit=${basedir}/build/logs/phpunit.xml"/>
<arg line="--bootstrap=bootstrap.php"/>
<arg line="--do-not-cache-result"/>
<arg line="--dont-report-useless-tests"/>
<arg line="${phpunit_filter}"/>
<arg line="integration/IntegrationTests.php"/>
</exec>
</target>
<target name="build-phpunit" depends="test-phpunit"/>
<target name="build-mysql" depends="init-frontend-mysql,show-browser-info,test-frontend"/>
<target name="build-postgresql" depends="init-frontend-postgresql,show-browser-info,test-frontend"/>
<target name="build-api-mysql" depends="init-api-mysql,test-api"/>
<target name="build-api-postgresql" depends="init-api-postgresql,test-api"/>
<target name="build-integration-mysql" depends="init-integration-mysql,test-integration"/>
<target name="build-integration-postgresql" depends="init-integration-postgresql,test-integration"/>
<target name="build-integration-tsdb" depends="init-integration-tsdb,test-integration"/>
<target name="build-dast-mysql" depends="init-dast-mysql"/>
<target name="build-dast-postgresql" depends="init-dast-postgresql"/>
<!-- Default target -->
<target name="build" depends="build-phpunit,build-mysql,build-postgresql,build-integration-mysql,build-integration-postgresql,build-integration-tsdb"/>
</project>