summaryrefslogtreecommitdiff
path: root/tests/parser.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parser.sh')
-rwxr-xr-xtests/parser.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/parser.sh b/tests/parser.sh
new file mode 100755
index 0000000..b8924e4
--- /dev/null
+++ b/tests/parser.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Copyright (C) 2019 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+PARSER="${PARSER:-../src/asn1Parser${EXEEXT}}"
+srcdir="${srcdir:-.}"
+TMPFILE=pkix.asn.$$.tmp
+
+${PARSER} ${srcdir}/pkix.asn -o ${TMPFILE}
+
+if test $? != 0;then
+ echo "Cannot generate C file!"
+ exit 1
+fi
+
+diff --strip-trailing-cr ${TMPFILE} ${srcdir}/pkix.asn.out
+
+if test $? != 0;then
+ echo "Generated C file differs!"
+ exit 1
+fi
+
+rm -f ${TMPFILE}
+
+exit 0