aboutsummaryrefslogtreecommitdiff
path: root/tests/integration/testscript
blob: 2dcd84928c408776d6306598e9df956882cbcf5a (plain)
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
# file      : tests/integration/testscript
# license   : MIT; see accompanying LICENSE file

# NOTE: to see the worker execution progress run the test with the
# --no-diag-buffer option.

#\
# Requirement:
#
# 1. tftpd-hpa installed (assumed in /usr/sbin/in.tftpd)
#
# 2. b, bpkg, curl executables in PATH.
#
# TFTP server (tftpd-hpa) setup: from the test out_base, run (sudo is required
# for --secure/chroot):
#

sudo /usr/sbin/in.tftpd \
  --foreground \
  --address 127.0.0.1:55123 \
  --user "$(whoami)" \
  --permissive \
  --create \
  --secure \
  --map-file tftp-map \
  "$(pwd)"

#\

machine = linux-gcc
target = x86_64-linux-gnu
environment =
c   = gcc
cxx = g++

# Where we get the task and what we do with the result can be configured
# independently:
#
# - We can poll a controller for a task by specifying its URL or we can
#   read a task manifest from a file (--fake-request).
#
# - We can send the result back to the controller or we can dump the result
#   to stdout (--dump-result).
#

#\
wait = 5 # Seconds.
controller = https://stage.build2.org/?build-task
#\

wait = 1 # Seconds.
controller = --fake-request ../task --dump-result

# Note that we also need to make sure that the installed package libraries are
# properly imported when configuring and running tests, and that the installed
# executables are runnable.
#
config = "bpkg.create:config.install.root=\"'$~/install'\" \
bpkg.configure.fetch:--fetch-timeout=60 \
bpkg.global.configure.build:--fetch-timeout=60 \
bpkg.create:config.bin.rpath=\"'$~/install/lib'\" \
config.cc.coptions=-Wall \
b.test-installed.configure:\"config.cc.loptions=-L'$~/install/lib'\" \
bpkg.test-separate-installed.create:\"config.cc.loptions=-L'$~/install/lib'\""

pkg = libhello
ver = 1.0.0+12
#rep_url = "https://git.build2.org/hello/libhello.git#1.0"
#rep_type = git
rep_url = https://stage.build2.org/1
rep_type = pkg
rfp = yes
#host='host: true'
#dependency_checksum = 'dependency-checksum: e6f10587696020674c260669f4e7000a0139df72467bff9770aea2f2b8b57ba0'

#package_config = 'package-config: { config.libhello.extras=true }+ libhello'
#package_config = 'package-config: +bbot.install.ldconfig:'
#package_config = 'package-config: -bpkg.install:'
#\
package_config = "package-config:
\\
+bpkg.bindist.archive:--archive-build-meta=
bpkg.bindist.archive:config.install.relocatable=true

+bbot.bindist.upload:

bbot.sys-install.tar.extract:--directory=$~
bbot.sys-install.tar.extract:--strip-components=1

b.test-installed.configure:config.cc.loptions='-L$~/usr/local/lib'
bpkg.test-separate-installed.create:config.cc.loptions='-L$~/usr/local/lib'

bpkg.create:config.bin.rpath=[null]
\\"
config = "$config bpkg.create:config.install.root=\"'$~/usr/local'\""
+export LD_LIBRARY_PATH="$~/usr/local/lib:$getenv('LD_LIBRARY_PATH')"
#\
#\
sys_install_dir = [dir_path] $~/sys-install/
package_config = "package-config:
\\
+bpkg.bindist.archive:--archive-build-meta=
bpkg.bindist.archive:config.install.relocatable=true

+bbot.bindist.upload:

b.test-installed.configure:config.cc.loptions='-L$sys_install_dir/lib'
bpkg.test-separate-installed.create:config.cc.loptions='-L$sys_install_dir/lib'

bpkg.create:config.bin.rpath=[null]
\\"
config = "$config bpkg.create:config.install.root=\"'$~/usr/local'\" \
bbot.sys-install:config.install.root=\"'$sys_install_dir'\" \
bbot.sys-install.tar.extract:--directory=\"$sys_install_dir\" \
bbot.sys-install.tar.extract:--strip-components=3"
+export LD_LIBRARY_PATH="$sys_install_dir/lib:$getenv('LD_LIBRARY_PATH')"
#\
#\
package_config = 'package-config:
\
+bpkg.bindist.fedora:
+bbot.bindist.upload:
bpkg.create:config.bin.rpath=[null]
\'
#\
#\
package_config = 'package-config:\
bpkg.configure.fetch:--fetch-timeout=120 -bpkg.install:
config.libhello.develop=true
sys:libuuid-c++ --sys-install --sys-no-stub --sys-yes
\
'
#\

#\
pkg = hello
ver = 1.0.0+8
rep_url = "https://git.build2.org/hello/hello.git"
rep_type = git
rfp = yes
#\

#\
pkg = libstudxml
ver = 1.1.0-b.10
rep_url = https://stage.build2.org/1
rep_type = pkg
rfp = yes
#\

# To make sure that the test-installed phase succeeds use the build2 driver
# installed into a writable directory, for example, ~/install/bin.
#
#\
pkg = libbuild2-hello
ver = 0.2.0
rep_url = "https://github.com/build2/libbuild2-hello.git#master"
rep_type = git
#rep_url = https://stage.build2.org/1
#rep_type = pkg
rfp = yes
tests = "tests: * libbuild2-hello-tests == $ver"
host = 'host: true'
#\
#package_config = 'package-config: -bpkg.install:'
#\
package_config = 'package-config:
\
+bpkg.bindist.fedora:
bpkg.module.create:config.bin.rpath=[null]
\'
#\

# Use the build2 driver installed into ~/install/bin (see above).
#
#\
pkg = libbuild2-kconfig
ver = 0.3.0
rep_url = "https://github.com/build2/libbuild2-kconfig.git#master"
rep_type = git
#ver = 0.1.0-a.0.20200910053253.a71aa3f3938b
#rep_url = https://stage.build2.org/1
#rep_type = pkg
rfp = yes
requires = 'requires: bootstrap'
tests = "tests: * libbuild2-kconfig-tests == $ver
examples: * kconfig-hello == $ver"
host = 'host: true'
#\
#\
package_config = 'package-config:
\
{ config.libbuild2_kconfig-tests.extras=true }+ libbuild2-kconfig-tests
\'
#\
#package_config = 'package-config: config.libbuild2_kconfig.develop=true'
#package_config = 'package-config: -bpkg.install:'
#\
package_config = "package-config:
\\
+bpkg.bindist.archive:--archive-build-meta=
bbot.sys-install.tar.extract:--directory=$~
bbot.sys-install.tar.extract:--strip-components=1

+bbot.bindist.upload:

bpkg.create:config.bin.rpath=[null]
\\"
config = "$config bpkg.create:config.install.root=\"'$~/usr/local'\""
+export LD_LIBRARY_PATH="$~/usr/local/lib:$getenv('LD_LIBRARY_PATH')"
#\
#\
package_config = 'package-config:
\
+bpkg.bindist.fedora:
bpkg.module.create:config.bin.rpath=[null]
\'
#\
#dependency_checksum = 'dependency-checksum: 72ae02bed9a05aaf022147297a99b84d63b712e15d05cc073551da39003e87e8'

# Use the build2 driver installed into ~/install/bin (see above).
#
#\
pkg = libbuild2-autoconf
ver = 0.2.0
rep_url = "https://github.com/build2/libbuild2-autoconf.git#master"
rep_type = git
rfp = yes
tests = "tests: * libbuild2-autoconf-tests == $ver"
host = 'host: true'
#\

#\
pkg = curl
ver = 7.84.0
rep_url = https://pkg.cppget.org/1/stable
rep_type = pkg
rfp = yes
#\

#\
pkg = bpkg
ver = 0.16.0-a.0.20230201123204.d956e69e8b55
rep_url = https://stage.build2.org/1
rep_type = pkg
rfp = yes
package_config = 'package-config:
\
config.bpkg.tests.remote=true
?libodb-sqlite +{ config.libodb_sqlite.develop=true }
?cli +{ config.cli.develop=true }
?sys:libsqlite3 --sys-install
\'
#\

#\
pkg = cli
ver = 1.2.0
rep_url = "https://git.codesynthesis.com/cli/cli.git#master"
rep_type = git
#rep_url = https://stage.build2.org/1
#rep_type = pkg
rfp = yes
requires='requires: host'
tests="tests: * cli-tests == $ver
examples: * cli-examples == $ver"
host='host: true'
#\
#\
package_config = "package-config:
\\
{ config.cli.extras=true }+ cli
{ config.cli_tests.extras=true }+ cli-tests
{ config.cli_examples.extras=true }+ cli-examples
\\"
#\
#\
package_config = "package-config:
\\
+bpkg.bindist.archive:--archive-build-meta=
bbot.sys-install.tar.extract:--directory=$~
bbot.sys-install.tar.extract:--strip-components=1

+bbot.bindist.upload:

bpkg.create:config.bin.rpath=[null]
\\"
config = "$config bpkg.create:config.install.root=\"'$~/usr/local'\""
+export LD_LIBRARY_PATH="$~/usr/local/lib:$getenv('LD_LIBRARY_PATH')"
#\
#\
package_config = 'package-config:
\
+bpkg.bindist.fedora:

+bbot.bindist.upload:

bpkg.create:config.bin.rpath=[null]
\'
#\
#package_config = 'package-config: ?libcutl +{ config.libcutl.develop=true }'
#package_config = 'package-config: -bpkg.install:'

#\
pkg = libxsd
ver = 4.2.0-b.3.20220224113525.516981000564
rep_url = "https://git.codesynthesis.com/xsd/xsd.git#master"
rep_type = git
#rep_url = https://stage.build2.org/1
#rep_type = pkg
rfp = yes
tests="tests: libxsd-tests == $ver"
#\

#\
pkg = xsd
ver = 4.2.0-b.4.20230320140030.aafc60b2e901
rep_url = "https://git.codesynthesis.com/xsd/xsd.git#master"
rep_type = git
#rep_url = https://queue.stage.build2.org/1
#rep_type = pkg
rfp = yes
requires='requires: host'
tests="tests: * xsd-tests == $ver
examples: * xsd-examples == $ver"
host='host: true'
#\
#\
package_config = "package-config:
\\
?sys:libxerces-c --sys-install --sys-yes
{ config.xsd_tests.extras=true }+ xsd-tests
+bpkg.bindist.archive:--archive-build-meta=
bbot.sys-install.tar.extract:--directory=$~
bbot.sys-install.tar.extract:--strip-components=1
bpkg.create:config.bin.rpath=[null]
\\"
config = "$config bpkg.create:config.install.root=\"'$~/usr/local'\""
+export LD_LIBRARY_PATH="$~/usr/local/lib:$getenv('LD_LIBRARY_PATH')"
#\
#\
package_config = 'package-config:
\
?sys:libxerces-c --sys-install --sys-yes
+bpkg.bindist.fedora:
bpkg.create:config.bin.rpath=[null]
\'
#\
#package_config = 'package-config:
# \
#?libxerces-c +{ config.libxerces_c.network=true }
#?libcurl/7.76.0
#?sys:libz/*
# \'

#dependency_checksum = 'dependency-checksum: 40a0ad4546d836a3afc83a9e7da22f2b5d224af4e62996d88f7103eaee23e9e1'

#\
pkg = libxerces-c
ver = 3.2.4
rep_url = https://pkg.cppget.org/1/stable
rep_type = pkg
rfp = yes
package_config = 'package-config:
\
config.libxerces_c.network=true
"?libcurl ~7.76.0"
sys:libz/*
-bpkg.update:
\'
#\

#\
pkg = odb
ver = 2.5.0-b.22.20220629083600.4a9af07ee566
rep_url = "https://git.codesynthesis.com/odb/odb.git#master"
rep_type = git
rfp = yes
requires='requires: host'
host='host: true'
#\

#\
pkg = libcmark-gfm-extensions
ver = 0.29.0-a.4
rep_url = https://stage.build2.org/1
rep_type = pkg
rfp = yes
host='host: true'
#\

#\
pkg = non-existing
ver = 0.1.0
rep_url = https://stage.build2.org/1
rep_type = pkg
rfp = yes
#\

#\
pkg = fmt
ver = 8.1.1
rep_url = "https://github.com/build2-packaging/fmt.git"
#rep_url = "git+file:/tmp/fmt#master"
rep_type = git
rfp = yes
#\

#\
pkg = libodb-sqlite
ver = 2.5.0-b.26.20240131175206.1c7f67f47770
rep_url = "https://git.codesynthesis.com/var/scm/odb/odb.git"
rep_type = git
rfp = yes
tests="tests: odb-tests == $ver"' ? (!$defined(config.odb_tests.database)) config.odb_tests.database=sqlite'
#\
#\
package_config = 'package-config:
\
{ config.odb_tests.multi_database=true }+ odb-tests
\'
#\

#\
pkg = libodb-pgsql
ver = 2.5.0-b.26.20240131175206.1c7f67f47770
rep_url = "https://git.codesynthesis.com/var/scm/odb/odb.git"
rep_type = git
rfp = yes
tests="tests: odb-tests == $ver"' ? (!$defined(config.odb_tests.database)) config.odb_tests.database=pgsql'
#\
#\
package_config = 'package-config:
\
{ config.odb_tests.database="sqlite pgsql" }+ odb-tests
\'
#\

#\
pkg = odb-tests
ver = 2.5.0-b.26.20240131175206.1c7f67f47770
rep_url = "https://git.codesynthesis.com/var/scm/odb/odb.git"
rep_type = git
rfp = yes
#\
#\
package_config = 'package-config:
\
config.odb_tests.database="sqlite pgsql"
\'
#\

#\
pkg = libodb-oracle
ver = 2.5.0-b.26.20240201133448.3fa01c83a095
rep_url = "https://git.codesynthesis.com/var/scm/odb/odb.git"
rep_type = git
rfp = yes
package_config = 'package-config:
\
config.cc.poptions+=-I/usr/include/oracle/12.2/client64 config.cc.loptions+=-L/usr/lib/oracle/12.2/client64/lib
\'
#\

#\
pkg = libodb-qt
ver = 2.5.0-b.26.20240201180613.633ad7ccad39
rep_url = "https://git.codesynthesis.com/var/scm/odb/odb.git"
rep_type = git
rfp = yes
#\

#interactive="interactive: b.test-installed.configure"
#interactive="interactive: warning"
#\
aux_env = 'auxiliary-environment:
\
# x86_64-linux_debian_12-postgresql_15
#
DATABASE_HOST=10.0.213.126
DATABASE_PORT=5432
DATABASE_USER=test
DATABASE_NAME=test
\
'
#\

+cat <<"EOI" >=task
  : 1
  name: $pkg
  version: $ver
  repository-url: $rep_url
  repository-type: $rep_type
  trust: $rfp
  $requires
  $tests
  machine: $machine
  target: $target
  $aux_env
  target-config: $config
  $package_config
  $interactive
  $host
  worker-checksum: 1
  $dependency_checksum
  EOI

+if ("$environment" != "")
  echo "environment: $environment" >+task
end

#
#
tftp = 127.0.0.1:55123

a = $0
+sed -e 's/-agent$/-worker/' <"$0" | set w

: agent
:
{
  cat <<"EOI" >=machine-header;
    : 1
    id: $machine-1.0
    name: $machine
    summary: The $machine fake machine
    EOI
  $a --verbose 3 --tftp $~ --fake-machine machine-header $controller \
     &build/*** >| 2>|
}

: worker
:
{
  env = ("$environment" != "" ? "$environment" : "default")

  cat <<"EOI" >=$env;
  #!/bin/sh

  t="\$1"
  shift

  exec "\$@" cc config.c=$c config.cxx=$cxx
  EOI
  chmod ugo+x $env;
  sleep $wait;
  $w --verbose 3 --startup --tftp-host $tftp --environments $~ \
    &?build/*** &?build-host/*** &?build-module/*** &?build-install/*** \
    &?build-installed/*** &?build-installed-bpkg/*** \
    &?build-installed-bpkg-module/*** &?build-installed-bpkg-host/*** \
    &?dist/*** &?redist/*** &?bindist/*** \
    &?dist-install/*** &?redist-install/*** \
    &?dist-installed/*** &?redist-installed/*** \
    &?../usr/*** &?upload/*** &?upload.tar \
    &?../sys-install/*** \
    &task.manifest <| 2>|;

  sudo rm -rf ../sys-install/
}