Fix use of test_must_fail with environment variables

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2017-08-25 06:57:22 +02:00
parent cb307bf01a
commit 7ef1427678
2 changed files with 111 additions and 68 deletions

View file

@ -23,7 +23,9 @@ test_expect_success 'Test help.' '
test_expect_success 'Test maintenance mode.' ' test_expect_success 'Test maintenance mode.' '
mv config config.old && mv config config.old &&
sed "s/^\(enable-maintenance = \)0$/\\11/" config.old >config && sed "s/^\(enable-maintenance = \)0$/\\11/" config.old >config &&
SSH_ORIGINAL_COMMAND=help test_must_fail "$GIT_SERVE" 2>actual && test_must_fail \
env SSH_ORIGINAL_COMMAND=help \
"$GIT_SERVE" 2>actual &&
cat >expected <<-EOF && cat >expected <<-EOF &&
The AUR is down due to maintenance. We will be back soon. The AUR is down due to maintenance. We will be back soon.
EOF EOF
@ -44,7 +46,9 @@ test_expect_success 'Test IP address logging.' '
test_expect_success 'Test IP address bans.' ' test_expect_success 'Test IP address bans.' '
SSH_CLIENT_ORIG="$SSH_CLIENT" && SSH_CLIENT_ORIG="$SSH_CLIENT" &&
SSH_CLIENT="1.3.3.7 1337 22" && SSH_CLIENT="1.3.3.7 1337 22" &&
SSH_ORIGINAL_COMMAND=help test_must_fail "$GIT_SERVE" 2>actual && test_must_fail \
env SSH_ORIGINAL_COMMAND=help \
"$GIT_SERVE" 2>actual &&
cat >expected <<-EOF && cat >expected <<-EOF &&
The SSH interface is disabled for your IP address. The SSH interface is disabled for your IP address.
EOF EOF
@ -78,9 +82,10 @@ test_expect_success 'Test git-receive-pack.' '
' '
test_expect_success 'Test git-receive-pack with an invalid repository name.' ' test_expect_success 'Test git-receive-pack with an invalid repository name.' '
SSH_ORIGINAL_COMMAND="git-receive-pack /!.git/" \ test_must_fail \
env SSH_ORIGINAL_COMMAND="git-receive-pack /!.git/" \
AUR_USER=user AUR_PRIVILEGED=0 \ AUR_USER=user AUR_PRIVILEGED=0 \
test_must_fail "$GIT_SERVE" 2>&1 >actual "$GIT_SERVE" 2>&1 >actual
' '
test_expect_success "Test git-upload-pack." ' test_expect_success "Test git-upload-pack." '
@ -108,9 +113,10 @@ test_expect_success "Try to pull from someone else's repository." '
' '
test_expect_success "Try to push to someone else's repository." ' test_expect_success "Try to push to someone else's repository." '
SSH_ORIGINAL_COMMAND="git-receive-pack /foobar2.git/" \ test_must_fail \
env SSH_ORIGINAL_COMMAND="git-receive-pack /foobar2.git/" \
AUR_USER=user AUR_PRIVILEGED=0 \ AUR_USER=user AUR_PRIVILEGED=0 \
test_must_fail "$GIT_SERVE" 2>&1 "$GIT_SERVE" 2>&1
' '
test_expect_success "Try to push to someone else's repository as Trusted User." ' test_expect_success "Try to push to someone else's repository as Trusted User." '
@ -138,8 +144,10 @@ test_expect_success "Test restore." '
' '
test_expect_success "Try to restore an existing package base." ' test_expect_success "Try to restore an existing package base." '
SSH_ORIGINAL_COMMAND="restore foobar2" AUR_USER=user AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_SERVE" 2>&1 env SSH_ORIGINAL_COMMAND="restore foobar2" \
AUR_USER=user AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1
' '
test_expect_success "Disown all package bases." ' test_expect_success "Disown all package bases." '
@ -169,8 +177,10 @@ test_expect_success "Adopt a package base as a regular user." '
' '
test_expect_success "Adopt an already adopted package base." ' test_expect_success "Adopt an already adopted package base." '
SSH_ORIGINAL_COMMAND="adopt foobar" AUR_USER=user AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_SERVE" 2>&1 env SSH_ORIGINAL_COMMAND="adopt foobar" \
AUR_USER=user AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1
' '
test_expect_success "Adopt a package base as a Trusted User." ' test_expect_success "Adopt a package base as a Trusted User." '
@ -207,8 +217,10 @@ test_expect_success "Disown one's own package base as a Trusted User." '
test_expect_success "Try to steal another user's package as a regular user." ' test_expect_success "Try to steal another user's package as a regular user." '
SSH_ORIGINAL_COMMAND="adopt foobar2" AUR_USER=tu AUR_PRIVILEGED=1 \ SSH_ORIGINAL_COMMAND="adopt foobar2" AUR_USER=tu AUR_PRIVILEGED=1 \
"$GIT_SERVE" 2>&1 && "$GIT_SERVE" 2>&1 &&
SSH_ORIGINAL_COMMAND="adopt foobar2" AUR_USER=user AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_SERVE" 2>&1 && env SSH_ORIGINAL_COMMAND="adopt foobar2" \
AUR_USER=user AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF && cat >expected <<-EOF &&
EOF EOF
SSH_ORIGINAL_COMMAND="list-repos" AUR_USER=user AUR_PRIVILEGED=0 \ SSH_ORIGINAL_COMMAND="list-repos" AUR_USER=user AUR_PRIVILEGED=0 \
@ -247,8 +259,10 @@ test_expect_success "Try to steal another user's package as a Trusted User." '
test_expect_success "Try to disown another user's package as a regular user." ' test_expect_success "Try to disown another user's package as a regular user." '
SSH_ORIGINAL_COMMAND="adopt foobar2" AUR_USER=tu AUR_PRIVILEGED=1 \ SSH_ORIGINAL_COMMAND="adopt foobar2" AUR_USER=tu AUR_PRIVILEGED=1 \
"$GIT_SERVE" 2>&1 && "$GIT_SERVE" 2>&1 &&
SSH_ORIGINAL_COMMAND="disown foobar2" AUR_USER=user AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_SERVE" 2>&1 && env SSH_ORIGINAL_COMMAND="disown foobar2" \
AUR_USER=user AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF && cat >expected <<-EOF &&
*foobar2 *foobar2
EOF EOF
@ -303,9 +317,10 @@ test_expect_success "Update package base co-maintainers." '
' '
test_expect_success "Try to add co-maintainers to an orphan package base." ' test_expect_success "Try to add co-maintainers to an orphan package base." '
SSH_ORIGINAL_COMMAND="set-comaintainers foobar2 user2 user3 user4" \ test_must_fail \
env SSH_ORIGINAL_COMMAND="set-comaintainers foobar2 user2 user3 user4" \
AUR_USER=user AUR_PRIVILEGED=0 \ AUR_USER=user AUR_PRIVILEGED=0 \
test_must_fail "$GIT_SERVE" 2>&1 && "$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF && cat >expected <<-EOF &&
4|3|1 4|3|1
5|3|2 5|3|2
@ -425,8 +440,10 @@ test_expect_success "Unflag a package base as random user." '
test_expect_success "Flag using a comment which is too short." ' test_expect_success "Flag using a comment which is too short." '
SSH_ORIGINAL_COMMAND="unflag foobar" AUR_USER=user2 AUR_PRIVILEGED=0 \ SSH_ORIGINAL_COMMAND="unflag foobar" AUR_USER=user2 AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1 && "$GIT_SERVE" 2>&1 &&
SSH_ORIGINAL_COMMAND="flag foobar xx" AUR_USER=user2 AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_SERVE" 2>&1 && env SSH_ORIGINAL_COMMAND="flag foobar xx" \
AUR_USER=user2 AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF && cat >expected <<-EOF &&
0|Because. 0|Because.
EOF EOF
@ -453,8 +470,9 @@ test_expect_success "Vote for a package base." '
' '
test_expect_success "Vote for a package base twice." ' test_expect_success "Vote for a package base twice." '
SSH_ORIGINAL_COMMAND="vote foobar" AUR_USER=user AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_SERVE" 2>&1 && env SSH_ORIGINAL_COMMAND="vote foobar" AUR_USER=user AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF && cat >expected <<-EOF &&
3|1 3|1
EOF EOF
@ -486,8 +504,10 @@ test_expect_success "Remove vote from a package base." '
' '
test_expect_success "Try to remove the vote again." ' test_expect_success "Try to remove the vote again." '
SSH_ORIGINAL_COMMAND="unvote foobar" AUR_USER=user AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_SERVE" 2>&1 && env SSH_ORIGINAL_COMMAND="unvote foobar" \
AUR_USER=user AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF && cat >expected <<-EOF &&
EOF EOF
echo "SELECT PackageBaseID, UsersID FROM PackageVotes;" | \ echo "SELECT PackageBaseID, UsersID FROM PackageVotes;" | \

View file

@ -95,8 +95,9 @@ test_expect_success 'Test restore mode on a non-existent repository.' '
cat >expected <<-EOD && cat >expected <<-EOD &&
error: restore: repository not found: foobar3 error: restore: repository not found: foobar3
EOD EOD
AUR_USER=user AUR_PKGBASE=foobar3 AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" restore >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar3 AUR_PRIVILEGED=0 \
"$GIT_UPDATE" restore >actual 2>&1 &&
test_cmp expected actual test_cmp expected actual
' '
@ -106,8 +107,9 @@ test_expect_success 'Pushing to a branch other than master.' '
cat >expected <<-EOD && cat >expected <<-EOD &&
error: pushing to a branch other than master is restricted error: pushing to a branch other than master is restricted
EOD EOD
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/pu "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/pu "$old" "$new" >actual 2>&1 &&
test_cmp expected actual test_cmp expected actual
' '
@ -117,8 +119,9 @@ test_expect_success 'Performing a non-fast-forward ref update.' '
cat >expected <<-EOD && cat >expected <<-EOD &&
error: denying non-fast-forward (you should pull first) error: denying non-fast-forward (you should pull first)
EOD EOD
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual test_cmp expected actual
' '
@ -128,8 +131,9 @@ test_expect_success 'Performing a non-fast-forward ref update as Trusted User.'
cat >expected <<-EOD && cat >expected <<-EOD &&
error: denying non-fast-forward (you should pull first) error: denying non-fast-forward (you should pull first)
EOD EOD
AUR_USER=tu AUR_PKGBASE=foobar AUR_PRIVILEGED=1 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1 && env AUR_USER=tu AUR_PKGBASE=foobar AUR_PRIVILEGED=1 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1 &&
test_cmp expected actual test_cmp expected actual
' '
@ -146,8 +150,9 @@ test_expect_success 'Removing .SRCINFO.' '
git -C aur.git rm -q .SRCINFO && git -C aur.git rm -q .SRCINFO &&
git -C aur.git commit -q -m "Remove .SRCINFO" && git -C aur.git commit -q -m "Remove .SRCINFO" &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: missing .SRCINFO$" actual grep -q "^error: missing .SRCINFO$" actual
' '
@ -158,8 +163,9 @@ test_expect_success 'Removing .SRCINFO with a follow-up fix.' '
git -C aur.git commit -q -m "Remove .SRCINFO" && git -C aur.git commit -q -m "Remove .SRCINFO" &&
git -C aur.git revert --no-edit HEAD && git -C aur.git revert --no-edit HEAD &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: missing .SRCINFO$" actual grep -q "^error: missing .SRCINFO$" actual
' '
@ -169,8 +175,9 @@ test_expect_success 'Removing PKGBUILD.' '
git -C aur.git rm -q PKGBUILD && git -C aur.git rm -q PKGBUILD &&
git -C aur.git commit -q -m "Remove PKGBUILD" && git -C aur.git commit -q -m "Remove PKGBUILD" &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: missing PKGBUILD$" actual grep -q "^error: missing PKGBUILD$" actual
' '
@ -182,8 +189,9 @@ test_expect_success 'Pushing a tree with a subdirectory.' '
git -C aur.git add subdir/file && git -C aur.git add subdir/file &&
git -C aur.git commit -q -m "Add subdirectory" && git -C aur.git commit -q -m "Add subdirectory" &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: the repository must not contain subdirectories$" actual grep -q "^error: the repository must not contain subdirectories$" actual
' '
@ -194,8 +202,9 @@ test_expect_success 'Pushing a tree with a large blob.' '
git -C aur.git add file && git -C aur.git add file &&
git -C aur.git commit -q -m "Add large blob" && git -C aur.git commit -q -m "Add large blob" &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: maximum blob size (250.00KiB) exceeded$" actual grep -q "^error: maximum blob size (250.00KiB) exceeded$" actual
' '
@ -209,8 +218,9 @@ test_expect_success 'Pushing .SRCINFO with a non-matching package base.' '
git commit -q -am "Change package base" git commit -q -am "Change package base"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: invalid pkgbase: foobar2, expected foobar$" actual grep -q "^error: invalid pkgbase: foobar2, expected foobar$" actual
' '
@ -224,8 +234,9 @@ test_expect_success 'Pushing .SRCINFO with invalid syntax.' '
git commit -q -am "Break .SRCINFO" git commit -q -am "Break .SRCINFO"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1 env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1
' '
test_expect_success 'Pushing .SRCINFO without pkgver.' ' test_expect_success 'Pushing .SRCINFO without pkgver.' '
@ -238,8 +249,9 @@ test_expect_success 'Pushing .SRCINFO without pkgver.' '
git commit -q -am "Remove pkgver" git commit -q -am "Remove pkgver"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: missing mandatory field: pkgver$" actual grep -q "^error: missing mandatory field: pkgver$" actual
' '
@ -253,8 +265,9 @@ test_expect_success 'Pushing .SRCINFO without pkgrel.' '
git commit -q -am "Remove pkgrel" git commit -q -am "Remove pkgrel"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: missing mandatory field: pkgrel$" actual grep -q "^error: missing mandatory field: pkgrel$" actual
' '
@ -288,8 +301,9 @@ test_expect_success 'Pushing .SRCINFO with invalid pkgname.' '
git commit -q -am "Change pkgname" git commit -q -am "Change pkgname"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: invalid package name: !$" actual grep -q "^error: invalid package name: !$" actual
' '
@ -303,8 +317,9 @@ test_expect_success 'Pushing .SRCINFO with invalid epoch.' '
git commit -q -am "Change epoch" git commit -q -am "Change epoch"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: invalid epoch: !$" actual grep -q "^error: invalid epoch: !$" actual
' '
@ -319,8 +334,9 @@ test_expect_success 'Pushing .SRCINFO with too long URL.' '
git commit -q -am "Change URL" git commit -q -am "Change URL"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: url field too long: $url\$" actual grep -q "^error: url field too long: $url\$" actual
' '
@ -334,8 +350,9 @@ test_expect_success 'Missing install file.' '
git commit -q -am "Add install field" git commit -q -am "Add install field"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: missing install file: install$" actual grep -q "^error: missing install file: install$" actual
' '
@ -349,8 +366,9 @@ test_expect_success 'Missing changelog file.' '
git commit -q -am "Add changelog field" git commit -q -am "Add changelog field"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: missing changelog file: changelog$" actual grep -q "^error: missing changelog file: changelog$" actual
' '
@ -364,8 +382,9 @@ test_expect_success 'Missing source file.' '
git commit -q -am "Add file to the source array" git commit -q -am "Add file to the source array"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: missing source file: file$" actual grep -q "^error: missing source file: file$" actual
' '
@ -380,8 +399,9 @@ test_expect_success 'Pushing .SRCINFO with too long source URL.' '
git commit -q -am "Add huge source URL" git commit -q -am "Add huge source URL"
) && ) &&
new=$(git -C aur.git rev-parse HEAD) && new=$(git -C aur.git rev-parse HEAD) &&
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: source entry too long: $url\$" actual grep -q "^error: source entry too long: $url\$" actual
' '
@ -394,8 +414,9 @@ test_expect_success 'Pushing a blacklisted package.' '
cat >expected <<-EOD && cat >expected <<-EOD &&
error: package is blacklisted: forbidden error: package is blacklisted: forbidden
EOD EOD
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual test_cmp expected actual
' '
@ -422,8 +443,9 @@ test_expect_success 'Pushing a package already in the official repositories.' '
cat >expected <<-EOD && cat >expected <<-EOD &&
error: package already provided by [core]: official error: package already provided by [core]: official
EOD EOD
AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual test_cmp expected actual
' '
@ -455,8 +477,9 @@ test_expect_success 'Trying to hijack a package.' '
cat >expected <<-EOD && cat >expected <<-EOD &&
error: cannot overwrite package: foobar error: cannot overwrite package: foobar
EOD EOD
AUR_USER=user AUR_PKGBASE=foobar2 AUR_PRIVILEGED=0 \ test_must_fail \
test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 && env AUR_USER=user AUR_PKGBASE=foobar2 AUR_PRIVILEGED=0 \
"$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual test_cmp expected actual
' '