diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-04-24 04:05:40 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-04-24 04:05:40 +0200 |
commit | cd034e872d1a273961ef5612239d5e8168eb8843 (patch) | |
tree | 26a7f2d394d7c1f6c1277ed158a3661c0b777a32 | |
parent | a759d964e40d160d901052ec90e53c5acbe60355 (diff) |
tests: run from anywhere
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | tests/setup.sh | 6 | ||||
-rw-r--r-- | tests/sharness.sh | 2 | ||||
-rwxr-xr-x | tests/t0001-sanity-checks.sh | 1 | ||||
-rwxr-xr-x | tests/t0010-generate-tests.sh | 1 | ||||
-rwxr-xr-x | tests/t0020-show-tests.sh | 1 | ||||
-rwxr-xr-x | tests/t0050-mv-tests.sh | 1 | ||||
-rwxr-xr-x | tests/t0060-rm-tests.sh | 1 | ||||
-rwxr-xr-x | tests/t0100-insert-tests.sh | 1 | ||||
-rwxr-xr-x | tests/t0200-edit-tests.sh | 1 | ||||
-rwxr-xr-x | tests/t0300-reencryption.sh | 1 | ||||
-rwxr-xr-x | tests/t0400-grep.sh | 1 | ||||
-rwxr-xr-x | tests/t0500-find.sh | 1 |
13 files changed, 16 insertions, 4 deletions
@@ -65,7 +65,7 @@ TESTS = $(sort $(wildcard tests/t[0-9][0-9][0-9][0-9]-*.sh)) test: $(TESTS) $(TESTS): - @cd $$(dirname "$@") && ./$$(basename "$@") $(PASS_TEST_OPTS) + @$@ $(PASS_TEST_OPTS) clean: $(RM) -rf tests/test-results/ tests/trash\ directory.*/ tests/gnupg/random_seed diff --git a/tests/setup.sh b/tests/setup.sh index 8198874..334b367 100755..100644 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -6,9 +6,11 @@ # $KEY{1..5} GPG key ids of testing keys # $TEST_HOME This folder -. ./sharness.sh -TEST_HOME="$(cd "$(dirname "$SHARNESS_TEST_FILE")/.."; pwd)" +# We must be called from tests/ !! +TEST_HOME="$(pwd)" + +. ./sharness.sh export PASSWORD_STORE_DIR="$SHARNESS_TRASH_DIRECTORY/test-store/" rm -rf "$PASSWORD_STORE_DIR" diff --git a/tests/sharness.sh b/tests/sharness.sh index 380f22c..b7ecc56 100644 --- a/tests/sharness.sh +++ b/tests/sharness.sh @@ -668,7 +668,7 @@ PATH="$SHARNESS_BUILD_DIRECTORY:$PATH" export PATH SHARNESS_BUILD_DIRECTORY # Public: Path to test script currently executed. -SHARNESS_TEST_FILE="$0" +SHARNESS_TEST_FILE="./$(basename "$0")" export SHARNESS_TEST_FILE # Prepare test area. diff --git a/tests/t0001-sanity-checks.sh b/tests/t0001-sanity-checks.sh index 68379e3..4ce8d09 100755 --- a/tests/t0001-sanity-checks.sh +++ b/tests/t0001-sanity-checks.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Sanity checks' +cd "$(dirname "$0")" . ./setup.sh test_expect_success 'Make sure we can run pass' ' diff --git a/tests/t0010-generate-tests.sh b/tests/t0010-generate-tests.sh index 735f70d..72bdb47 100755 --- a/tests/t0010-generate-tests.sh +++ b/tests/t0010-generate-tests.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Test generate' +cd "$(dirname "$0")" . ./setup.sh test_expect_success 'Test "generate" command' ' diff --git a/tests/t0020-show-tests.sh b/tests/t0020-show-tests.sh index f08c71d..602e93e 100755 --- a/tests/t0020-show-tests.sh +++ b/tests/t0020-show-tests.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Test show' +cd "$(dirname "$0")" . ./setup.sh test_expect_success 'Test "show" command' ' diff --git a/tests/t0050-mv-tests.sh b/tests/t0050-mv-tests.sh index 7110d7e..7a45249 100755 --- a/tests/t0050-mv-tests.sh +++ b/tests/t0050-mv-tests.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Test mv command' +cd "$(dirname "$0")" . ./setup.sh INITIAL_PASSWORD="bla bla bla will we make it!!" diff --git a/tests/t0060-rm-tests.sh b/tests/t0060-rm-tests.sh index d53d7da..3a15077 100755 --- a/tests/t0060-rm-tests.sh +++ b/tests/t0060-rm-tests.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Test rm' +cd "$(dirname "$0")" . ./setup.sh test_expect_success 'Test "rm" command' ' diff --git a/tests/t0100-insert-tests.sh b/tests/t0100-insert-tests.sh index 6194ceb..451ef52 100755 --- a/tests/t0100-insert-tests.sh +++ b/tests/t0100-insert-tests.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Test insert' +cd "$(dirname "$0")" . ./setup.sh test_expect_success 'Test "insert" command' ' diff --git a/tests/t0200-edit-tests.sh b/tests/t0200-edit-tests.sh index 58e3f31..8055c91 100755 --- a/tests/t0200-edit-tests.sh +++ b/tests/t0200-edit-tests.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Test edit' +cd "$(dirname "$0")" . ./setup.sh test_expect_success 'Test "edit" command' ' diff --git a/tests/t0300-reencryption.sh b/tests/t0300-reencryption.sh index bbc4b18..6a453d5 100755 --- a/tests/t0300-reencryption.sh +++ b/tests/t0300-reencryption.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Reencryption consistency' +cd "$(dirname "$0")" . ./setup.sh INITIAL_PASSWORD="will this password live? a big question indeed..." diff --git a/tests/t0400-grep.sh b/tests/t0400-grep.sh index 808a720..f858c10 100755 --- a/tests/t0400-grep.sh +++ b/tests/t0400-grep.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Grep check' +cd "$(dirname "$0")" . ./setup.sh test_expect_success 'Make sure grep prints normal lines' ' diff --git a/tests/t0500-find.sh b/tests/t0500-find.sh index 2167836..03ba1fd 100755 --- a/tests/t0500-find.sh +++ b/tests/t0500-find.sh @@ -1,6 +1,7 @@ #!/bin/bash test_description='Find check' +cd "$(dirname "$0")" . ./setup.sh test_expect_success 'Make sure find resolves correct files' ' |