Clean up the crud supporting passed/failed count global variables as files.

Fetch the values from the files at the end of runComplexTests, rather
than at the beginning of runSimpleTests - they're already set to 0 if
you haven't run runComplexTests.

Set the variables to 0 right before writing their values to the files,
just to make it clearer that they're both being initialized to 0.

Read the files unconditionally in tests/crypto.sh, as we do tests
regardless of whether we were built with libcrypto or not.
diff --git a/tests/TESTrun.sh b/tests/TESTrun.sh
index 6449082..21aa0d9 100755
--- a/tests/TESTrun.sh
+++ b/tests/TESTrun.sh
@@ -2,8 +2,6 @@
 
 mkdir -p NEW
 mkdir -p DIFF
-passed=0
-failed=0
 cat /dev/null > failure-outputs.txt
 
 runComplexTests()
@@ -13,12 +11,12 @@
     case $i in TEST*.sh) continue;; esac
     sh ./$i
   done
+  passed=`cat .passed`
+  failed=`cat .failed`
 }
 
 runSimpleTests()
 {
-  passed=`cat .passed`
-  failed=`cat .failed`
   only=$1
   cat TESTLIST | while read name input output options
   do
@@ -43,6 +41,8 @@
   failed=`cat .failed`
 }
 
+passed=0
+failed=0
 echo $passed >.passed
 echo $failed >.failed
 if [ $# -eq 0 ]
diff --git a/tests/crypto.sh b/tests/crypto.sh
index 16a2855..b4277e4 100755
--- a/tests/crypto.sh
+++ b/tests/crypto.sh
@@ -1,13 +1,13 @@
 #!/bin/sh
 
 exitcode=0
+passed=`cat .passed`
+failed=`cat .failed`
 
 # Only attempt OpenSSL-specific tests when compiled with the library.
 
 if grep '^#define HAVE_LIBCRYPTO 1$' ../config.h >/dev/null
 then
-	passed=`cat .passed`
-	failed=`cat .failed`
 	if ./TESTonce esp1 02-sunrise-sunset-esp.pcap esp1.out '-E "0x12345678@192.1.2.45 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
 	then
 		passed=`expr $passed + 1`