diff options
author | Robert Relyea <rrelyea@redhat.com> | 2016-02-18 07:44:58 -0800 |
---|---|---|
committer | Robert Relyea <rrelyea@redhat.com> | 2016-02-18 07:44:58 -0800 |
commit | 4f2f5fae9d8548e6bdd72e800f1ad1e744814be1 (patch) | |
tree | 339642fd83cccc83d259e8b8268ffcede6763452 /cmd/fipstest/validate1.sh | |
parent | 0430632bc275b4be8104482168a8777b8d2daa3f (diff) | |
download | nss-hg-4f2f5fae9d8548e6bdd72e800f1ad1e744814be1.tar.gz |
Bug 1181814 - Pick up FIPS-140 certification work done by Red Hat, r=kaie, emaldona
- Includes modifications submitted by kaie and emaldona, r=rrelyea
Diffstat (limited to 'cmd/fipstest/validate1.sh')
-rw-r--r-- | cmd/fipstest/validate1.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cmd/fipstest/validate1.sh b/cmd/fipstest/validate1.sh new file mode 100644 index 000000000..1440af8fc --- /dev/null +++ b/cmd/fipstest/validate1.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Validate1.sh is a helper shell script that each of the base test shell +# scripts call to help validate that the generated response (response) +# matches the known answer response (fax). Sometimes (depending on the +# individual tests) there are extraneous output in either or both response +# and fax files. These allow the caller to pass in additional sed commands +# to clear out those extraneous outputs before we compare the two files. +# The sed line always clears out Windows line endings, replaces tabs with +# spaces, and removed comments. +# +TESTDIR=${1-.} +request=${2} +extraneous_response=${3} +extraneous_fax=${4} +name=`basename $request .req` +echo ">>>>> $name" +sed -e 's;
;;g' -e 's; ; ;g' -e '/^#/d' $extraneous_response ${TESTDIR}/resp/${name}.rsp > /tmp/y1 +# if we didn't generate any output, flag that as an error +size=`sum /tmp/y1 | awk '{ print $NF }'` +if [ $size -eq 0 ]; then + echo "${TESTDIR}/resp/${name}.rsp: empty" + exit 1; +fi +sed -e 's;
;;g' -e 's; ; ;g' -e '/^#/d' $extraneous_fax ${TESTDIR}/fax/${name}.fax > /tmp/y2 +diff -i -w -B /tmp/y1 /tmp/y2 |