Closed Bug 303986 Opened 19 years ago Closed 19 years ago

cipher.sh doesn't report pass or fail on WIndows

Categories

(NSS :: Test, defect, P2)

3.10
x86
Windows XP
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nelson, Assigned: jason.m.reid)

Details

Attachments

(1 file)

On any Unix box, when you run the script nss/tests/cipher/cipher.sh
it tests the ciphers individually and then reports pass or fail for 
each one.  Typical output looks like this:

cipher.sh: RSA Encrypt --------------------------------
bltest -T -m rsa -E -d .
Encryption self-test for rsa passed.
cipher.sh: RSA Decrypt --------------------------------
bltest -T -m rsa -D -d .
Decryption self-test for rsa passed.
cipher.sh: DSA Sign --------------------------------
bltest -T -m dsa -S -d .
Signature self-test for dsa passed.
cipher.sh: DSA Verify --------------------------------
bltest -T -m dsa -V -d .
Verification self-test for dsa passed.


When you run that same script on Windows, it reports neither pass nor fail.

cipher.sh: RSA Encrypt --------------------------------
bltest -T -m rsa -E -d .
cipher.sh: RSA Decrypt --------------------------------
bltest -T -m rsa -D -d .
cipher.sh: DSA Sign --------------------------------
bltest -T -m dsa -S -d .
cipher.sh: DSA Verify --------------------------------
bltest -T -m dsa -V -d .

which is not very useful. 

The problem here is that if we broke one of the ciphers or hashes,
this test would not tell us, and that is its ONLY function!
This is potentially a blocker for NSS 3.11. 
It occurs for me on WinXP with mks shell.
OS: SunOS → Windows XP
Priority: -- → P2
Target Milestone: --- → 3.11
Looks like this is also broken on the 3.10 branch, according to our nightly QA
logs. Unfortunately, we don't keep archives of the nightly QA logs, so I can't
tell when this first started happening.
Attached patch Proposed patchSplinter Review
The problem is in the bltest program (blapitest.c), not
the cipher.sh script.  It turns out that the problem is
not only that the test results aren't reported but also
that the tests aren't run at all.

This is a text file ending problem.  We read a file containing
the number of tests into a SECItem.  We assume the last character
in the SECItem is '\n' and skip it, and assume that everything
else in the SECItem is a digit.  But on Windows, the line ending
is the '\r''\n' sequence, so the second-to-last character in the
SECItem is '\r'.  If we treat it as a digit and subtract '0' from
it, we get a negative numtests, so the tests aren't run.

In this patch I examine every character in the SECItem and stop
as soon as we get a non-digit.	This is more robust.

We probably should fail bltest if numtests is 0 (which means no
tests will be run), but I'll leave that to someone else.
Attachment #192137 - Flags: superreview?(julien.pierre.bugs)
Attachment #192137 - Flags: review?(nelson)
Attachment #192137 - Flags: superreview?(julien.pierre.bugs) → superreview+
Comment on attachment 192137 [details] [diff] [review]
Proposed patch

Thanks for investigating this Wan-Teh.	
Somewhere in another bug, I have a large patch to blapitest that fixes
many problems, including this one.  It is stuck awaiting review.  :(
Attachment #192137 - Flags: review?(nelson) → review+
I checked in the fix on the NSS trunk (NSS 3.11).
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: