Bug#687563: RFS: opengrm-ngram/1.0.3-1 [ITP] -- opengrm n-gram library
Il 03/01/2013 16:55, Jakub Wilk ha scritto:
> * Giulio Paci <email@example.com>, 2013-01-03, 00:20:
>>> Now I get this:
>>> | /usr/bin/make check-TESTS
>>> | make: Entering directory `/build/opengrm-ngram-6ZveSN/opengrm-ngram-1.0.3/src/test'
>>> | PASS: ngramprint_test.sh
>>> | PASS: ngramcount_test.sh
>>> | PASS: ngrammake_test.sh
>>> | PASS: ngrammerge_test.sh
>>> | PASS: ngramshrink_test.sh
>>> | PASS: ngraminfo_test.sh
>>> | PASS: ngramperplexity_test.sh
>>> | PASS: ngramsymbols_test.sh
>>> | PASS: ngramrandgen_test.sh
>>> | PASS: ngramapply_test.sh
>>> | Running 9 random trials...
>>> | FATAL: SetFlags: Bad option: --seed=
>>> I guess it's because of bashisms in the failing script:
>> Indeed that was the reason. It is fixed now.
> It's now:
> seed1=`od -A n -N 2 -t u2 $RANDOMFILE`
> seed1=`printf %d $seed1`
> Is that pritnf only to strip whitespace? If yes, these two lines could be rewritten as:
> seed1=`od -A n -N 2 -t u2 $RANDOMFILE | xargs`
> (But that's of course not very important.)
Thanks for the suggestion. I updated the patch with it. I also introduced a fallback mechanism so that $RANDOM is used if /dev/random or /dev/urandom are not available
(i.e., with this patch the test works on MSYS using a bash shell).
> Typo in src/test/ngramcount_test.sh: determinitic -> deterministic.
Added a patch to fix that.
> As far as I can see, the test scripts create temporary files in an insecure way.
The scripts do not interfere each other. Instead of patching them, I defined TMPDIR to tmpdata, so that the temporary files are created in the package build directory.