summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:46:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:46:56 +0000
commit8e79ad9f544d1c4a0476e0d96aef0496ca7fc741 (patch)
treecda1743f5820600fd8c638ac7f034f917ac8c381 /test
parentInitial commit. (diff)
downloadsbuild-8e79ad9f544d1c4a0476e0d96aef0496ca7fc741.tar.xz
sbuild-8e79ad9f544d1c4a0476e0d96aef0496ca7fc741.zip
Adding upstream version 0.85.6.upstream/0.85.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test')
-rw-r--r--test/.gitignore10
-rw-r--r--test/Makefile.am49
-rw-r--r--test/logging10
-rwxr-xr-xtest/perl-syntax.in30
-rwxr-xr-xtest/sbuild-checkpackages.in28
-rw-r--r--test/sbuild-clean.in26
-rw-r--r--test/sbuild-distupgrade.in26
-rwxr-xr-xtest/sbuild-hold.in28
-rwxr-xr-xtest/sbuild-update.in28
-rwxr-xr-xtest/sbuild-upgrade.in26
-rwxr-xr-xtest/sbuild.in48
-rwxr-xr-xtest/wanna-build130
12 files changed, 439 insertions, 0 deletions
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 0000000..e8f0b39
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1,10 @@
+perl-syntax
+sbuild
+sbuild-checkpackages
+sbuild-clean
+sbuild-distupgrade
+sbuild-hold
+sbuild-stats
+sbuild-update
+sbuild-upgrade
+update
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..ca1083b
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,49 @@
+# sbuild Makefile template
+#
+#
+# Copyright © 2004-2008 Roger Leigh <rleigh@debian.org>
+#
+# sbuild is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# sbuild is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+include $(top_srcdir)/scripts/global.mk
+
+TESTS = \
+ perl-syntax \
+ $(chroot_checks)
+
+if SBUILD_CHROOT_CHECKS
+chroot_checks = \
+ sbuild-hold \
+ sbuild-update \
+ sbuild-upgrade \
+ sbuild-distupgrade \
+ sbuild-clean \
+ sbuild-checkpackages \
+ sbuild
+endif
+
+EXTRA_DIST = \
+ logging \
+ perl-syntax.in \
+ sbuild-update.in \
+ sbuild-upgrade.in \
+ sbuild-distupgrade.in \
+ sbuild-clean.in \
+ sbuild-hold.in \
+ sbuild-checkpackages.in \
+ sbuild.in \
+ wanna-build
diff --git a/test/logging b/test/logging
new file mode 100644
index 0000000..ee2c8c5
--- /dev/null
+++ b/test/logging
@@ -0,0 +1,10 @@
+Logging test combinations:
+
+user mode with no log dir set
+user mode with log dir set
+buildd mode (log dir always set)
+
+direct download
+dsc
+source in cwd
+source in other directory
diff --git a/test/perl-syntax.in b/test/perl-syntax.in
new file mode 100755
index 0000000..5edb5e5
--- /dev/null
+++ b/test/perl-syntax.in
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# perl-syntax: Check validity of perl syntax in programs
+# Copyright © 2010 Roger Leigh <rleigh@debian.org
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#######################################################################
+
+set -e
+
+for program in "@abs_top_srcdir@/bin/"*
+do
+ if grep '#!/usr/bin/perl' "$program" 2>&1 >/dev/null; then
+ echo "Checking $program"
+ PERL5LIB="@abs_top_srcdir@/lib" /usr/bin/perl -cw "$program"
+ fi
+done
diff --git a/test/sbuild-checkpackages.in b/test/sbuild-checkpackages.in
new file mode 100755
index 0000000..bd5c405
--- /dev/null
+++ b/test/sbuild-checkpackages.in
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# sbuild-checkpackages: Test sbuild-checkpackages
+# Copyright © 2010 Roger Leigh <rleigh@debian.org
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#######################################################################
+
+set -e
+
+for dist in unstable; do
+ for opt in --list --set --list; do
+ PERL5LIB="@abs_top_srcdir@/lib" "@abs_top_srcdir@/bin/sbuild-checkpackages" "$opt" "$dist"
+ done
+done
diff --git a/test/sbuild-clean.in b/test/sbuild-clean.in
new file mode 100644
index 0000000..b0c25b5
--- /dev/null
+++ b/test/sbuild-clean.in
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# sbuild-clean: Test sbuild-clean
+# Copyright © 2010 Roger Leigh <rleigh@debian.org
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#######################################################################
+
+set -e
+
+for dist in unstable; do
+ PATH="@abs_top_srcdir@/bin:$PATH" PERL5LIB="@abs_top_srcdir@/lib" "@abs_top_srcdir@/bin/sbuild-clean" "$dist"
+done
diff --git a/test/sbuild-distupgrade.in b/test/sbuild-distupgrade.in
new file mode 100644
index 0000000..12a373c
--- /dev/null
+++ b/test/sbuild-distupgrade.in
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# sbuild-distupgrade: Test sbuild-distupgrade
+# Copyright © 2010 Roger Leigh <rleigh@debian.org
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#######################################################################
+
+set -e
+
+for dist in unstable; do
+ PATH="@abs_top_srcdir@/bin:$PATH" PERL5LIB="@abs_top_srcdir@/lib" "@abs_top_srcdir@/bin/sbuild-distupgrade" "$dist"
+done
diff --git a/test/sbuild-hold.in b/test/sbuild-hold.in
new file mode 100755
index 0000000..8097756
--- /dev/null
+++ b/test/sbuild-hold.in
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# sbuild-hold: Test sbuild-hold and sbuild-unhold
+# Copyright © 2010 Roger Leigh <rleigh@debian.org
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#######################################################################
+
+set -e
+
+for dist in unstable; do
+ for prog in sbuild-hold sbuild-unhold; do
+ PERL5LIB="@abs_top_srcdir@/lib" "@abs_top_srcdir@/bin/$prog" "$dist" bash apt
+ done
+done
diff --git a/test/sbuild-update.in b/test/sbuild-update.in
new file mode 100755
index 0000000..e5ca8f6
--- /dev/null
+++ b/test/sbuild-update.in
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# sbuild-update: Test sbuild-update
+# Copyright © 2010 Roger Leigh <rleigh@debian.org
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#######################################################################
+
+set -e
+
+for dist in unstable; do
+ for opt in --update --upgrade --dist-upgrade --clean --autoclean --autoremove -ugdcar; do
+ PERL5LIB="@abs_top_srcdir@/lib" "@abs_top_srcdir@/bin/sbuild-update" "$opt" "$dist"
+ done
+done
diff --git a/test/sbuild-upgrade.in b/test/sbuild-upgrade.in
new file mode 100755
index 0000000..8516451
--- /dev/null
+++ b/test/sbuild-upgrade.in
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# sbuild-upgrade: Test sbuild-upgrade
+# Copyright © 2010 Roger Leigh <rleigh@debian.org
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#######################################################################
+
+set -e
+
+for dist in unstable; do
+ PATH="@abs_top_srcdir@/bin:$PATH" PERL5LIB="@abs_top_srcdir@/lib" "@abs_top_srcdir@/bin/sbuild-upgrade" "$dist"
+done
diff --git a/test/sbuild.in b/test/sbuild.in
new file mode 100755
index 0000000..44b1869
--- /dev/null
+++ b/test/sbuild.in
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# sbuild: Test package building
+# Copyright © 2010 Roger Leigh <rleigh@debian.org
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#######################################################################
+
+set -e
+
+for dist in unstable; do
+ schrootdist="$dist-$(dpkg-architecture -qDEB_HOST_ARCH)-sbuild"
+
+ # General build checks
+ for pkg in bash dadadodo time pong2; do
+ ver="$(schroot --directory=/tmp -c "$schrootdist" -- apt-cache showsrc "$pkg" | grep ^Version: | head -n 1 | sed -e 's/^Version:[[:space:]]*\(.*\)$/\1/')"
+ PATH="@abs_top_srcdir@/bin:$PATH" PERL5LIB="@abs_top_srcdir@/lib" SBUILD_CONFIG="@abs_top_srcdir@/etc/example.sbuildrc" "@abs_top_srcdir@/bin/sbuild" -s -A -d"$dist" "${pkg}_${ver}"
+ done
+
+ # Test batch mode
+ for pkg in bash dadadodo; do
+ ver="$(schroot --directory=/tmp -c "$schrootdist" -- apt-cache showsrc "$pkg" | grep ^Version: | head -n 1 | sed -e 's/^Version:[[:space:]]*\(.*\)$/\1/')"
+ PATH="@abs_top_srcdir@/bin:$PATH" PERL5LIB="@abs_top_srcdir@/lib" SBUILD_CONFIG="@abs_top_srcdir@/etc/example.sbuildrc" "@abs_top_srcdir@/bin/sbuild" --batch -s -A -d"$dist" "${pkg}_${ver}"
+ done
+
+ # Test source building (note: no epoch or revision)
+ for pkg in debianutils; do
+ {
+ ver="$(apt-cache policy "$pkg" | grep "\*\*\*" | awk '{ print $2 }' | sed -e 's/^Version:[[:space:]]*\(.*\)$/\1/')"
+ apt-get source $pkg
+ cd "${pkg}-${ver}"
+ PATH="@abs_top_srcdir@/bin:$PATH" PERL5LIB="@abs_top_srcdir@/lib" SBUILD_CONFIG="@abs_top_srcdir@/etc/example.sbuildrc" "@abs_top_srcdir@/bin/sbuild" --batch -s -A -d"$dist"
+ }
+ done
+done
diff --git a/test/wanna-build b/test/wanna-build
new file mode 100755
index 0000000..d0ad6db
--- /dev/null
+++ b/test/wanna-build
@@ -0,0 +1,130 @@
+#!/usr/bin/perl
+#
+# This is a fake wanna-build. Its sole purpose is to provide a means
+# to test buildd in isolation, without a full wanna-build database and
+# associated intrastructure. This currently only permits testing of
+# buildd, and not buildd-mail or buildd-uploader.
+#
+
+use strict;
+use warnings;
+
+use Getopt::Long qw(:config no_ignore_case auto_abbrev gnu_getopt);
+
+our $api = 1;
+our $arch = "amd64";
+our $list = undef;
+our $dist = "unstable";
+our $verbose = 0;
+our $command = "take";
+our $user = "buildd";
+our $database = "db";
+
+my @options = (
+ 'api=i' => \$api,
+ 'arch|A=s' => \$arch,
+ 'list|l=s' => sub { $command="list"; $list=$_[1]; },
+ 'dist|d=s' => \$dist,
+ 'verbose|v' => \$verbose,
+ 'building|take' => sub { $command="take" },
+ 'built' => sub { $command="built" },
+ 'attempted' => sub { $command="attempted" },
+ 'needs-build|give-back' => sub { $command="needs-build" },
+ 'info|i' => sub { $command="info" },
+ 'user=s' => \$user,
+ 'database=s' => \$database
+ );
+GetOptions(@options);
+
+my $output = "unknown output for action\n";
+if ($command eq "take") {
+ if ($verbose) {
+ $output = <<"EOF";
+wanna-build c9531211e54a03cff965eebc3fe617ea8539f7ba for sid on amd64
+- bash:
+ - status: ok
+ - pkg-ver: bash_4.2-1
+ - archive: ftp-master
+uupdate transactions: bash sid 4.1-3 --take Installed Building rleigh rleigh
+\$VAR1 = {
+ 'state_days' => '52',
+ 'priority' => 'source',
+ 'rel' => undef,
+ 'state_change' => '2012 Jan 21 16:19:15',
+ 'successtime' => 694,
+ 'permbuildpri' => undef,
+ 'extra_depends' => undef,
+ 'section' => 'shells',
+ 'failed' => undef,
+ 'buildpri' => undef,
+ 'state' => 'Building',
+ 'binary_nmu_changelog' => undef,
+ 'anytime' => 694,
+ 'bd_problem' => undef,
+ 'state_time' => '4510370',
+ 'build_arch_all' => 0,
+ 'version' => '4.1-3',
+ 'package' => 'bash',
+ 'distribution' => 'sid',
+ 'extra_conflicts' => undef,
+ 'installed_version' => '4.2-1',
+ 'notes' => 'out-of-date',
+ 'do_state_change' => 1,
+ 'builder' => 'rleigh',
+ 'old_failed' => undef,
+ 'binary_nmu_version' => undef,
+ 'previous_state' => 'Installed',
+ 'depends' => undef
+ };
+EOF
+ } else {
+ $output = <<"EOF";
+- bash:
+ - status: ok
+ - pkg-ver: bash_4.2-1
+ - archive: ftp-master
+update transactions: bash sid 4.2-1 --take Needs-Build Building rleigh rleigh
+EOF
+ }
+} elsif ($command eq "built") {
+ $output = <<"EOF";
+update transactions: bash sid 4.2-1 --built Building Built rleigh rleigh
+EOF
+} elsif ($command eq "attempted") {
+ $output = <<"EOF";
+update transactions: bash sid 4.2-1 --attempted Building Build-Attempted rleigh rleigh
+EOF
+} elsif ($command eq "needs-build") {
+ $output = <<"EOF";
+update transactions: bash sid 4.2-1 --give-back Building BD-Uninstallable rleigh rleigh
+EOF
+} elsif ($command eq "info") {
+ $output = <<"EOF";
+bash:
+ Package : bash
+ Version : 4.2-1
+ Builder : buildd_amd64-barber
+ State : Needs-Build
+ Section : shells
+ Priority : source
+ Installed-Version : 4.1-3
+ Previous-State : Installed
+ State-Change : 2011-11-30 11:26:24.40323
+ Build-time : 694
+ Build-Arch-All : 0
+ CalculatedPri : 52
+ component : main
+ Distribution : sid
+ Notes : out-of-date
+ State-Days : 52
+ State-Time : 4510444
+ Success-build-time : 694
+EOF
+} elsif ($command eq "list" && $list eq "needs-build") {
+ $output = <<"EOF";
+libs/bash_4.2-1 [optional:out-of-date:calprio{49}:days{0}]
+Total 1 package(s)
+EOF
+}
+
+print "$output";