aboutsummaryrefslogtreecommitdiffstats
path: root/asn1c/tests/check-assembly.sh
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2014-09-11 01:28:57 -0700
committerLev Walkin <vlm@lionet.info>2014-09-11 01:28:57 -0700
commite0d321a6502c3a3f567f16430bfa94cdefc63a53 (patch)
tree3e34ef803f182f5a1a3b8ca0469e4bce4e7a7552 /asn1c/tests/check-assembly.sh
parent5809ec65dd1b76b4f7bbd1c08ba93665a7a3b847 (diff)
version 0.9.26
Diffstat (limited to 'asn1c/tests/check-assembly.sh')
-rwxr-xr-xasn1c/tests/check-assembly.sh37
1 files changed, 20 insertions, 17 deletions
diff --git a/asn1c/tests/check-assembly.sh b/asn1c/tests/check-assembly.sh
index 5858f5bf..bdcc7d9f 100755
--- a/asn1c/tests/check-assembly.sh
+++ b/asn1c/tests/check-assembly.sh
@@ -10,11 +10,15 @@ if [ "x$1" = "x" ]; then
exit
fi
+set -o pipefail
+set -e
+
# 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'.'`
+source_full=$1
+source_short=`echo "$source_full" | sed -e 's/.*\///'`
+testno=`echo "$source_short" | cut -f2 -d'-' | cut -f1 -d'.'`
-args=`echo "$source" | sed -e 's/\.c[c]*$//'`
+args=`echo "$source_short" | sed -e 's/\.c[c]*$//'`
testdir=test-${args}
OFS=$IFS
@@ -24,16 +28,15 @@ shift
IFS=$OFS
AFLAGS="$@"
-touch ${testdir}-FAILED # Create this file to ease post mortem analysis
+# Assume the test fails. Will be removed when it passes well.
+touch ${testdir}-FAILED
-if [ ! -d $testdir ]; then
- mkdir $testdir || exit $?
-fi
-cd $testdir || exit $?
-rm -f ./$source 2>/dev/null
-ln -fns ../$source || exit $?
+mkdir -p $testdir
+cd $testdir
+rm -f $source_short
+ln -fns ../$source_full
-asn_module=`echo ../../../tests/${testno}-*.asn1`
+asn_module=`echo ../${top_srcdir}/tests/${testno}-*.asn1`
# Create a Makefile for the project.
cat > Makefile <<EOM
@@ -41,6 +44,7 @@ cat > Makefile <<EOM
COMMON_FLAGS= -I. -DEMIT_ASN_DEBUG
CFLAGS = \${COMMON_FLAGS} ${CFLAGS} -g -O0
+CPPFLAGS = -DSRCDIR=../${srcdir}
CXXFLAGS = \${COMMON_FLAGS} ${CXXFLAGS}
CC ?= ${CC}
@@ -48,11 +52,11 @@ CC ?= ${CC}
all: check-executable
check-executable: compiled-module *.c*
@rm -f *.core
- \$(CC) \$(CFLAGS) -o check-executable *.c* -lm
+ \$(CC) \$(CPPFLAGS) \$(CFLAGS) -o check-executable *.c* -lm
# Compile the corresponding .asn1 spec.
-compiled-module: ${asn_module} ../../asn1c
- ../../asn1c -S ../../../skeletons -Wdebug-compiler \\
+compiled-module: ${asn_module} ../${top_builddir}/asn1c/asn1c
+ ../${top_builddir}/asn1c/asn1c -S ../${top_srcdir}/skeletons -Wdebug-compiler \\
${AFLAGS} ${asn_module}
rm -f converter-sample.c
@touch compiled-module
@@ -69,8 +73,7 @@ clean:
EOM
# Perform building and checking
-make check || exit $?
+make check
+# Make sure the test is not marked as failed any longer.
rm -f ../${testdir}-FAILED
-
-exit 0