From cd034e872d1a273961ef5612239d5e8168eb8843 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 24 Apr 2014 04:05:40 +0200 Subject: tests: run from anywhere --- tests/setup.sh | 6 ++++-- tests/sharness.sh | 2 +- tests/t0001-sanity-checks.sh | 1 + tests/t0010-generate-tests.sh | 1 + tests/t0020-show-tests.sh | 1 + tests/t0050-mv-tests.sh | 1 + tests/t0060-rm-tests.sh | 1 + tests/t0100-insert-tests.sh | 1 + tests/t0200-edit-tests.sh | 1 + tests/t0300-reencryption.sh | 1 + tests/t0400-grep.sh | 1 + tests/t0500-find.sh | 1 + 12 files changed, 15 insertions(+), 3 deletions(-) mode change 100755 => 100644 tests/setup.sh (limited to 'tests') diff --git a/tests/setup.sh b/tests/setup.sh old mode 100755 new mode 100644 index 8198874..334b367 --- 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' ' -- cgit v1.2.3