aboutsummaryrefslogtreecommitdiffstats
path: root/asn1c/tests/check-assembly.sh
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2016-07-02 23:33:32 +0000
committerLev Walkin <vlm@lionet.info>2016-07-02 23:33:32 +0000
commitd8cc847d8745b41de280b87f30cc72ee9e62438e (patch)
tree5f8ee798dc541a8468a7d0c5809a83aefbb1dd64 /asn1c/tests/check-assembly.sh
parent619f0cd736b579eb88a25951d8b5698aebca5f7d (diff)
working better with new automake test suite driver
Diffstat (limited to 'asn1c/tests/check-assembly.sh')
-rwxr-xr-xasn1c/tests/check-assembly.sh38
1 files changed, 26 insertions, 12 deletions
diff --git a/asn1c/tests/check-assembly.sh b/asn1c/tests/check-assembly.sh
index 9768d8e4..16529479 100755
--- a/asn1c/tests/check-assembly.sh
+++ b/asn1c/tests/check-assembly.sh
@@ -5,15 +5,26 @@
# test-* directories, do lots of other magic stuff and exit cleanly.
#
+set -e
+
if [ "x$1" = "x" ]; then
echo "Usage: $0 <check-NN.c>"
exit
fi
-set -e
+: ${srcdir=.}
+: ${abs_top_srcdir=`pwd`/../../}
+: ${abs_top_builddir=`pwd`/../../}
+
+if echo "$*" | grep -q -- -- ; then
+ TEST_DRIVER=$(echo "$*" | sed -e 's/ -- .*/--/g')
+ source_full=$(echo "$*" | sed -e 's/.* //g')
+else
+ TEST_DRIVER=""
+ source_full="$1"
+fi
# Compute the .asn1 spec name by the given file name.
-source_full=$1
source_short=`echo "$source_full" | sed -e 's/.*\///'`
testno=`echo "$source_short" | cut -f2 -d'-' | cut -f1 -d'.'`
@@ -28,17 +39,18 @@ IFS=$OFS
AFLAGS="$@"
# Assume the test fails. Will be removed when it passes well.
+if [ -f "${testdir}-FAILED" ]; then
+ rm -rf ${testdir}
+fi
touch ${testdir}-FAILED
mkdir -p $testdir
-cd $testdir
-rm -f $source_short
-ln -fns ../$source_full
+ln -fns ../$source_full $testdir
-asn_module=`echo ../${top_srcdir}/tests/${testno}-*.asn1`
+asn_module=`echo ${abs_top_srcdir}/tests/${testno}-*.asn1`
# Create a Makefile for the project.
-cat > Makefile <<EOM
+cat > $testdir/Makefile <<EOM
# This file is autogenerated by ../$0
COMMON_FLAGS= -I.
@@ -46,7 +58,7 @@ CFLAGS = \${COMMON_FLAGS} ${CFLAGS} -g -O0
CPPFLAGS = -DSRCDIR=../${srcdir}
CXXFLAGS = \${COMMON_FLAGS} ${CXXFLAGS}
-CC = ${CC}
+CC ?= ${CC}
all: check-executable
check-executable: compiled-module *.c*
@@ -54,8 +66,10 @@ check-executable: compiled-module *.c*
\$(CC) \$(CPPFLAGS) \$(CFLAGS) -o check-executable *.c* -lm
# Compile the corresponding .asn1 spec.
-compiled-module: ${asn_module} ../${top_builddir}/asn1c/asn1c
- ../${top_builddir}/asn1c/asn1c -S ../${top_srcdir}/skeletons -Wdebug-compiler \\
+compiled-module: ${asn_module} ${abs_top_builddir}/asn1c/asn1c
+ ${abs_top_builddir}/asn1c/asn1c \\
+ -S ${abs_top_srcdir}/skeletons \\
+ -Wdebug-compiler \\
${AFLAGS} ${asn_module}
rm -f converter-sample.c
@touch compiled-module
@@ -72,7 +86,7 @@ clean:
EOM
# Perform building and checking
-make check
+${TEST_DRIVER} make -C $testdir check
# Make sure the test is not marked as failed any longer.
-rm -f ../${testdir}-FAILED
+rm -f ${testdir}-FAILED