From b895ba115548e1ae6d17e11f7c95a895195f0e94 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 18 Jul 2017 13:31:20 +0300 Subject: Adapt to non-optional task target --- bbot/worker/worker.cxx | 20 ++++++-------------- doc/manual.cli | 31 +++++++++++++++---------------- tests/agent/testscript | 2 ++ tests/integration/testscript | 8 +++++--- tests/machine/testscript | 6 ++++++ tests/worker/startup.test | 3 ++- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index e3da1dd..a078498 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -426,20 +426,12 @@ startup () // Find the environment setup executable. // - string tg; - process_path pp; - - if (tm.target) - { - tg = tm.target->string (); - - // While the executable path contains a directory (so the PATH search - // does not apply) we still use process::path_search() to automatically - // handle appending platform-specific executable extensions (.exe/.bat, - // etc). - // - pp = process::try_path_search (env_dir / tg, false); - } + // While the executable path contains a directory (so the PATH search does + // not apply) we still use process::path_search() to automatically handle + // appending platform-specific executable extensions (.exe/.bat, etc). + // + string tg (tm.target.string ()); + process_path pp (process::try_path_search (env_dir / tg, false)); if (pp.empty ()) pp = process::try_path_search (env_dir / "default", false); diff --git a/doc/manual.cli b/doc/manual.cli index d196b30..5f4452d 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -303,8 +303,7 @@ build configuration to use for building the package. \li|\n\c{target: }\n - The target triplet to build for. If not specified, then the default target - for this machine is used (which is usually the machine itself). + The target triplet to build for. Compared to the autotools terminology, the \c{machine} value corresponds to \c{--build} (the machine we are building on) and \c{target} \- to @@ -544,17 +543,17 @@ system modules, and configuration variables. Setting up of the environment is performed by an executable (script, batch file, etc). Specifically, upon receiving a build task, the worker obtains its target and looks for the environment setup executable with this name in a -specific directory. If not found or if the target is unspecified, then the -worker looks for the executable called \c{default}. Not being able to locate -the environment executable is an error. +specific directory. If not found, then the worker looks for the executable +called \c{default}. Not being able to locate the environment executable is an +error. Once the environment setup executable is determined, the worker re-executes itself as that executable passing to it as command line arguments the target -name (or empty value if not specified), the path to the \c{bbot} worker to be -executed once the environment is setup, and any additional options that need -to be propagated to the re-executed worker. The environment setup executable -is executed in the build directory as its current working directory. The build -directory contains the build task \c{manifest} file. +name, the path to the \c{bbot} worker to be executed once the environment is +setup, and any additional options that need to be propagated to the re-executed +worker. The environment setup executable is executed in the build directory as +its current working directory. The build directory contains the build task +\c{manifest} file. The environment setup executable sets up the necessary execution environment for example by adjusting \c{PATH} or running a suitable \c{vcvars} batch file. @@ -611,12 +610,12 @@ machines (as reported by agents) to \i{build configurations} according to the are ignored. All other lines in this file have the following format: \ - [] [] [] + [] [] \ Where \c{} is filesystem wildcard pattern that is matched against available machine names, \c{} is the -configuration name, optional \c{} is the build target, optional +configuration name, \c{} is the build target, optional \c{} is a list of additional build system configuration variables, and optional \c{} is a list of additional regular expressions that should be used to detect warnings in the logs. @@ -650,11 +649,11 @@ windows*-vc_14* windows-vc_14-64-release x86_64-microsoft-win32-msvc14.0 config. \ As another example, let's say we have \c{linux_fedora_25-gcc_6} and -\c{linux_ubuntu_16.04-gcc_6}. If all we cared about it testing GCC 6 on Linux, -then our configurations could look like this (note the missing target): +\c{linux_ubuntu_16.04-gcc_6}. If all we cared about is testing GCC 6 64-bit +builds on Linux, then our configurations could look like this: \ -linux*-gcc-6 linux-gcc_6-debug config.cc.coptions=-g -linux*-gcc-6 linux-gcc_6-release config.cc.coptions=-O3 +linux*-gcc-6 linux-gcc_6-debug x86_64-linux-gnu config.cc.coptions=-g +linux*-gcc-6 linux-gcc_6-release x86_64-linux-gnu config.cc.coptions=-O3 \ " diff --git a/tests/agent/testscript b/tests/agent/testscript index 95ca388..fb4d19a 100644 --- a/tests/agent/testscript +++ b/tests/agent/testscript @@ -133,6 +133,7 @@ rm = $src_base/btrfs-rmdir /build/machines version: 1.2.3 repository: https://example.org/1/ machine: windows-msvc + target: x86_64-microsoft-win32-msvc14.1 EOI %trace: enumerate_machines:\\.*%* error: task from http://example.org for unknown machine windows-msvc @@ -146,6 +147,7 @@ rm = $src_base/btrfs-rmdir /build/machines version: 1.2.3 repository: https://example.org/1/ machine: linux-gcc + target: x86_64-linux-gnu EOI : 1 name: foo diff --git a/tests/integration/testscript b/tests/integration/testscript index fcb3b19..2ae3b3c 100644 --- a/tests/integration/testscript +++ b/tests/integration/testscript @@ -26,6 +26,7 @@ sudo /usr/sbin/in.tftpd \ #\ machine = linux-gcc +target = x86_64-linux-gnu c = gcc cxx = g++ @@ -58,6 +59,7 @@ 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 repository: $rep trust: $rfp machine: $machine + target: $target EOI # @@ -83,7 +85,7 @@ a = $0 : worker : { - cat <<"EOI" >=default; + cat <<"EOI" >=$target; #!/bin/sh t="\$1" @@ -91,8 +93,8 @@ a = $0 exec "\$@" cc config.c=$c config.cxx=$cxx EOI - chmod ugo+x default; + chmod ugo+x $target; sleep $wait; $w --verbose 3 --startup --tftp-host $tftp --environments $~ \ - &$machine/*** &manifest 2>| + &build/*** &manifest 2>| } diff --git a/tests/machine/testscript b/tests/machine/testscript index 406d9a9..b151cf5 100644 --- a/tests/machine/testscript +++ b/tests/machine/testscript @@ -21,6 +21,11 @@ ver = 1.0.0 rep = https://hello.stage.build2.org/1/stable rfp = 37:CE:2C:A5:1D:CF:93:81:D7:07:46:AD:66:B3:C3:90:83:B8:96:9E:34:F0:E7:B3:A2:B0:6C:EF:66:A4:BE:65 +# @@ There is currently no way to obtain a valid (default?) target for the +# machine so assume it is a x86-64-bit build for something. +# +target = x86_64-unknown-unknown + # Download the toolchain. # # Note: similar logic to what we have in Build OS. @@ -86,4 +91,5 @@ test.options += --machines $machines --toolchain-id $checksum repository: $rep trust: $rfp machine: $machine + target: $target EOI diff --git a/tests/worker/startup.test b/tests/worker/startup.test index 1cf5d3c..f4a41de 100644 --- a/tests/worker/startup.test +++ b/tests/worker/startup.test @@ -41,9 +41,10 @@ cat <=manifest; version: 1.2.3 repository: https://pkg.example.org/1/ machine: linux-gcc + target: x86_64-linux-gnu EOI $* --environments $~ --tftp-host "$tftp/$@" 2>>"EOE" != 0; - error: no environment setup executable in $representation($~) for target '' + error: no environment setup executable in $representation($~) for target 'x86_64-linux-gnu' EOE diff -u - manifest <