aboutsummaryrefslogtreecommitdiffstats
path: root/asn1c/tests/check-assembly.sh
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-06-03 03:38:44 +0000
committerLev Walkin <vlm@lionet.info>2004-06-03 03:38:44 +0000
commitf15320bf6b50a0c02636405561ac8323ae901abd (patch)
tree33461d45122896c6dde35f82f5c7d19b62004a6b /asn1c/tests/check-assembly.sh
parent746cb60bbccf47019563665f4aec4b6c462c4163 (diff)
Initial revision
Diffstat (limited to 'asn1c/tests/check-assembly.sh')
-rwxr-xr-xasn1c/tests/check-assembly.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/asn1c/tests/check-assembly.sh b/asn1c/tests/check-assembly.sh
new file mode 100755
index 00000000..a1756b4d
--- /dev/null
+++ b/asn1c/tests/check-assembly.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+#
+# This script is designed to quickly create lots of files in underlying
+# test-* directories, do lots of other magic stuff and exit cleanly.
+#
+
+# Compute the .asn1 spec name by the given file name.
+source=$(echo "$1" | sed -e 's/.*\///')
+testno=`echo "$source" | cut -f2 -d'-' | cut -f1 -d'.'`
+
+args=$(echo "$source" | sed -e 's/\.c$//')
+testdir=test-${args}
+
+OFS=$IFS
+IFS="."
+set $args
+shift
+IFS=$OFS
+
+if [ ! -d $testdir ]; then
+ mkdir $testdir || exit $?
+fi
+cd $testdir || exit $?
+ln -fs ../$source || exit $?
+# Compile the corresponding .asn1 spec.
+set -x
+../../asn1c \
+ -S ../../../skeletons \
+ -Wdebug-compiler "$@" \
+ ../../../tests/${testno}-*.asn1 || exit $?
+set +x
+
+# Create a Makefile for the project.
+cat > Makefile <<EOM
+CFLAGS=-I. -Wall -g ${CFLAGS} -DEMIT_ASN_DEBUG
+SRCS=`echo *.c`
+OBJS=\${SRCS:.c=.o}
+check-executable: \${OBJS}
+ \${CC} \${CFLAGS} -o check-executable \${OBJS}
+.SUFFIXES:
+.SUFFIXES: .c .o
+.c.o:
+ \${CC} \${CFLAGS} -o \$@ -c \$<
+check: check-executable
+ ./check-executable
+clean:
+ @rm -f *.o
+EOM
+
+# Perform building and checking
+make check || exit $?
+
+# Uncomment this to jeopardize debugging
+# make clean
+