[PATCH] test: fix test database backup/restore location

classic Classic list List threaded Threaded
3 messages Options
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

[PATCH] test: fix test database backup/restore location

backup_database() and restore_database() used to store the backups in
the test specific temporary directory, through the current working
directory being there. Commit 8e7fb88237ae ("test: use source and
build paths in test-lib-common.sh") started using a test specific
backup directories under the build tree test directory. This was in
error. Switch back to the old location, but using paths to the
location instead of relying on current working directory.

Reported by Daniel Kahn Gillmor <[hidden email]>.
---
 test/test-lib-common.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index 4300eb65418f..6c3571d4c560 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -31,14 +31,14 @@ fi
 
 backup_database () {
     test_name=$(basename $0 .sh)
-    rm -rf $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."$test_name"
-    cp -pR ${MAIL_DIR}/.notmuch $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."${test_name}"
+    rm -rf $TMP_DIRECTORY/notmuch-dir-backup."$test_name"
+    cp -pR ${MAIL_DIR}/.notmuch $TMP_DIRECTORY/notmuch-dir-backup."${test_name}"
 }
 
 restore_database () {
     test_name=$(basename $0 .sh)
     rm -rf ${MAIL_DIR}/.notmuch
-    cp -pR $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch
+    cp -pR $TMP_DIRECTORY/notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch
 }
 
 # Test the binaries we have just built.  The tests are kept in
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] test: fix test database backup/restore location

On Tue 2017-10-24 21:36:11 +0300, Jani Nikula wrote:

> backup_database() and restore_database() used to store the backups in
> the test specific temporary directory, through the current working
> directory being there. Commit 8e7fb88237ae ("test: use source and
> build paths in test-lib-common.sh") started using a test specific
> backup directories under the build tree test directory. This was in
> error. Switch back to the old location, but using paths to the
> location instead of relying on current working directory.
>
> Reported by Daniel Kahn Gillmor <[hidden email]>.
> ---
>  test/test-lib-common.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
> index 4300eb65418f..6c3571d4c560 100644
> --- a/test/test-lib-common.sh
> +++ b/test/test-lib-common.sh
> @@ -31,14 +31,14 @@ fi
>  
>  backup_database () {
>      test_name=$(basename $0 .sh)
> -    rm -rf $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."$test_name"
> -    cp -pR ${MAIL_DIR}/.notmuch $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."${test_name}"
> +    rm -rf $TMP_DIRECTORY/notmuch-dir-backup."$test_name"
> +    cp -pR ${MAIL_DIR}/.notmuch $TMP_DIRECTORY/notmuch-dir-backup."${test_name}"
>  }
>  
>  restore_database () {
>      test_name=$(basename $0 .sh)
>      rm -rf ${MAIL_DIR}/.notmuch
> -    cp -pR $NOTMUCH_BUILDDIR/test/notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch
> +    cp -pR $TMP_DIRECTORY/notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch
>  }
>  
>  # Test the binaries we have just built.  The tests are kept in
Thanks for this, Jani.

i can confirm that with this patch applied, i no longer see the extra
directories lingering after a run of the test suite.  This solved my
problem.  I recommend merging :)

            --dkg

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (847 bytes) Download Attachment
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] test: fix test database backup/restore location

In reply to this post by Jani Nikula
Jani Nikula <[hidden email]> writes:

> backup_database() and restore_database() used to store the backups in
> the test specific temporary directory, through the current working
> directory being there. Commit 8e7fb88237ae ("test: use source and
> build paths in test-lib-common.sh") started using a test specific
> backup directories under the build tree test directory. This was in
> error. Switch back to the old location, but using paths to the
> location instead of relying on current working directory.

pushed,

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch