[PATCH] test: verify test database v1 checksum in more portable way

2017-03-12 Thread Tomi Ollila
Replaced use of sha256 (gnu coreutils binary) with more portable
openssl sha256 execution.
---

Works on Linux and also on my FreeBSD KVM environment.

 test/T530-upgrade.sh  | 6 --
 test/test-databases/database-v1.tar.xz.sha256 | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)
 delete mode 100644 test/test-databases/database-v1.tar.xz.sha256

diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh
index f0fd151..bda3f98 100755
--- a/test/T530-upgrade.sh
+++ b/test/T530-upgrade.sh
@@ -12,8 +12,10 @@ fi
 
 test_begin_subtest "database checksum"
 test_expect_success \
-'( cd $TEST_DIRECTORY/test-databases &&
-   sha256sum --quiet --check --status ${dbtarball}.sha256 )'
+'case `openssl sha256 $TEST_DIRECTORY/test-databases/${dbtarball}` in
+   *4299e051b10e1fa7b33ea2862790a09ebfe96859681804e5251e130f800e69d2*) ;;
+   *) false ;;
+ esac'
 
 tar xf $TEST_DIRECTORY/test-databases/${dbtarball} -C ${MAIL_DIR} 
--strip-components=1
 
diff --git a/test/test-databases/database-v1.tar.xz.sha256 
b/test/test-databases/database-v1.tar.xz.sha256
deleted file mode 100644
index 2cc4f96..000
--- a/test/test-databases/database-v1.tar.xz.sha256
+++ /dev/null
@@ -1 +0,0 @@
-4299e051b10e1fa7b33ea2862790a09ebfe96859681804e5251e130f800e69d2  
database-v1.tar.xz
-- 
2.9.3

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: verify test database v1 checksum in more portable way

2017-03-12 Thread David Bremner
Tomi Ollila  writes:

> Replaced use of sha256 (gnu coreutils binary) with more portable
> openssl sha256 execution.
> ---
>
> Works on Linux and also on my FreeBSD KVM environment.

There's a tradeoff here. In a minimal GNU/Linux environment coreutils is
there but not openssl. So I don't mind the substitution (for the test
suite), but I think you need to add a
"test_require_external prereq openssl" or equivalent to T530-upgrade.sh

This will also require adding openssl as a debian build dependency; I
can also live with that, although it might inconvenience some people
building the debian-snapshot target.

There's something aesthetically displeasing about hardcoding the
checksum into the test script but I think I'm just grumbling at this
point.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: verify test database v1 checksum in more portable way

2017-03-13 Thread Tomi Ollila
On Mon, Mar 13 2017, David Bremner  wrote:

> Tomi Ollila  writes:
>
>> Replaced use of sha256 (gnu coreutils binary) with more portable
>> openssl sha256 execution.
>> ---
>>
>> Works on Linux and also on my FreeBSD KVM environment.
>
> There's a tradeoff here. In a minimal GNU/Linux environment coreutils is
> there but not openssl. So I don't mind the substitution (for the test

Köh... That did not come into my mind, but perhaps that is the fun of it.

I'd rather let this test fail on non-coreutils system (for the time being)
than introduce more dependencies ;) -- have to think whether proposing
alternative solution...

And had to test that one:

  localhost$ sudo docker run --rm -it debian:8.7 /bin/bash 
  root@1c96aac39246:/# openssl
  bash: openssl: command not found
  root@1c96aac39246:/# sha1sum < /dev/null
  da39a3ee5e6b4b0d3255bfef95601890afd80709  -
  root@1c96aac39246:/# exit
  exit
  localhost$

Marking this particular patch obsolete.

Tomi


> suite), but I think you need to add a
> "test_require_external prereq openssl" or equivalent to T530-upgrade.sh
>
> This will also require adding openssl as a debian build dependency; I
> can also live with that, although it might inconvenience some people
> building the debian-snapshot target.
>
> There's something aesthetically displeasing about hardcoding the
> checksum into the test script but I think I'm just grumbling at this
> point.

I personally disagree (in specific cases like this), but would not have
done that if there were simpler solution using the file...
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch