3 # Test diff(1) capabilities
4 diff -a . . 2>/dev/null && diffArgs="-a" # Assume text files
5 diff -u . . 2>/dev/null && diffArgs="$diffArgs -u" # Unified diff output
9 if [ "$1" != "regenerate" ]; then
15 echo "Error while processing $PROCESSING"
18 trap print_status EXIT
20 top_srcdir="${top_srcdir:-../..}"
21 top_builddir="${top_builddir:-../..}"
23 for ref in ${top_srcdir}/tests/tests-asn1c-compiler/*.asn1.-*; do
24 # Figure out the initial source file used to generate this output.
25 src=$(echo "$ref" | sed -e 's/\.-[-a-zA-Z0-9=]*$//')
26 # Figure out compiler flags used to create the file.
27 flags=$(echo "$ref" | sed -e 's/.*\.-//')
28 echo "Checking $src against $ref"
29 template=.tmp.check-parsing.$$
30 oldversion=${template}.old
31 newversion=${template}.new
32 PROCESSING="$ref (from $src)"
33 LANG=C sed -e 's/^found in .*/found in .../' < "$ref" > "$oldversion"
34 (${top_builddir}/asn1c/asn1c -S ${top_srcdir}/skeletons -no-gen-OER -no-gen-PER "-$flags" "$src" | LANG=C sed -e 's/^found in .*/found in .../' > "$newversion") || ec=$?
36 diff $diffArgs "$oldversion" "$newversion" || ec=$?
38 rm -f $oldversion $newversion
39 if [ "$1" = "regenerate" ]; then
40 ${top_builddir}/asn1c/asn1c -S ${top_srcdir}/skeletons -no-gen-OER -no-gen-PER "-$flags" "$src" > "$ref"