Hi,
When compiling OpenSSL (1.0.1g) on Windows using MSYS and mingw, the
test test_bn fails (make test_bn in the test/ directory).
The temporary file that test_bn creates contains Windows newline
characters (\r\n) instead of the Unix type newline character (\n).
A change to the regular expression that test_bn uses fixes this problem,
and can be used on Unix as well as Windows environments. This makes
Makefile working across all platforms.
Old test/Makefile code:
test_bn:
@echo starting big number library test, could take a while...
@../util/shlib_wrap.sh ./$(BNTEST) >tmp.bntest
@echo quit >>tmp.bntest
@echo "running bc"
@<tmp.bntest sh -c "`sh ./bctest ignore`" | perl -e '$$i=0; while
(<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif
(!/^0$$/) {die "\nFailed! bc: $$_";} else {print STDERR "."; $$i++;}}
print STDERR "\n$$i tests passed\n"'
@echo 'test a^b%c implementations'
../util/shlib_wrap.sh ./$(EXPTEST)
New test/Makefile code:
test_bn:
@echo starting big number library test, could take a while...
@../util/shlib_wrap.sh ./$(BNTEST) >tmp.bntest
@echo quit >>tmp.bntest
@echo "running bc"
@<tmp.bntest sh -c "`sh ./bctest ignore`" | perl -e '$$i=0; while
(<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif
(!/^0\r?$$/) {die "\nFailed! bc: $$_";} else {print STDERR "."; $$i++;}}
print STDERR "\n$$i tests passed\n"'
@echo 'test a^b%c implementations'
../util/shlib_wrap.sh ./$(EXPTEST)
Note the addition of \r? to the regular expression (!/^0\r?$$/) to cater
for Windows newline characters.
Please find attached the patch file (created using LC_ALL=C TZ=UTC diff
-Nur openssl-1.0.1g/ patched/ )
Could you please incorporate this patch to make sure that all tests run
successfully on Unix as well on Windows environments ?
Thanks,
Peter Mosmans
--- openssl-1.0.1g/test/Makefile 2014-04-07 16:55:44 +0000
+++ patched/test/Makefile 2014-05-06 00:07:20 +0000
@@ -227,7 +227,7 @@
@../util/shlib_wrap.sh ./$(BNTEST) >tmp.bntest
@echo quit >>tmp.bntest
@echo "running bc"
- @<tmp.bntest sh -c "`sh ./bctest ignore`" | $(PERL) -e '$$i=0; while
(<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif (!/^0$$/)
{die "\nFailed! bc: $$_";} else {print STDERR "."; $$i++;}} print STDERR "\n$$i
tests passed\n"'
+ @<tmp.bntest sh -c "`sh ./bctest ignore`" | $(PERL) -e '$$i=0; while
(<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif (!/^0\r?$$/)
{die "\nFailed! bc: $$_";} else {print STDERR "."; $$i++;}} print STDERR "\n$$i
tests passed\n"'
@echo 'test a^b%c implementations'
../util/shlib_wrap.sh ./$(EXPTEST)