summaryrefslogtreecommitdiffstats
path: root/security/nss/tests/policy/policy.sh
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-01-06 15:14:54 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-01-06 15:14:54 +0100
commitcc6a935ce54b573c1efd7533aff00e7bf0a9959c (patch)
treec8ad266edb7ea1e7b93aaaaa98847cf662373668 /security/nss/tests/policy/policy.sh
parentd129c900c9f943adb69c1fb20ba1a029fdd95cff (diff)
parent9f4afc2552a67cc675b8b8af2ecb8ebc04a473a7 (diff)
downloadUXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.tar
UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.tar.gz
UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.tar.lz
UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.tar.xz
UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.zip
Merge branch 'master' into Pale_Moon-release
# Conflicts: # application/palemoon/components/feeds/FeedWriter.js # application/palemoon/config/version.txt # security/manager/ssl/nsSTSPreloadList.errors # security/manager/ssl/nsSTSPreloadList.inc
Diffstat (limited to 'security/nss/tests/policy/policy.sh')
-rw-r--r--security/nss/tests/policy/policy.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/security/nss/tests/policy/policy.sh b/security/nss/tests/policy/policy.sh
new file mode 100644
index 000000000..228c982a5
--- /dev/null
+++ b/security/nss/tests/policy/policy.sh
@@ -0,0 +1,58 @@
+#! /bin/bash
+#
+# 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/.
+
+########################################################################
+#
+# mozilla/security/nss/tests/policy/policy.sh
+#
+# Script to test NSS crypto policy code
+#
+########################################################################
+
+ignore_blank_lines()
+{
+ LC_ALL=C grep -v '^[[:space:]]*\(#\|$\)' "$1"
+}
+
+policy_run_tests()
+{
+ html_head "CRYPTO-POLICY"
+
+ POLICY_INPUT=${QADIR}/policy/crypto-policy.txt
+
+ ignore_blank_lines ${POLICY_INPUT} | \
+ while read value policy match testname
+ do
+ echo "$SCRIPTNAME: running \"$testname\" ----------------------------"
+ policy=`echo ${policy} | sed -e 's;_; ;g'`
+ match=`echo ${match} | sed -e 's;_; ;g'`
+ POLICY_FILE="${TMP}/nss-policy"
+
+ echo "$SCRIPTNAME: policy: \"$policy\""
+
+ cat > "$POLICY_FILE" << ++EOF++
+library=
+name=Policy
+NSS=flags=policyOnly,moduleDB
+++EOF++
+ echo "config=\"${policy}\"" >> "$POLICY_FILE"
+ echo "" >> "$POLICY_FILE"
+
+ nss-policy-check "$POLICY_FILE" >${TMP}/$HOST.tmp.$$ 2>&1
+ ret=$?
+ cat ${TMP}/$HOST.tmp.$$
+
+ html_msg $ret $value "\"${testname}\"" \
+ "produced a returncode of $ret, expected is $value"
+
+ egrep "${match}" ${TMP}/$HOST.tmp.$$
+ ret=$?
+ html_msg $ret 0 "\"${testname}\" output is expected to match \"${match}\""
+
+ done
+}
+
+policy_run_tests