[PATCH 2/4] Support running tests from any directory

Frédéric Mangano-Tarumi fmang at mg0.fr
Sat Feb 29 00:01:38 UTC 2020


---
 test/setup.sh               | 5 ++---
 test/t1100-git-auth.t       | 2 +-
 test/t1200-git-serve.t      | 2 +-
 test/t1300-git-update.t     | 2 +-
 test/t2100-mkpkglists.t     | 2 +-
 test/t2200-tuvotereminder.t | 2 +-
 test/t2300-pkgmaint.t       | 2 +-
 test/t2400-aurblup.t        | 2 +-
 test/t2500-notify.t         | 2 +-
 test/t2600-rendercomment.t  | 2 +-
 test/t2700-usermaint.t      | 2 +-
 11 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/test/setup.sh b/test/setup.sh
index cad5cd66..4a6eb3b1 100644
--- a/test/setup.sh
+++ b/test/setup.sh
@@ -1,7 +1,6 @@
-TEST_DIRECTORY="$(pwd)"
-TOPLEVEL="$(cd .. && pwd)"
+TOPLEVEL="$(cd "$(dirname "$0")/.." && pwd)"
 
-. ./sharness.sh
+. "$TOPLEVEL/test/sharness.sh"
 
 # Configure python search path.
 PYTHONPATH="$TOPLEVEL"
diff --git a/test/t1100-git-auth.t b/test/t1100-git-auth.t
index 71d526f2..cbf16aed 100755
--- a/test/t1100-git-auth.t
+++ b/test/t1100-git-auth.t
@@ -2,7 +2,7 @@
 
 test_description='git-auth tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test basic authentication.' '
 	"$GIT_AUTH" "$AUTH_KEYTYPE_USER" "$AUTH_KEYTEXT_USER" >out &&
diff --git a/test/t1200-git-serve.t b/test/t1200-git-serve.t
index e817b2cf..1893cdcd 100755
--- a/test/t1200-git-serve.t
+++ b/test/t1200-git-serve.t
@@ -2,7 +2,7 @@
 
 test_description='git-serve tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test interactive shell.' '
 	"$GIT_SERVE" 2>&1 | grep -q "Interactive shell is disabled."
diff --git a/test/t1300-git-update.t b/test/t1300-git-update.t
index 06d14984..82c0fb99 100755
--- a/test/t1300-git-update.t
+++ b/test/t1300-git-update.t
@@ -2,7 +2,7 @@
 
 test_description='git-update tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 dump_package_info() {
 	for t in Packages Licenses PackageLicenses Groups PackageGroups \
diff --git a/test/t2100-mkpkglists.t b/test/t2100-mkpkglists.t
index fc11d073..5bf13de8 100755
--- a/test/t2100-mkpkglists.t
+++ b/test/t2100-mkpkglists.t
@@ -2,7 +2,7 @@
 
 test_description='mkpkglists tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test package list generation with no packages.' '
 	echo "DELETE FROM Packages;" | sqlite3 aur.db &&
diff --git a/test/t2200-tuvotereminder.t b/test/t2200-tuvotereminder.t
index c82ce874..5a8f3a25 100755
--- a/test/t2200-tuvotereminder.t
+++ b/test/t2200-tuvotereminder.t
@@ -2,7 +2,7 @@
 
 test_description='tuvotereminder tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test Trusted User vote reminders.' '
 	now=$(date -d now +%s) &&
diff --git a/test/t2300-pkgmaint.t b/test/t2300-pkgmaint.t
index 478df526..c390f5db 100755
--- a/test/t2300-pkgmaint.t
+++ b/test/t2300-pkgmaint.t
@@ -2,7 +2,7 @@
 
 test_description='pkgmaint tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test package base cleanup script.' '
 	now=$(date -d now +%s) &&
diff --git a/test/t2400-aurblup.t b/test/t2400-aurblup.t
index 708281c6..cc287a0f 100755
--- a/test/t2400-aurblup.t
+++ b/test/t2400-aurblup.t
@@ -2,7 +2,7 @@
 
 test_description='aurblup tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test official provider update script.' '
 	mkdir -p remote/test/foobar-1.0-1 &&
diff --git a/test/t2500-notify.t b/test/t2500-notify.t
index 380e65b8..5ef64c18 100755
--- a/test/t2500-notify.t
+++ b/test/t2500-notify.t
@@ -2,7 +2,7 @@
 
 test_description='notify tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test out-of-date notifications.' '
 	cat <<-EOD | sqlite3 aur.db &&
diff --git a/test/t2600-rendercomment.t b/test/t2600-rendercomment.t
index be408b80..e01904c6 100755
--- a/test/t2600-rendercomment.t
+++ b/test/t2600-rendercomment.t
@@ -2,7 +2,7 @@
 
 test_description='rendercomment tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test comment rendering.' '
 	cat <<-EOD | sqlite3 aur.db &&
diff --git a/test/t2700-usermaint.t b/test/t2700-usermaint.t
index 4f625142..f0bb449b 100755
--- a/test/t2700-usermaint.t
+++ b/test/t2700-usermaint.t
@@ -2,7 +2,7 @@
 
 test_description='usermaint tests'
 
-. ./setup.sh
+. "$(dirname "$0")/setup.sh"
 
 test_expect_success 'Test removal of login IP addresses.' '
 	now=$(date -d now +%s) &&
-- 
2.25.1


More information about the aur-dev mailing list