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);
65 # don't remove this, Perl needs it:
70 mkdir $testdir/db/amd64;
72 function wanna-build {
73 # Here we make sure that the "require /etc/wanan-build.conf" does not
74 # have effect, and load our own file instead.
75 echo "Executing wanna-build" "$@" >&2
76 export PERL5LIB=/home/jojo/debian/wanna-build/testsetup/bin
79 do "./tests/tmp/wanna-build.conf";
80 $INC{"/etc/wanna-build.conf"}=1;
84 require "./bin/wanna-build";
91 wanna-build -A amd64 -b amd64/build-db --create-db --info no-package-1.2.3
93 echo Load some sources
94 wanna-build -A amd64 -b amd64/build-db --merge-all <(cat <<__END__
101 misc/src-a_1.dsc [optional:uncompiled]
109 Build-Depends: compiler
110 Binary: bin-a-indep,bin-a-1
114 # Test that they exist are in state Needs-Build
115 wanna-build -A amd64 -b amd64/build-db --info src-a | assert_grep ' State.*: Needs-Build'
117 echo Take for building
118 wanna-build -A amd64 -b amd64/build-db --take src-a_1
119 wanna-build -A amd64 -b amd64/build-db --info src-a | assert_grep ' State.*: Building'
122 wanna-build -A amd64 -b amd64/build-db --uploaded src-a_1
123 wanna-build -A amd64 -b amd64/build-db --info src-a | assert_grep ' State.*: Uploaded'
125 echo Load the binaries for the sources
126 wanna-build -A amd64 -b amd64/build-db --merge-all <(cat <<__END__
145 Build-Depends: compiler
146 Binary: bin-a-indep,bin-a-1
150 # Test that they exist are in state Needs-Build
151 wanna-build -A amd64 -b amd64/build-db --info src-a | assert_grep ' State .*: Installed'
153 echo Upload another source that needs bin-a-1 in Version 2
154 wanna-build -A amd64 -b amd64/build-db --merge-all <(cat <<__END__
166 misc/src-b_1.dsc [optional:uncompiled]
174 Build-Depends: compiler
175 Binary: bin-a-indep,bin-a-1
182 Build-Depends: bin-a-1 (>= 2)
187 wanna-build -A amd64 -b amd64/build-db --info src-b | assert_grep "bin-a-1 (>= 2)"
189 echo Uploading the new source with an updated binary package
190 wanna-build -A amd64 -b amd64/build-db --merge-all <(cat <<__END__
202 misc/src-a_1.dsc [optional:uncompiled]
203 misc/src-b_1.dsc [optional:uncompiled]
211 Build-Depends: compiler
212 Binary: bin-a-indep,bin-a-1,bin-a-2
219 Build-Depends: bin-a-1 (>= 2)
224 wanna-build -A amd64 -b amd64/build-db --info src-b | assert_grep "State.*:.*Needs-Build"
226 echo "Finished sucessfully"