summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtest/t1200-git-serve.sh64
-rwxr-xr-xtest/t1300-git-update.sh115
2 files changed, 111 insertions, 68 deletions
diff --git a/test/t1200-git-serve.sh b/test/t1200-git-serve.sh
index 038a7989..94a5ff61 100755
--- a/test/t1200-git-serve.sh
+++ b/test/t1200-git-serve.sh
@@ -23,7 +23,9 @@ test_expect_success 'Test help.' '
test_expect_success 'Test maintenance mode.' '
mv config config.old &&
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 &&
The AUR is down due to maintenance. We will be back soon.
EOF
@@ -44,7 +46,9 @@ test_expect_success 'Test IP address logging.' '
test_expect_success 'Test IP address bans.' '
SSH_CLIENT_ORIG="$SSH_CLIENT" &&
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 &&
The SSH interface is disabled for your IP address.
EOF
@@ -78,9 +82,10 @@ test_expect_success 'Test git-receive-pack.' '
'
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 \
- test_must_fail "$GIT_SERVE" 2>&1 >actual
+ "$GIT_SERVE" 2>&1 >actual
'
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." '
- 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 \
- 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." '
@@ -138,8 +144,10 @@ test_expect_success "Test restore." '
'
test_expect_success "Try to restore an existing package base." '
- SSH_ORIGINAL_COMMAND="restore foobar2" AUR_USER=user AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_SERVE" 2>&1
+ test_must_fail \
+ env SSH_ORIGINAL_COMMAND="restore foobar2" \
+ AUR_USER=user AUR_PRIVILEGED=0 \
+ "$GIT_SERVE" 2>&1
'
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." '
- SSH_ORIGINAL_COMMAND="adopt foobar" AUR_USER=user AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_SERVE" 2>&1
+ test_must_fail \
+ 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." '
@@ -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." '
SSH_ORIGINAL_COMMAND="adopt foobar2" AUR_USER=tu AUR_PRIVILEGED=1 \
"$GIT_SERVE" 2>&1 &&
- SSH_ORIGINAL_COMMAND="adopt foobar2" AUR_USER=user AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_SERVE" 2>&1 &&
+ test_must_fail \
+ env SSH_ORIGINAL_COMMAND="adopt foobar2" \
+ AUR_USER=user AUR_PRIVILEGED=0 \
+ "$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF &&
EOF
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." '
SSH_ORIGINAL_COMMAND="adopt foobar2" AUR_USER=tu AUR_PRIVILEGED=1 \
"$GIT_SERVE" 2>&1 &&
- SSH_ORIGINAL_COMMAND="disown foobar2" AUR_USER=user AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_SERVE" 2>&1 &&
+ test_must_fail \
+ env SSH_ORIGINAL_COMMAND="disown foobar2" \
+ AUR_USER=user AUR_PRIVILEGED=0 \
+ "$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF &&
*foobar2
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." '
- 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 \
- test_must_fail "$GIT_SERVE" 2>&1 &&
+ "$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF &&
4|3|1
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." '
SSH_ORIGINAL_COMMAND="unflag foobar" AUR_USER=user2 AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1 &&
- SSH_ORIGINAL_COMMAND="flag foobar xx" AUR_USER=user2 AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_SERVE" 2>&1 &&
+ test_must_fail \
+ env SSH_ORIGINAL_COMMAND="flag foobar xx" \
+ AUR_USER=user2 AUR_PRIVILEGED=0 \
+ "$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF &&
0|Because.
EOF
@@ -453,8 +470,9 @@ test_expect_success "Vote for a package base." '
'
test_expect_success "Vote for a package base twice." '
- SSH_ORIGINAL_COMMAND="vote foobar" AUR_USER=user AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_SERVE" 2>&1 &&
+ test_must_fail \
+ env SSH_ORIGINAL_COMMAND="vote foobar" AUR_USER=user AUR_PRIVILEGED=0 \
+ "$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF &&
3|1
EOF
@@ -486,8 +504,10 @@ test_expect_success "Remove vote from a package base." '
'
test_expect_success "Try to remove the vote again." '
- SSH_ORIGINAL_COMMAND="unvote foobar" AUR_USER=user AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_SERVE" 2>&1 &&
+ test_must_fail \
+ env SSH_ORIGINAL_COMMAND="unvote foobar" \
+ AUR_USER=user AUR_PRIVILEGED=0 \
+ "$GIT_SERVE" 2>&1 &&
cat >expected <<-EOF &&
EOF
echo "SELECT PackageBaseID, UsersID FROM PackageVotes;" | \
diff --git a/test/t1300-git-update.sh b/test/t1300-git-update.sh
index 109351a9..b9c4f53a 100755
--- a/test/t1300-git-update.sh
+++ b/test/t1300-git-update.sh
@@ -95,8 +95,9 @@ test_expect_success 'Test restore mode on a non-existent repository.' '
cat >expected <<-EOD &&
error: restore: repository not found: foobar3
EOD
- AUR_USER=user AUR_PKGBASE=foobar3 AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" restore >actual 2>&1 &&
+ test_must_fail \
+ env AUR_USER=user AUR_PKGBASE=foobar3 AUR_PRIVILEGED=0 \
+ "$GIT_UPDATE" restore >actual 2>&1 &&
test_cmp expected actual
'
@@ -106,8 +107,9 @@ test_expect_success 'Pushing to a branch other than master.' '
cat >expected <<-EOD &&
error: pushing to a branch other than master is restricted
EOD
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/pu "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
+ "$GIT_UPDATE" refs/heads/pu "$old" "$new" >actual 2>&1 &&
test_cmp expected actual
'
@@ -117,8 +119,9 @@ test_expect_success 'Performing a non-fast-forward ref update.' '
cat >expected <<-EOD &&
error: denying non-fast-forward (you should pull first)
EOD
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
+ "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual
'
@@ -128,8 +131,9 @@ test_expect_success 'Performing a non-fast-forward ref update as Trusted User.'
cat >expected <<-EOD &&
error: denying non-fast-forward (you should pull first)
EOD
- AUR_USER=tu AUR_PKGBASE=foobar AUR_PRIVILEGED=1 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1 &&
+ test_must_fail \
+ env AUR_USER=tu AUR_PKGBASE=foobar AUR_PRIVILEGED=1 \
+ "$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1 &&
test_cmp expected actual
'
@@ -146,8 +150,9 @@ test_expect_success 'Removing .SRCINFO.' '
git -C aur.git rm -q .SRCINFO &&
git -C aur.git commit -q -m "Remove .SRCINFO" &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -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 revert --no-edit HEAD &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -169,8 +175,9 @@ test_expect_success 'Removing PKGBUILD.' '
git -C aur.git rm -q PKGBUILD &&
git -C aur.git commit -q -m "Remove PKGBUILD" &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -182,8 +189,9 @@ test_expect_success 'Pushing a tree with a subdirectory.' '
git -C aur.git add subdir/file &&
git -C aur.git commit -q -m "Add subdirectory" &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -194,8 +202,9 @@ test_expect_success 'Pushing a tree with a large blob.' '
git -C aur.git add file &&
git -C aur.git commit -q -m "Add large blob" &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -209,8 +218,9 @@ test_expect_success 'Pushing .SRCINFO with a non-matching package base.' '
git commit -q -am "Change package base"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -224,8 +234,9 @@ test_expect_success 'Pushing .SRCINFO with invalid syntax.' '
git commit -q -am "Break .SRCINFO"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1
+ test_must_fail \
+ 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.' '
@@ -238,8 +249,9 @@ test_expect_success 'Pushing .SRCINFO without pkgver.' '
git commit -q -am "Remove pkgver"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -253,8 +265,9 @@ test_expect_success 'Pushing .SRCINFO without pkgrel.' '
git commit -q -am "Remove pkgrel"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -288,8 +301,9 @@ test_expect_success 'Pushing .SRCINFO with invalid pkgname.' '
git commit -q -am "Change pkgname"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -303,8 +317,9 @@ test_expect_success 'Pushing .SRCINFO with invalid epoch.' '
git commit -q -am "Change epoch"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -319,8 +334,9 @@ test_expect_success 'Pushing .SRCINFO with too long URL.' '
git commit -q -am "Change URL"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -334,8 +350,9 @@ test_expect_success 'Missing install file.' '
git commit -q -am "Add install field"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -349,8 +366,9 @@ test_expect_success 'Missing changelog file.' '
git commit -q -am "Add changelog field"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -364,8 +382,9 @@ test_expect_success 'Missing source file.' '
git commit -q -am "Add file to the source array"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -380,8 +399,9 @@ test_expect_success 'Pushing .SRCINFO with too long source URL.' '
git commit -q -am "Add huge source URL"
) &&
new=$(git -C aur.git rev-parse HEAD) &&
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ 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
'
@@ -394,8 +414,9 @@ test_expect_success 'Pushing a blacklisted package.' '
cat >expected <<-EOD &&
error: package is blacklisted: forbidden
EOD
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
+ "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual
'
@@ -422,8 +443,9 @@ test_expect_success 'Pushing a package already in the official repositories.' '
cat >expected <<-EOD &&
error: package already provided by [core]: official
EOD
- AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
+ "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual
'
@@ -455,8 +477,9 @@ test_expect_success 'Trying to hijack a package.' '
cat >expected <<-EOD &&
error: cannot overwrite package: foobar
EOD
- AUR_USER=user AUR_PKGBASE=foobar2 AUR_PRIVILEGED=0 \
- test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
+ test_must_fail \
+ env AUR_USER=user AUR_PKGBASE=foobar2 AUR_PRIVILEGED=0 \
+ "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual
'