diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-21 16:30:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-21 16:30:36 +0200 |
commit | 04318680fb6c36aca0ec8029d94dab0e960ac69a (patch) | |
tree | 1d8d15b7e98c3f23458cbde77e0d9522f33a21f3 /tests | |
parent | aa7d4c3e66db326be2281ff9c21e8510565ae707 (diff) |
Add machine test, bootstrap/environment scripts
Diffstat (limited to 'tests')
-rw-r--r-- | tests/machine/buildfile | 8 | ||||
-rw-r--r-- | tests/machine/testscript | 83 |
2 files changed, 91 insertions, 0 deletions
diff --git a/tests/machine/buildfile b/tests/machine/buildfile new file mode 100644 index 0000000..a9f6ac3 --- /dev/null +++ b/tests/machine/buildfile @@ -0,0 +1,8 @@ +# file : tests/machine/buildfile +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : TBC; see accompanying LICENSE file + +./: ../../bbot/exe{bbot-agent} test{testscript} +dir{./}: test = ../../bbot/exe{bbot-agent} + +include ../../bbot/ diff --git a/tests/machine/testscript b/tests/machine/testscript new file mode 100644 index 0000000..238ca91 --- /dev/null +++ b/tests/machine/testscript @@ -0,0 +1,83 @@ +# file : tests/machine/testscript +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : TBC; see accompanying LICENSE file + +test.options = --cpu 8 --ram 10485760 --verbose 3 + +tftp = /build/tftp +machines = /btrfs/boris/machines # @@ TODO + +toolchain_url = https://stage.build2.org/0 +toolchain_trust = B8:52:AB:94:C5:FA:73:F3:53:D3:F1:EB:0F:E0:E4:06:32:3F:E2:46:22:FA:39:05:C8:FA:70:B7:21:E2:46:C5 + +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 + +# Download the toolchain. +# +# Note: similar logic to what we have in Build OS. +# ++mkdir -p $tftp/toolchain/default/ ++curl -s -S -f -L $toolchain_url/toolchain.sha256 >=toolchain.sha256 + ++sed -n -e 's%^[0-9a-f]+ \*(.+)$%\1%p' toolchain.sha256 | set -e archives ++sed -n -e 's%^(.+/)?build2-toolchain-(.+)\.tar.*%\2%p' <"$archives" | set version ++sha256sum -b toolchain.sha256 | sed -n -e 's%^([0-9a-f]+) .*$%\1%p' | set checksum + ++/bin/bash -c "while read i && test -n \"\$i\"; do \ +b=`basename \$i` ; \ +f=$tftp/toolchain/default/\$b; \ +echo \$b: 1>&2; \ +curl -# -f -L -z \$f -o \$f $toolchain_url/\$i; \ +ln -sf \$b `sed -n -re 's/^\(.+\)-$version\(.+\)/\\1\\2/p' <<<\$f`; \ +done" <"$archives" 2>| + ++echo "$version" >=$tftp/toolchain/default/version ++echo "$toolchain_trust" >=$tftp/toolchain/default/trust + +#\ +# +# To test the bootstrap script locally, start the TFTP server in +# $tftp/toolchain/default/. +# + +sudo /usr/sbin/in.tftpd \ + --foreground \ + --address :55123 \ + --user "$(whoami)" \ + --permissive \ + --create \ + --secure \ + "$(pwd)" + +# Then uncommen testing setting (after option parsing) and run: + +etc/bootstrap/bbot-bootstrap.sh # Should bootstrap (check manifest on TFTP). +etc/bootstrap/bbot-bootstrap.sh # Should startup (fails with invalid manifest). + +# The same can be done for batch files but from the Windows VM. + +# Can also provide a test task manifest from below. + +#\ + +# Boostrap and list the machines. +# +test.options += --machines $machines --toolchain-id $checksum + ++$* --dump-machines 2>| | sed -n -e 's/^name: (.+)$/\1/p' | set -n machine + +# Perform a test build. +# ++echo "building on $machine" >&2 2>| + ++cat <<"EOI" | $* --fake-request - --dump-result >| 2>| + : 1 + name: $pkg + version: $ver + repository: $rep + trust: $rfp + machine: $machine + EOI |