diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-19 08:02:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-19 08:02:53 +0200 |
commit | efa53d6ad8797310b10d299408c2e3fa33978e27 (patch) | |
tree | 6256e22e53b1ad9f8555e228d0ef89bd024ff292 /tests | |
parent | 9b5170a723c9c78103fbd66c5c3b2b32a9af6702 (diff) |
Add --fake-machine and machine-less agent/worker test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/agent/testscript | 29 | ||||
-rw-r--r-- | tests/integration/buildfile | 8 | ||||
-rw-r--r-- | tests/integration/testscript | 98 | ||||
-rw-r--r-- | tests/integration/tftp-map | 11 | ||||
-rw-r--r-- | tests/worker/build.test | 12 |
5 files changed, 124 insertions, 34 deletions
diff --git a/tests/agent/testscript b/tests/agent/testscript index e864bf2..6e9d319 100644 --- a/tests/agent/testscript +++ b/tests/agent/testscript @@ -137,7 +137,7 @@ rm = $src_base/btrfs-rmdir /build/machines machine: windows-msvc EOI %trace: enumerate_machines:\\.*%* - error: task from $u for unknown machine windows-msvc + error: task from http://example.org for unknown machine windows-msvc EOE : result @@ -159,30 +159,3 @@ rm = $src_base/btrfs-rmdir /build/machines -$rm } - -#\ -: bootstrap -: -{ - test.options += --dump-machines - - m = /build/machines/default/linux-gcc - u = https://example.org/?dummy - - +$cp - - ln -T -s linux-gcc-1.0 $m/linux-gcc-1 - - : bootstrap - : - $* $u >>EOO 2>>EOE #2>>~"%EOE%d" - : 1 - id: linux-gcc-1.0 - name: linux-gcc - summary: Linux with GCC - EOO - EOE - - #-$rm -} -#\ diff --git a/tests/integration/buildfile b/tests/integration/buildfile new file mode 100644 index 0000000..f054694 --- /dev/null +++ b/tests/integration/buildfile @@ -0,0 +1,8 @@ +# file : tests/integration/buildfile +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : TBC; see accompanying LICENSE file + +./: ../../bbot/exe{bbot-agent bbot-worker} test{testscript} file{tftp-map} +dir{./}: test = ../../bbot/exe{bbot-agent} + +include ../../bbot/ diff --git a/tests/integration/testscript b/tests/integration/testscript new file mode 100644 index 0000000..f43bf02 --- /dev/null +++ b/tests/integration/testscript @@ -0,0 +1,98 @@ +# file : tests/integration/testscript +# copyright : Copyright (c) 2014-2017 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 +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=5s +controller = https://stage.build2.org/?build-task +#\ + +wait=1s +controller = --fake-request ../task --dump-result + +pkg = hello +ver = 1.0.0 +rep = https://build2.org/pkg/1/stage/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 ++cat <<"EOI" >=task + : 1 + name: $pkg + version: $ver + repository: $rep + trust: $rfp + machine: $machine + EOI + +# +# +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 +: +{ + cat <<"EOI" >=default; + #!/bin/sh + + t="\$1" + shift + + exec "\$@" cc config.c=$c config.cxx=$cxx + EOI + chmod ugo+x default; + sleep $wait; + $w --verbose 3 --startup --tftp-host $tftp --environment \ + &$machine/*** &manifest $~ 2>| +} diff --git a/tests/integration/tftp-map b/tests/integration/tftp-map new file mode 100644 index 0000000..837794d --- /dev/null +++ b/tests/integration/tftp-map @@ -0,0 +1,11 @@ +# file : tests/integration/tftp-map +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : TBC; see accompanying LICENSE file + +# Test working directories relative to out_base: +# +# agent: test/agent/ +# worker: test/worker/ +# +Gr ^/?(.+)$ /test/agent/build/default/get/\1 +Pr ^/?(.+)$ /test/agent/build/default/put/\1 diff --git a/tests/worker/build.test b/tests/worker/build.test index adedccc..3be9150 100644 --- a/tests/worker/build.test +++ b/tests/worker/build.test @@ -27,8 +27,8 @@ cat <<"EOI" >=manifest; target: x86_64-linux-gnu config: config.cc.coptions=-O3 EOI -$* --verbose 3 --tftp-host "$tftp/$@" cc &build/*** 2>>"EOE"; - trace: build: bpkg -v create -d build --wipe config.cc.coptions=-O3 cc +$* --verbose 3 --tftp-host "$tftp/$@" cc &x86_64-linux-gnu/*** 2>>"EOE"; + trace: build: bpkg -v create -d x86_64-linux-gnu --wipe config.cc.coptions=-O3 cc trace: build: bpkg -v add $rep trace: build: bpkg -v fetch --trust $rfp --trust-no trace: build: bpkg -v build --configure-only --yes $pkg/$ver @@ -78,8 +78,8 @@ cat <<"EOI" >=manifest; machine: linux-gcc target: x86_64-linux-gnu EOI -$* --verbose 3 --tftp-host "$tftp/$@" cc &build/*** 2>>"EOE"; - trace: build: bpkg -v create -d build --wipe cc +$* --verbose 3 --tftp-host "$tftp/$@" cc &x86_64-linux-gnu/*** 2>>"EOE"; + trace: build: bpkg -v create -d x86_64-linux-gnu --wipe cc trace: build: bpkg -v add $rep trace: build: bpkg -v fetch --trust $rfp --trust-no trace: build: bpkg -v build --configure-only --yes bogus/1.2.3 @@ -109,8 +109,8 @@ cat <<"EOI" >=manifest; target: x86_64-linux-gnu config: config.cc.loptions=-lbogus EOI -$* --verbose 3 --tftp-host "$tftp/$@" cc &build/*** 2>>"EOE"; - trace: build: bpkg -v create -d build --wipe config.cc.loptions=-lbogus cc +$* --verbose 3 --tftp-host "$tftp/$@" cc &x86_64-linux-gnu/*** 2>>"EOE"; + trace: build: bpkg -v create -d x86_64-linux-gnu --wipe config.cc.loptions=-lbogus cc trace: build: bpkg -v add $rep trace: build: bpkg -v fetch --trust $rfp --trust-no trace: build: bpkg -v build --configure-only --yes $pkg/$ver |