|
Packit |
209faa |
.\" Copyright 2012 The Kyua Authors.
|
|
Packit |
209faa |
.\" All rights reserved.
|
|
Packit |
209faa |
.\"
|
|
Packit |
209faa |
.\" Redistribution and use in source and binary forms, with or without
|
|
Packit |
209faa |
.\" modification, are permitted provided that the following conditions are
|
|
Packit |
209faa |
.\" met:
|
|
Packit |
209faa |
.\"
|
|
Packit |
209faa |
.\" * Redistributions of source code must retain the above copyright
|
|
Packit |
209faa |
.\" notice, this list of conditions and the following disclaimer.
|
|
Packit |
209faa |
.\" * Redistributions in binary form must reproduce the above copyright
|
|
Packit |
209faa |
.\" notice, this list of conditions and the following disclaimer in the
|
|
Packit |
209faa |
.\" documentation and/or other materials provided with the distribution.
|
|
Packit |
209faa |
.\" * Neither the name of Google Inc. nor the names of its contributors
|
|
Packit |
209faa |
.\" may be used to endorse or promote products derived from this software
|
|
Packit |
209faa |
.\" without specific prior written permission.
|
|
Packit |
209faa |
.\"
|
|
Packit |
209faa |
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit |
209faa |
.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit |
209faa |
.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit |
209faa |
.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit |
209faa |
.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit |
209faa |
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit |
209faa |
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit |
209faa |
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit |
209faa |
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
209faa |
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
209faa |
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
209faa |
.Em Build directories
|
|
Packit |
209faa |
(or object directories, target directories, product directories, etc.) is
|
|
Packit |
209faa |
the concept that allows a developer to keep the source tree clean from
|
|
Packit |
209faa |
build products by asking the build system to place such build products
|
|
Packit |
209faa |
under a separate subtree.
|
|
Packit |
209faa |
.Pp
|
|
Packit |
209faa |
Most build systems today support build directories. For example, the GNU
|
|
Packit |
209faa |
Automake/Autoconf build system exposes such concept when invoked as
|
|
Packit |
209faa |
follows:
|
|
Packit |
209faa |
.Bd -literal -offset indent
|
|
Packit |
209faa |
$ cd my-project-1.0
|
|
Packit |
209faa |
$ mkdir build
|
|
Packit |
209faa |
$ cd build
|
|
Packit |
209faa |
$ ../configure
|
|
Packit |
209faa |
$ make
|
|
Packit |
209faa |
.Ed
|
|
Packit |
209faa |
.Pp
|
|
Packit |
209faa |
Under such invocation, all the results of the build are left in the
|
|
Packit |
209faa |
.Pa my-project-1.0/build/
|
|
Packit |
209faa |
subdirectory while maintaining the contents of
|
|
Packit |
209faa |
.Pa my-project-1.0/
|
|
Packit |
209faa |
intact.
|
|
Packit |
209faa |
.Pp
|
|
Packit |
209faa |
Because build directories are an integral part of most build systems, and
|
|
Packit |
209faa |
because they are a tool that developers use frequently,
|
|
Packit |
209faa |
.Nm
|
|
Packit |
209faa |
supports build directories too. This manifests in the form of
|
|
Packit |
209faa |
.Nm
|
|
Packit |
209faa |
being able to run tests from build directories while reading the (often
|
|
Packit |
209faa |
immutable) test suite definition from the source tree.
|
|
Packit |
209faa |
.Pp
|
|
Packit |
209faa |
One important property of build directories is that they follow (or need to
|
|
Packit |
209faa |
follow) the exact same layout as the source tree. For example, consider
|
|
Packit |
209faa |
the following directory listings:
|
|
Packit |
209faa |
.Bd -literal -offset indent
|
|
Packit |
209faa |
src/Kyuafile
|
|
Packit |
209faa |
src/bin/ls/
|
|
Packit |
209faa |
src/bin/ls/Kyuafile
|
|
Packit |
209faa |
src/bin/ls/ls.c
|
|
Packit |
209faa |
src/bin/ls/ls_test.c
|
|
Packit |
209faa |
src/sbin/su/
|
|
Packit |
209faa |
src/sbin/su/Kyuafile
|
|
Packit |
209faa |
src/sbin/su/su.c
|
|
Packit |
209faa |
src/sbin/su/su_test.c
|
|
Packit |
209faa |
|
|
Packit |
209faa |
obj/bin/ls/
|
|
Packit |
209faa |
obj/bin/ls/ls*
|
|
Packit |
209faa |
obj/bin/ls/ls_test*
|
|
Packit |
209faa |
obj/sbin/su/
|
|
Packit |
209faa |
obj/sbin/su/su*
|
|
Packit |
209faa |
obj/sbin/su/su_test*
|
|
Packit |
209faa |
.Ed
|
|
Packit |
209faa |
.Pp
|
|
Packit |
209faa |
Note how the directory layout within
|
|
Packit |
209faa |
.Pa src/
|
|
Packit |
209faa |
matches that of
|
|
Packit |
209faa |
.Pa obj/ .
|
|
Packit |
209faa |
The
|
|
Packit |
209faa |
.Pa src/
|
|
Packit |
209faa |
directory contains only source files and the definition of the test suite
|
|
Packit |
209faa |
(the Kyuafiles), while the
|
|
Packit |
209faa |
.Pa obj/
|
|
Packit |
209faa |
directory contains only the binaries generated during a build.
|
|
Packit |
209faa |
.Pp
|
|
Packit |
209faa |
All commands that deal with the workspace support the
|
|
Packit |
209faa |
.Fl -build-root Ar path
|
|
Packit |
209faa |
option. When this option is provided, the directory specified by the
|
|
Packit |
209faa |
option is considered to be the root of the build directory. For example,
|
|
Packit |
209faa |
considering our previous fake tree layout, we could invoke
|
|
Packit |
209faa |
.Nm
|
|
Packit |
209faa |
as any of the following:
|
|
Packit |
209faa |
.Bd -literal -offset indent
|
|
Packit |
209faa |
$ kyua __COMMAND__ --kyuafile=src/Kyuafile --build-root=obj
|
|
Packit |
209faa |
$ cd src && kyua __COMMAND__ --build-root=../obj
|
|
Packit |
209faa |
.Ed
|