# file : tests/machine/testscript # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : TBC; see accompanying LICENSE file # Note that if interrupted (^C) during machine execution, then have to # delete iptables rules manually. To list, use -S, to delete -D: # # iptables -t nat -S # iptables -S 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/toolchains/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/toolchains/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/toolchains/default/version +echo "$toolchain_trust" >=$tftp/toolchains/default/trust #\ # # To test the bootstrap script locally, start the TFTP server in # $tftp/toolchains/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