aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/.gitignore6
-rw-r--r--admin/Makefile.am.inc41
-rwxr-xr-xadmin/build-bintray-dist.sh131
-rw-r--r--admin/check-api-docs.awk72
-rw-r--r--admin/check-style-common.awk79
-rw-r--r--admin/check-style-cpp.awk87
-rw-r--r--admin/check-style-make.awk71
-rw-r--r--admin/check-style-man.awk71
-rw-r--r--admin/check-style-shell.awk95
-rwxr-xr-xadmin/check-style.sh170
-rwxr-xr-xadmin/clean-all.sh90
-rwxr-xr-xadmin/travis-build.sh98
-rwxr-xr-xadmin/travis-install-deps.sh83
13 files changed, 1094 insertions, 0 deletions
diff --git a/admin/.gitignore b/admin/.gitignore
new file mode 100644
index 000000000000..1b34cbb4e096
--- /dev/null
+++ b/admin/.gitignore
@@ -0,0 +1,6 @@
+ar-lib
+compile
+depcomp
+install-sh
+mdate-sh
+missing
diff --git a/admin/Makefile.am.inc b/admin/Makefile.am.inc
new file mode 100644
index 000000000000..7d02b0e611c3
--- /dev/null
+++ b/admin/Makefile.am.inc
@@ -0,0 +1,41 @@
+# Copyright 2015 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PHONY_TARGETS += check-style
+check-style:
+ @$(srcdir)/admin/check-style.sh \
+ -b "$(abs_top_builddir)" \
+ -s "$(abs_top_srcdir)" \
+ -t "$(PACKAGE_TARNAME)"
+
+EXTRA_DIST += admin/check-style-common.awk \
+ admin/check-style-cpp.awk \
+ admin/check-style-make.awk \
+ admin/check-style-man.awk \
+ admin/check-style-shell.awk \
+ admin/check-style.sh
diff --git a/admin/build-bintray-dist.sh b/admin/build-bintray-dist.sh
new file mode 100755
index 000000000000..99cd439892c5
--- /dev/null
+++ b/admin/build-bintray-dist.sh
@@ -0,0 +1,131 @@
+#! /bin/sh
+# Copyright 2017 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# \file admin/build-bintray-dist.sh
+# Builds a full Kyua installation under /usr/local for Ubuntu.
+#
+# This script is used to create the bintray distribution packages in lieu
+# of real Debian packages for Kyua. The result of this script is a
+# tarball that provides the contents of /usr/local for Kyua.
+
+set -e -x
+
+err() {
+ echo "${@}" 1>&2
+ exit 1
+}
+
+install_deps() {
+ sudo apt-get update -qq
+
+ local pkgsuffix=
+ local packages=
+ packages="${packages} autoconf"
+ packages="${packages} automake"
+ packages="${packages} clang"
+ packages="${packages} g++"
+ packages="${packages} gdb"
+ packages="${packages} git"
+ packages="${packages} libtool"
+ packages="${packages} make"
+ if [ "${ARCH?}" = i386 ]; then
+ pkgsuffix=:i386
+ packages="${packages} gcc-multilib"
+ packages="${packages} g++-multilib"
+ fi
+ packages="${packages} liblua5.2-0${pkgsuffix}"
+ packages="${packages} liblua5.2-dev${pkgsuffix}"
+ packages="${packages} libsqlite3-0${pkgsuffix}"
+ packages="${packages} libsqlite3-dev${pkgsuffix}"
+ packages="${packages} pkg-config${pkgsuffix}"
+ packages="${packages} sqlite3"
+ sudo apt-get install -y ${packages}
+}
+
+install_from_github() {
+ local name="${1}"; shift
+ local release="${1}"; shift
+
+ local distname="${name}-${release}"
+
+ local baseurl="https://github.com/jmmv/${name}"
+ wget --no-check-certificate \
+ "${baseurl}/releases/download/${distname}/${distname}.tar.gz"
+ tar -xzvf "${distname}.tar.gz"
+
+ local archflags=
+ [ "${ARCH?}" != i386 ] || archflags=-m32
+
+ cd "${distname}"
+ ./configure \
+ --disable-developer \
+ --without-atf \
+ --without-doxygen \
+ CC="${CC?}" \
+ CFLAGS="${archflags}" \
+ CPPFLAGS="-I/usr/local/include" \
+ CXX="${CXX?}" \
+ CXXFLAGS="${archflags}" \
+ LDFLAGS="-L/usr/local/lib -Wl,-R/usr/local/lib" \
+ PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
+ make
+ sudo make install
+ cd -
+
+ rm -rf "${distname}" "${distname}.tar.gz"
+}
+
+main() {
+ [ "${ARCH+set}" = set ] || err "ARCH must be set in the environment"
+ [ "${CC+set}" = set ] || err "CC must be set in the environment"
+ [ "${CXX+set}" = set ] || err "CXX must be set in the environment"
+
+ [ ! -f /root/local.tgz ] || err "/root/local.tgz already exists"
+ tar -czf /root/local.tgz /usr/local
+ restore() {
+ rm -rf /usr/local
+ tar -xz -C / -f /root/local.tgz
+ rm /root/local.tgz
+ }
+ trap restore EXIT
+ rm -rf /usr/local
+ mkdir /usr/local
+
+ install_deps
+ install_from_github atf 0.21
+ install_from_github lutok 0.4
+ install_from_github kyua 0.13
+
+ local version="$(lsb_release -rs | cut -d . -f 1-2 | tr . -)"
+ local name="$(date +%Y%m%d)-usr-local-kyua"
+ name="${name}-ubuntu-${version}-${ARCH?}-${CC?}.tar.gz"
+ tar -czf "${name}" /usr/local
+}
+
+main "${@}"
diff --git a/admin/check-api-docs.awk b/admin/check-api-docs.awk
new file mode 100644
index 000000000000..358e3d54c177
--- /dev/null
+++ b/admin/check-api-docs.awk
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright 2015 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+BEGIN {
+ failed = 0
+}
+
+# Skip empty lines.
+/^$/ {next}
+
+# Skip lines that do not directly reference a file.
+/^[^\/]/ {next}
+
+# Ignore known problems. As far as I can tell, all the cases listed here are
+# well-documented in the code but Doxygen fails, for some reason or another, to
+# properly locate the docstrings.
+/engine\/kyuafile\.cpp.*no matching class member/ {next}
+/engine\/scheduler\.hpp.*Member setup\(void\).*friend/ {next}
+/engine\/scheduler\.hpp.*Member wait_any\(void\)/ {next}
+/utils\/optional\.ipp.*no matching file member/ {next}
+/utils\/optional\.hpp.*Member make_optional\(const T &\)/ {next}
+/utils\/config\/nodes\.hpp.*Member set_lua\(lutok::state &, const int\)/ {next}
+/utils\/config\/nodes\.hpp.*Member push_lua\(lutok::state &\)/ {next}
+/utils\/config\/nodes\.hpp.*Member set_string\(const std::string &\)/ {next}
+/utils\/config\/nodes\.hpp.*Member to_string\(void\)/ {next}
+/utils\/config\/nodes\.hpp.*Member is_set\(void\)/ {next}
+/utils\/process\/executor\.hpp.*Member spawn\(Hook.*\)/ {next}
+/utils\/process\/executor\.hpp.*Member spawn_followup\(Hook.*\)/ {next}
+/utils\/process\/executor\.hpp.*Member setup\(void\).*friend/ {next}
+/utils\/signals\/timer\.hpp.*Member detail::invoke_do_fired.*friend/ {next}
+/utils\/stacktrace_test\.cpp.*no matching class member/ {next}
+
+# Dump any other problems and account for the failure.
+{
+ failed = 1
+ print
+}
+
+END {
+ if (failed) {
+ print "ERROR: Unexpected docstring problems encountered"
+ exit 1
+ } else {
+ exit 0
+ }
+}
diff --git a/admin/check-style-common.awk b/admin/check-style-common.awk
new file mode 100644
index 000000000000..39516d00d4e5
--- /dev/null
+++ b/admin/check-style-common.awk
@@ -0,0 +1,79 @@
+# Copyright 2015 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+function warn(msg) {
+ print FILENAME "[" FNR "]: " msg > "/dev/stderr"
+ error = 1
+}
+
+BEGIN {
+ skip = 0
+ error = 0
+}
+
+/CHECK_STYLE_DISABLE/ {
+ skip = 1
+ next
+}
+
+/CHECK_STYLE_ENABLE/ {
+ skip = 0
+ next
+}
+
+/CHECK_STYLE_(ENABLE|DISABLE)/ {
+ next
+}
+
+{
+ if (skip)
+ next
+
+ if (length > 80 && NF > 1)
+ warn("Line too long to fit on screen")
+}
+
+/^ *\t+/ {
+ if (! match(FILENAME, "Makefile"))
+ warn("Tab character used for indentation");
+}
+
+/[ \t]+$/ {
+ warn("Trailing spaces or tabs");
+}
+
+/^#![^ ]/ {
+ warn("Missing space after #!");
+}
+
+END {
+ if (skip)
+ warn("Missing CHECK_STYLE_ENABLE");
+ if (error)
+ exit 1
+}
diff --git a/admin/check-style-cpp.awk b/admin/check-style-cpp.awk
new file mode 100644
index 000000000000..126789ca9262
--- /dev/null
+++ b/admin/check-style-cpp.awk
@@ -0,0 +1,87 @@
+# Copyright 2015 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+function warn(msg) {
+ print FILENAME "[" FNR "]: " msg > "/dev/stderr"
+ error = 1
+}
+
+BEGIN {
+ skip = 0
+ error = 0
+}
+
+/CHECK_STYLE_DISABLE/ {
+ skip = 1
+ next
+}
+
+/CHECK_STYLE_ENABLE/ {
+ skip = 0
+ next
+}
+
+/CHECK_STYLE_(ENABLE|DISABLE)/ {
+ next
+}
+
+{
+ if (skip)
+ next
+}
+
+/#ifdef/ {
+ warn("Undesired usage of #ifdef; use #if defined()")
+}
+
+/#ifndef/ {
+ warn("Undesired usage of #ifndef; use #if !defined()")
+}
+
+/assert[ \t]*\(/ {
+ warn("Use the macros in sanity.hpp instead of assert");
+}
+
+/#.*include.*assert/ {
+ warn("Do not include assert.h nor cassert");
+}
+
+/std::endl/ {
+ warn("Use \\n instead of std::endl");
+}
+
+/\/\*/ && ! /\*\// {
+ warn("Do not use multi-line C-style comments");
+}
+
+END {
+ if (skip)
+ warn("Missing CHECK_STYLE_ENABLE");
+ if (error)
+ exit 1
+}
diff --git a/admin/check-style-make.awk b/admin/check-style-make.awk
new file mode 100644
index 000000000000..9a6c532e7131
--- /dev/null
+++ b/admin/check-style-make.awk
@@ -0,0 +1,71 @@
+# Copyright 2015 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+function warn(msg) {
+ print FILENAME "[" FNR "]: " msg > "/dev/stderr"
+ error = 1
+}
+
+BEGIN {
+ skip = 0
+ error = 0
+}
+
+/CHECK_STYLE_DISABLE/ {
+ skip = 1
+ next
+}
+
+/CHECK_STYLE_ENABLE/ {
+ skip = 0
+ next
+}
+
+/CHECK_STYLE_(ENABLE|DISABLE)/ {
+ next
+}
+
+{
+ if (skip)
+ next
+}
+
+/^\t *\t/ {
+ warn("Continuation lines must use a single tab");
+}
+
+/mkdir.*-p/ {
+ warn("Use $(MKDIR_P) instead of mkdir -p");
+}
+
+END {
+ if (skip)
+ warn("Missing CHECK_STYLE_ENABLE");
+ if (error)
+ exit 1
+}
diff --git a/admin/check-style-man.awk b/admin/check-style-man.awk
new file mode 100644
index 000000000000..5c4a2c261b96
--- /dev/null
+++ b/admin/check-style-man.awk
@@ -0,0 +1,71 @@
+# Copyright 2015 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+function warn(msg) {
+ print FILENAME "[" FNR "]: " msg > "/dev/stderr"
+ error = 1
+}
+
+BEGIN {
+ skip = 0
+ error = 0
+}
+
+/CHECK_STYLE_DISABLE|^\.Bd/ {
+ skip = 1
+ next
+}
+
+/CHECK_STYLE_ENABLE|^\.Ed/ {
+ skip = 0
+ next
+}
+
+/CHECK_STYLE_(ENABLE|DISABLE)/ {
+ next
+}
+
+/^\.\\"/ {
+ next
+}
+
+{
+ if (skip)
+ next
+}
+
+/\.\.|e\.g\.|i\.e\./ {
+ next
+}
+
+END {
+ if (skip)
+ warn("Missing CHECK_STYLE_ENABLE");
+ if (error)
+ exit 1
+}
diff --git a/admin/check-style-shell.awk b/admin/check-style-shell.awk
new file mode 100644
index 000000000000..43d3472cb45b
--- /dev/null
+++ b/admin/check-style-shell.awk
@@ -0,0 +1,95 @@
+# Copyright 2015 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+function warn(msg) {
+ print FILENAME "[" FNR "]: " msg > "/dev/stderr"
+ error = 1
+}
+
+BEGIN {
+ skip = 0
+ error = 0
+}
+
+/CHECK_STYLE_DISABLE/ {
+ skip = 1
+ next
+}
+
+/CHECK_STYLE_ENABLE/ {
+ skip = 0
+ next
+}
+
+/CHECK_STYLE_(ENABLE|DISABLE)/ {
+ next
+}
+
+{
+ if (skip)
+ next
+}
+
+/^[ \t]*#/ {
+ next
+}
+
+/[$ \t]+_[a-zA-Z0-9]+=/ {
+ warn("Variable should not start with an underline")
+}
+
+/[^\\]\$[^0-9!'"$?@#*{}(|\/,]+/ {
+ warn("Missing braces around variable name")
+}
+
+/=(""|'')/ {
+ warn("Assignment to the empty string does not need quotes");
+}
+
+/basename[ \t]+/ {
+ warn("Use parameter expansion instead of basename");
+}
+
+/if[ \t]+(test|![ \t]+test)/ {
+ warn("Use [ instead of test");
+}
+
+/[ \t]+(test|\[).*==/ {
+ warn("test(1)'s == operator is not portable");
+}
+
+/if.*;[ \t]*fi$/ {
+ warn("Avoid using a single-line if conditional");
+}
+
+END {
+ if (skip)
+ warn("Missing CHECK_STYLE_ENABLE");
+ if (error)
+ exit 1
+}
diff --git a/admin/check-style.sh b/admin/check-style.sh
new file mode 100755
index 000000000000..696f9247a74a
--- /dev/null
+++ b/admin/check-style.sh
@@ -0,0 +1,170 @@
+#! /bin/sh
+# Copyright 2011 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# \file admin/check-style.sh
+#
+# Sanity checks the coding style of all source files in the project tree.
+
+ProgName="${0##*/}"
+
+
+# Prints an error message and exits.
+#
+# \param ... Parts of the error message; concatenated using a space as the
+# separator.
+err() {
+ echo "${ProgName}:" "${@}" 1>&2
+ exit 1
+}
+
+
+# Locates all source files within the project directory.
+#
+# We require the project to have been configured in a directory that is separate
+# from the source tree. This is to allow us to easily filter out build
+# artifacts from our search.
+#
+# \param srcdir Absolute path to the source directory.
+# \param builddir Absolute path to the build directory.
+# \param tarname Basename of the project's tar file, to skip possible distfile
+# directories.
+find_sources() {
+ local srcdir="${1}"; shift
+ local builddir="${1}"; shift
+ local tarname="${1}"; shift
+
+ (
+ cd "${srcdir}"
+ find . -type f -a \
+ \! -path "*/.git/*" \
+ \! -path "*/.deps/*" \
+ \! -path "*/autom4te.cache/*" \
+ \! -path "*/${tarname}-[0-9]*/*" \
+ \! -path "*/${builddir##*/}/*" \
+ \! -name "Makefile.in" \
+ \! -name "aclocal.m4" \
+ \! -name "config.h.in" \
+ \! -name "configure" \
+ \! -name "testsuite"
+ )
+}
+
+
+# Prints the style rules applicable to a given file.
+#
+# \param file Path to the source file.
+guess_rules() {
+ local file="${1}"; shift
+
+ case "${file}" in
+ */ax_cxx_compile_stdcxx.m4) ;;
+ */ltmain.sh) ;;
+ *Makefile*) echo common make ;;
+ *.[0-9]) echo common man ;;
+ *.cpp|*.hpp) echo common cpp ;;
+ *.sh) echo common shell ;;
+ *) echo common ;;
+ esac
+}
+
+
+# Validates a given file against the rules that apply to it.
+#
+# \param srcdir Absolute path to the source directory.
+# \param file Name of the file to validate relative to srcdir.
+#
+# \return 0 if the file is valid; 1 otherwise, in which case the style
+# violations are printed to the output.
+check_file() {
+ local srcdir="${1}"; shift
+ local file="${1}"; shift
+
+ local err=0
+ for rule in $(guess_rules "${file}"); do
+ awk -f "${srcdir}/admin/check-style-${rule}.awk" \
+ "${srcdir}/${file}" || err=1
+ done
+
+ return ${err}
+}
+
+
+# Entry point.
+main() {
+ local builddir=.
+ local srcdir=.
+ local tarname=UNKNOWN
+
+ local arg
+ while getopts :b:s:t: arg; do
+ case "${arg}" in
+ b)
+ builddir="${OPTARG}"
+ ;;
+
+ s)
+ srcdir="${OPTARG}"
+ ;;
+
+ t)
+ tarname="${OPTARG}"
+ ;;
+
+ \?)
+ err "Unknown option -${OPTARG}"
+ ;;
+ esac
+ done
+ shift $(expr ${OPTIND} - 1)
+
+ srcdir="$(cd "${srcdir}" && pwd -P)"
+ builddir="$(cd "${builddir}" && pwd -P)"
+ [ "${srcdir}" != "${builddir}" ] || \
+ err "srcdir and builddir cannot match; reconfigure the package" \
+ "in a separate directory"
+
+ local sources
+ if [ ${#} -gt 0 ]; then
+ sources="${@}"
+ else
+ sources="$(find_sources "${srcdir}" "${builddir}" "${tarname}")"
+ fi
+
+ local ok=0
+ for file in ${sources}; do
+ local file="$(echo ${file} | sed -e "s,\\./,,")"
+
+ check_file "${srcdir}" "${file}" || ok=1
+ done
+
+ return "${ok}"
+}
+
+
+main "${@}"
diff --git a/admin/clean-all.sh b/admin/clean-all.sh
new file mode 100755
index 000000000000..bc02f1e811f4
--- /dev/null
+++ b/admin/clean-all.sh
@@ -0,0 +1,90 @@
+#! /bin/sh
+# Copyright 2010 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Prog_Name=${0##*/}
+
+if [ ! -f ./main.cpp ]; then
+ echo "${Prog_Name}: must be run from the source top directory" 1>&2
+ exit 1
+fi
+
+if [ ! -f configure ]; then
+ echo "${Prog_Name}: configure not found; nothing to clean?" 1>&2
+ exit 1
+fi
+
+[ -f Makefile ] || ./configure
+make distclean
+
+# Top-level directory.
+rm -f Makefile.in
+rm -f aclocal.m4
+rm -rf autom4te.cache
+rm -f config.h.in
+rm -f configure
+rm -f mkinstalldirs
+rm -f kyua-*.tar.gz
+
+# admin directory.
+rm -f admin/ar-lib
+rm -f admin/compile
+rm -f admin/config.guess
+rm -f admin/config.sub
+rm -f admin/depcomp
+rm -f admin/install-sh
+rm -f admin/ltmain.sh
+rm -f admin/mdate-sh
+rm -f admin/missing
+
+# bootstrap directory.
+rm -f bootstrap/package.m4
+rm -f bootstrap/testsuite
+
+# doc directory.
+rm -f doc/*.info
+rm -f doc/stamp-vti
+rm -f doc/version.texi
+
+# m4 directory.
+rm -f m4/libtool.m4
+rm -f m4/lt*.m4
+
+# Files and directories spread all around the tree.
+find . -name '#*' | xargs rm -rf
+find . -name '*~' | xargs rm -rf
+find . -name .deps | xargs rm -rf
+find . -name .gdb_history | xargs rm -rf
+find . -name .libs | xargs rm -rf
+find . -name .tmp | xargs rm -rf
+
+# Show remaining files.
+if [ -n "${GIT}" ]; then
+ echo ">>> untracked and ignored files"
+ "${GIT}" status --porcelain --ignored | grep -E '^(\?\?|!!)' || true
+fi
diff --git a/admin/travis-build.sh b/admin/travis-build.sh
new file mode 100755
index 000000000000..e69f271c13f1
--- /dev/null
+++ b/admin/travis-build.sh
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright 2014 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+set -e -x
+
+run_autoreconf() {
+ if [ -d /usr/local/share/aclocal ]; then
+ autoreconf -isv -I/usr/local/share/aclocal
+ else
+ autoreconf -isv
+ fi
+}
+
+do_apidocs() {
+ run_autoreconf || return 1
+ ./configure --with-doxygen || return 1
+ make check-api-docs
+}
+
+do_distcheck() {
+ run_autoreconf || return 1
+ ./configure || return 1
+
+ sudo sysctl -w "kernel.core_pattern=core.%p"
+
+ local archflags=
+ [ "${ARCH?}" != i386 ] || archflags=-m32
+
+ cat >kyua.conf <<EOF
+syntax(2)
+
+-- We do not know how many CPUs the test machine has. However, parallelizing
+-- the execution of our tests to _any_ degree speeds up the time it takes to
+-- complete a test run because many of our tests are blocking.
+parallelism = 4
+EOF
+ [ "${UNPRIVILEGED_USER:-no}" = no ] || \
+ echo "unprivileged_user = 'travis'" >>kyua.conf
+
+ local f=
+ f="${f} CFLAGS='${archflags}'"
+ f="${f} CPPFLAGS='-I/usr/local/include'"
+ f="${f} CXXFLAGS='${archflags}'"
+ f="${f} LDFLAGS='-L/usr/local/lib -Wl,-R/usr/local/lib'"
+ f="${f} PKG_CONFIG_PATH='/usr/local/lib/pkgconfig'"
+ f="${f} KYUA_CONFIG_FILE_FOR_CHECK=$(pwd)/kyua.conf"
+ if [ "${AS_ROOT:-no}" = yes ]; then
+ sudo -H PATH="${PATH}" make distcheck DISTCHECK_CONFIGURE_FLAGS="${f}"
+ else
+ make distcheck DISTCHECK_CONFIGURE_FLAGS="${f}"
+ fi
+}
+
+do_style() {
+ run_autoreconf || return 1
+ mkdir build
+ cd build
+ ../configure || return 1
+ make check-style
+}
+
+main() {
+ if [ -z "${DO}" ]; then
+ echo "DO must be defined" 1>&2
+ exit 1
+ fi
+ for step in ${DO}; do
+ "do_${DO}" || exit 1
+ done
+}
+
+main "${@}"
diff --git a/admin/travis-install-deps.sh b/admin/travis-install-deps.sh
new file mode 100755
index 000000000000..9341c43895b1
--- /dev/null
+++ b/admin/travis-install-deps.sh
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright 2014 The Kyua Authors.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+set -e -x
+
+install_deps() {
+ local pkgsuffix=
+ local packages=
+ if [ "${ARCH?}" = i386 ]; then
+ pkgsuffix=:i386
+ packages="${packages} gcc-multilib"
+ packages="${packages} g++-multilib"
+ sudo dpkg --add-architecture i386
+ fi
+ packages="${packages} gdb"
+ packages="${packages} liblua5.2-0${pkgsuffix}"
+ packages="${packages} liblua5.2-dev${pkgsuffix}"
+ packages="${packages} libsqlite3-0${pkgsuffix}"
+ packages="${packages} libsqlite3-dev${pkgsuffix}"
+ packages="${packages} pkg-config${pkgsuffix}"
+ packages="${packages} sqlite3"
+ sudo apt-get update -qq
+ sudo apt-get install -y ${packages}
+}
+
+install_kyua() {
+ local name="20190321-usr-local-kyua-ubuntu-16-04-${ARCH?}-${CC?}.tar.gz"
+ wget -O "${name}" "http://dl.bintray.com/ngie-eign/kyua/${name}" || return 1
+ sudo tar -xzvp -C / -f "${name}"
+ rm -f "${name}"
+}
+
+do_apidocs() {
+ sudo apt-get install -y doxygen
+}
+
+do_distcheck() {
+ :
+}
+
+do_style() {
+ :
+}
+
+main() {
+ if [ -z "${DO}" ]; then
+ echo "DO must be defined" 1>&2
+ exit 1
+ fi
+ install_deps
+ install_kyua
+ for step in ${DO}; do
+ "do_${DO}" || exit 1
+ done
+}
+
+main "${@}"