aboutsummaryrefslogtreecommitdiff
path: root/tests/integration/testscript
blob: 5475b12f80c9ddcca1f66a4518b014b039c62d9d (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
# file      : tests/integration/testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license   : TBC; see accompanying LICENSE file

#\
# 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

pkg = libhello
ver = 1.0.0+4
#rep_url = https://build2.org/pkg/1/hello/stable
#rfp = FF:DF:7D:38:67:4E:C3:82:65:7E:EE:1F:D4:80:EC:56:C4:33:5B:65:3F:9B:29:9A:30:56:B9:77:B9:F2:01:94
rep_url = https://stage.build2.org/1
rep_type = pkg
rfp = yes

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

#\
pkg = hello
ver = 0.1.0-a.0.20191025174646.0150b7eb45af
rep_url = "https://github.com/karen-arutyunov/hello.git#master"
rep_type = git
rfp = yes
#\

#\
pkg = libbuild2-hello
ver = 0.1.0-a.0.20191106105744.1ad196b43c42
rep_url = "https://github.com/build2/libbuild2-hello.git#master"
rep_type = git
rfp = yes
#\

# 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 = "\"config.install.root='$~/install'\" \
bpkg:--fetch-timeout=60 \
b.test-installed.configure:\"config.cc.loptions=-L'$~/install/lib'\" \
b.test-installed.configure:\"config.bin.rpath='$~/install/lib'\" \
b.test-installed:--progress \
bpkg.test-installed.create:\"config.cc.loptions=-L'$~/install/lib'\" \
bpkg.test-installed.create:\"config.bin.rpath='$~/install/lib'\""

+cat <<"EOI" >=task
  : 1
  name: $pkg
  version: $ver
  repository-url: $rep_url
  repository-type: $rep_type
  trust: $rfp
  machine: $machine
  target: $target
  config: $config
  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-module/*** &build/*** &?build-installed/*** \
    &?build-installed-bpkg/*** &task.manifest 2>|
}