4 # This file runs wanna-build in a clean environment to make sure, certain
5 # features work as expected.
10 # * Marks it as uploaded
11 # * Uploads a source with build-depends
12 # - Makes sure the package is marked Dep-Wait
13 # * Uploads a new version of the dependency
14 # - Makes sure the Dep-Wait is cleared
22 echo "Assertion failed: $1"
27 function assert_grep {
28 cat > $testdir/assert_grep
29 if ! grep -q "$1" $testdir/assert_grep
31 echo "Could not find expected \"$1\" in:"
32 cat $testdir/assert_grep
33 # We are in a pipe, i.e. a subshell, so kill the parent
34 kill -TERM $parent_pid
41 assert "[ -e bin/wanna-build ]"
47 # This is a fake configuration file to make sure we do not interfere with a
48 # possibly installed wanna-build instance
49 cat > $testdir/wanna-build.conf <<__END__
50 \$basedir = "$testdir/db";
52 \$db_maint = "wb-team\@dontsend.buildd.debian.org";
53 \$notforus_maint = "notforus\@dontsend.buildd.debian.org";
54 \$stat_mail = "wb-team\@dontsend.buildd.debian.org";
55 \$buildd_domain = "buildd.debian.org";
56 \$web_stats = "/var/www/buildd/stats.txt";
57 @sections = qw(main contrib non-US/main non-US/contrib);
58 \$pkgs_source = "$testdir/ftp";
59 \$quinn_source = "$testdir/quinn-diff-output";
60 \$quinn_source_multi_section = 0;
61 @admin_users = qw(wbadm $USER);
62 \$mailprog = "/bin/true";
66 # don't remove this, Perl needs it:
71 mkdir $testdir/db/amd64;
73 function wanna-build {
74 # Here we make sure that the "require /etc/wanan-build.conf" does not
75 # have effect, and load our own file instead.
76 echo "Executing wanna-build" "$@" >&2
77 export PERL5LIB=/home/jojo/debian/wanna-build/testsetup/bin
80 do "./tests/tmp/wanna-build.conf";
81 $INC{"/etc/wanna-build.conf"}=1;
85 require "./bin/wanna-build";
92 wanna-build -A amd64 -b amd64/build-db --create-db --info no-package-1.2.3
94 echo Load some sources
95 wanna-build -A amd64 -b amd64/build-db --merge-all <(cat <<__END__
102 misc/src-a_1.dsc [optional:uncompiled]
110 Build-Depends: compiler
111 Binary: bin-a-indep,bin-a-1
115 # Test that they exist are in state Needs-Build
116 wanna-build -A amd64 -b amd64/build-db --info src-a | assert_grep ' State.*: Needs-Build'
118 echo Take for building
119 wanna-build -A amd64 -b amd64/build-db --take src-a_1
120 wanna-build -A amd64 -b amd64/build-db --info src-a | assert_grep ' State.*: Building'
123 wanna-build -A amd64 -b amd64/build-db --uploaded src-a_1
124 wanna-build -A amd64 -b amd64/build-db --info src-a | assert_grep ' State.*: Uploaded'
126 echo Load the binaries for the sources
127 wanna-build -A amd64 -b amd64/build-db --merge-all <(cat <<__END__
146 Build-Depends: compiler
147 Binary: bin-a-indep,bin-a-1
151 # Test that they exist are in state Needs-Build
152 wanna-build -A amd64 -b amd64/build-db --info src-a | assert_grep ' State .*: Installed'
154 echo Upload another source that needs bin-a-1 in Version 2
155 wanna-build -A amd64 -b amd64/build-db --merge-all <(cat <<__END__
167 misc/src-b_1.dsc [optional:uncompiled]
175 Build-Depends: compiler
176 Binary: bin-a-indep,bin-a-1
183 Build-Depends: bin-a-1 (>= 2)
188 wanna-build -A amd64 -b amd64/build-db --info src-b | assert_grep "bin-a-1 (>= 2)"
190 echo Uploading the new source with an updated binary package
191 wanna-build -A amd64 -b amd64/build-db --merge-all <(cat <<__END__
203 misc/src-a_1.dsc [optional:uncompiled]
204 misc/src-b_1.dsc [optional:uncompiled]
212 Build-Depends: compiler
213 Binary: bin-a-indep,bin-a-1,bin-a-2
220 Build-Depends: bin-a-1 (>= 2)
225 wanna-build -A amd64 -b amd64/build-db --info src-b | assert_grep "State.*:.*Needs-Build"
227 echo "Finished sucessfully"