simpler makefile generation

This commit is contained in:
Lev Walkin 2017-10-08 22:36:29 -07:00
parent 45bae08c71
commit 40b8a7ae99
16 changed files with 281 additions and 429 deletions

View File

@ -1,33 +1,34 @@
#!/bin/sh #!/bin/sh
# #
# This script attempts to compile the given ASN.1 specification and then # This script attempts to compile the given ASN.1 specification by first
# transforms the resulting Makefile.am.example tailored to that specification # building the specialized Makefile.
# into a customized Makefile.
# #
# The information which is necessary for this script is passed from the # The information which is necessary for this script is passed from the
# Makefile which is going to be replaced with an updated Makefile. # Makefile which is going to be replaced with an updated Makefile.
# #
if test -z "$ASN1PDU" \ if test -z "$ASN_PDU" \
-o -z "$ASN1MODULES" \ -o -z "$ASN_MODULES" \
-o -z "$PROGNAME" \ -o -z "$ASN_PROGRAM" \
; then ; then
echo "ASN1CMDOPTS=\"$ASN1CMDOPTS\"" cat <<-NOTE
echo "ASN1MODULES=\"$ASN1MODULES\"" ASN_CMDOPTS="$ASN_CMDOPTS"
echo "ASN1PDU=\"$ASN1PDU\"" ASN_MODULES="$ASN_MODULES"
echo "PROGNAME=\"$PROGNAME\"" ASN_PDU="$ASN_PDU"
echo "ASN1PDU, ASN1MODULES, and PROGNAME are mandatory" ASN_PROGRAM="$ASN_PROGRAM"
exit ASN_PDU, ASN_MODULES, and ASN_PROGRAM are mandatory.
NOTE
exit 1
fi fi
CMDOPTS="-pdu=${ASN1PDU} ${ASN1CMDOPTS} ${ASN1MODULES}" EFFECTIVE_CMDOPTS="-pdu=${ASN_PDU} ${ASN_CMDOPTS} ${ASN_MODULES}"
if test -x ../../asn1c/asn1c ; then if test -x ../../asn1c/asn1c ; then
echo "Compiling ${ASN1MODULES} using local compiler" echo "Compiling ${ASN_MODULES} using local compiler"
../../asn1c/asn1c -S ../../skeletons ${CMDOPTS} || exit $? ../../asn1c/asn1c -S ../../skeletons ${EFFECTIVE_CMDOPTS} || exit $?
else else
echo "Compiling ${ASN1MODULES} using system compiler" echo "Compiling ${ASN_MODULES} using system compiler"
asn1c ${CMDOPTS} || exit $? asn1c ${EFFECTIVE_CMDOPTS} || exit $?
fi fi
if test ! -f Makefile.am.example ; then if test ! -f Makefile.am.example ; then
@ -39,107 +40,104 @@ EXTRA_CFLAGS="-DJUNKTEST -D_DEFAULT_SOURCE"
test -f config.h && EXTRA_CFLAGS="-DHAVE_CONFIG_H ${EXTRA_CFLAGS}" test -f config.h && EXTRA_CFLAGS="-DHAVE_CONFIG_H ${EXTRA_CFLAGS}"
test -n "$TITLE" && EXTRA_CFLAGS="-DASN_CONVERTER_TITLE=\"$TITLE\" ${EXTRA_CFLAGS}" test -n "$TITLE" && EXTRA_CFLAGS="-DASN_CONVERTER_TITLE=\"$TITLE\" ${EXTRA_CFLAGS}"
set -x {
cat Makefile.am.example \ echo "ASN_PROGRAM = ${ASN_PROGRAM}"
| sed -e "s/^include /-include /" \ echo "CFLAGS += ${EXTRA_CFLAGS}"
| sed -e "s/^TARGET = converter-example/TARGET = ${PROGNAME}/" \ echo "begin: ${ASN_PDU}.c maybe-wip-pause all"
| sed -e "s/^CFLAGS += /CFLAGS += ${EXTRA_CFLAGS} /" \ echo
| sed -e "s/^all: /all: maybe-wip-pause ${ASN1PDU}.c /" \ echo "-include Makefile.am.example"
> Makefile.$$ echo
set +x echo "${ASN_PDU}.c: $0 ${ASN_MODULES}"
( echo
echo "${ASN1PDU}.c: $0 ${ASN1MODULES}"
echo " make regen-makefile" echo " make regen-makefile"
echo " @touch ${ASN1PDU}.c" echo " @touch ${ASN_PDU}.c"
echo " make" echo " make"
echo echo
echo "regen-makefile:" echo "regen-makefile:"
test -n "$TITLE" && echo " TITLE=\"$TITLE\" \\" test -n "$TITLE" && echo " TITLE=\"$TITLE\" \\"
echo " ASN1CMDOPTS=\"${ASN1CMDOPTS}\" \\" echo " ASN_CMDOPTS=\"${ASN_CMDOPTS}\" \\"
echo " ASN1MODULES=\"${ASN1MODULES}\" \\" echo " ASN_MODULES=\"${ASN_MODULES}\" \\"
echo " ASN1PDU=${ASN1PDU} \\" echo " ASN_PDU=${ASN_PDU} \\"
echo " PROGNAME=${PROGNAME} \\" echo " ASN_PROGRAM=${ASN_PROGRAM} \\"
echo " $0" echo " $0"
echo echo
echo 'check: ${TARGET} check-ber check-xer check-oer check-per' echo 'check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per'
echo ' @echo ================' echo ' @echo ================'
echo ' @echo All tests passed' echo ' @echo All tests passed'
echo ' @echo ================' echo ' @echo ================'
echo echo
echo 'check-ber:' echo 'check-ber:'
echo " @if test -f sample-${ASN1PDU}-1.[db]er ; then \\" echo " @if test -f sample-${ASN_PDU}-1.[db]er ; then \\"
echo " for f in sample-*-*.[db]er; do \\" echo " for f in sample-*-*.[db]er; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \' echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \' echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \' echo ' echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \'
echo ' ./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \'
echo ' ./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \'
echo ' diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \' echo ' diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \'
echo ' rm -f ./.tmp.[12].$$$$; \' echo ' rm -f ./.tmp.[12].$$$$; \'
echo ' echo "Test junking $$f (please wait)..."; \' echo ' echo "Test junking $$f (please wait)..."; \'
echo ' ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \' echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \'
echo ' ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \' echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \'
echo ' done; done; fi' echo ' done; done; fi'
echo echo
echo 'check-xer:' echo 'check-xer:'
echo " @if test -f sample-${ASN1PDU}-1.xer ; then \\" echo " @if test -f sample-${ASN_PDU}-1.xer ; then \\"
echo " for f in sample-*-*.xer; do \\" echo " for f in sample-*-*.xer; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \' echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \' echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \' echo ' echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \'
echo ' ./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \'
echo ' ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \'
echo ' diff $$f ./.tmp.2.$$$$ || exit 4; \' echo ' diff $$f ./.tmp.2.$$$$ || exit 4; \'
echo ' rm -f ./.tmp.[12].$$$$; \' echo ' rm -f ./.tmp.[12].$$$$; \'
echo ' echo "Test junking $$f (please wait)..."; \' echo ' echo "Test junking $$f (please wait)..."; \'
echo ' ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \' echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \'
echo ' ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \' echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \'
echo ' done; done; fi' echo ' done; done; fi'
echo echo
echo 'check-oer:' echo 'check-oer:'
echo " @if test -f sample-${ASN1PDU}-1.*oer ; then \\" echo " @if test -f sample-${ASN_PDU}-1.*oer ; then \\"
echo " for f in sample-*-*.*oer; do \\" echo " for f in sample-*-*.*oer; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \' echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \' echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \' echo ' echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \'
echo ' ./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \'
echo ' ./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \'
echo ' diff $$f ./.tmp.2.$$$$ || exit 4; \' echo ' diff $$f ./.tmp.2.$$$$ || exit 4; \'
echo ' rm -f ./.tmp.[12].$$$$; \' echo ' rm -f ./.tmp.[12].$$$$; \'
echo ' echo "Test junking $$f (please wait) ($$b) ..."; \' echo ' echo "Test junking $$f (please wait) ($$b) ..."; \'
echo ' ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \' echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \'
echo ' ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \' echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \'
echo ' done; done; fi' echo ' done; done; fi'
echo echo
echo 'check-per:' echo 'check-per:'
echo " @if test -f sample-${ASN1PDU}-1-nopad.per ; then \\" echo " @if test -f sample-${ASN_PDU}-1-nopad.per ; then \\"
echo " for f in sample-*-[1-9]-nopad.per; do \\" echo " for f in sample-*-[1-9]-nopad.per; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \' echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \' echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \' echo ' echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \'
echo ' ./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \'
echo ' ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \'
echo ' ./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \'
echo ' diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \' echo ' diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \'
echo ' rm -f ./.tmp.[123].$$$$; \' echo ' rm -f ./.tmp.[123].$$$$; \'
echo ' echo "Test junking $$f (please wait)..."; \' echo ' echo "Test junking $$f (please wait)..."; \'
echo ' ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \' echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \'
echo ' ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \' echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \'
echo ' done; done; fi' echo ' done; done; fi'
echo " @if test -f sample-${ASN1PDU}-1.per ; then \\" echo " @if test -f sample-${ASN_PDU}-1.per ; then \\"
echo " for f in sample-*-[1-9].per; do \\" echo " for f in sample-*-[1-9].per; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \' echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \' echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \' echo ' echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \'
echo ' ./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \'
echo ' ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \'
echo ' ./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \' echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \'
echo ' diff $$f ./.tmp.1.$$$$ || exit 6; \' echo ' diff $$f ./.tmp.1.$$$$ || exit 6; \'
echo ' rm -f ./.tmp.[12].$$$$; \' echo ' rm -f ./.tmp.[12].$$$$; \'
echo ' echo "Test junking $$f (please wait)..."; \' echo ' echo "Test junking $$f (please wait)..."; \'
echo ' ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \' echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \'
echo ' ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \' echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \'
echo ' done; done; fi' echo ' done; done; fi'
echo echo
echo "maybe-wip-pause:" echo "maybe-wip-pause:"
@ -148,14 +146,9 @@ set +x
echo "distclean: clean" echo "distclean: clean"
echo ' rm -f $(ASN_MODULE_SOURCES)' echo ' rm -f $(ASN_MODULE_SOURCES)'
echo ' rm -f $(ASN_MODULE_HEADERS)' echo ' rm -f $(ASN_MODULE_HEADERS)'
echo ' rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)' echo ' rm -f $(ASN_PROGRAM_SOURCES) $(ASN_PROGRAM_HEADERS)'
echo " rm -f Makefile.am.example" echo " rm -f Makefile.am.example"
) >> Makefile.$$ } > Makefile
set -x
mv Makefile.$$ Makefile || exit $?
rm Makefile.am.example || exit $?
set +x
echo echo
echo "Makefile generation finished" echo "Makefile generation finished"

View File

@ -1,36 +1,8 @@
-include Makefile.am.libasncodec ASN_PROGRAM = 1609-2-dump
CFLAGS += -DASN_CONVERTER_TITLE="IEEE 1609.2-2016 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
TARGET = 1609-2-dump begin: Certificate.c maybe-wip-pause all
ASN_LIBRARY=libasncodec.a
LIBS += -lm
CFLAGS += -DASN_CONVERTER_TITLE="IEEE 1609.2-2016 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=Certificate -DASN_PDU_COLLECTION -I.
ASN_CONVERTER_SOURCES = \
converter-example.c\
pdu_collection.c
all: maybe-wip-pause Certificate.c $(TARGET)
$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
$(AR) rcs $@ $^
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -o $@ -c $<
clean:
rm -f $(TARGET) $(ASN_LIBRARY)
rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
regen: regenerate-from-asn1-source
regenerate-from-asn1-source:
../../asn1c/asn1c -S ../../skeletons -pdu=Certificate -pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER ../IEEE-1609.2-2016.asn1
-include Makefile.am.example
Certificate.c: ../sample.makefile.regen ../IEEE-1609.2-2016.asn1 Certificate.c: ../sample.makefile.regen ../IEEE-1609.2-2016.asn1
make regen-makefile make regen-makefile
@ -39,13 +11,13 @@ Certificate.c: ../sample.makefile.regen ../IEEE-1609.2-2016.asn1
regen-makefile: regen-makefile:
TITLE="IEEE 1609.2-2016 decoder" \ TITLE="IEEE 1609.2-2016 decoder" \
ASN1CMDOPTS="-pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER" \ ASN_CMDOPTS="-pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER" \
ASN1MODULES="../IEEE-1609.2-2016.asn1" \ ASN_MODULES="../IEEE-1609.2-2016.asn1" \
ASN1PDU=Certificate \ ASN_PDU=Certificate \
PROGNAME=1609-2-dump \ ASN_PROGRAM=1609-2-dump \
../sample.makefile.regen ../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-oer check-per check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
@echo ================ @echo ================
@echo All tests passed @echo All tests passed
@echo ================ @echo ================
@ -56,13 +28,13 @@ check-ber:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
done; done; fi done; done; fi
check-xer: check-xer:
@ -71,13 +43,13 @@ check-xer:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \ diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
done; done; fi done; done; fi
check-oer: check-oer:
@ -86,13 +58,13 @@ check-oer:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \ diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait) ($$b) ..."; \ echo "Test junking $$f (please wait) ($$b) ..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
done; done; fi done; done; fi
check-per: check-per:
@ -101,28 +73,28 @@ check-per:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \ echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
rm -f ./.tmp.[123].$$$$; \ rm -f ./.tmp.[123].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
done; done; fi done; done; fi
@if test -f sample-Certificate-1.per ; then \ @if test -f sample-Certificate-1.per ; then \
for f in sample-*-[1-9].per; do \ for f in sample-*-[1-9].per; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
diff $$f ./.tmp.1.$$$$ || exit 6; \ diff $$f ./.tmp.1.$$$$ || exit 6; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
done; done; fi done; done; fi
maybe-wip-pause: maybe-wip-pause:
@ -131,5 +103,5 @@ maybe-wip-pause:
distclean: clean distclean: clean
rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_SOURCES)
rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_MODULE_HEADERS)
rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f $(ASN_PROGRAM_SOURCES) $(ASN_PROGRAM_HEADERS)
rm -f Makefile.am.example rm -f Makefile.am.example

View File

@ -1,36 +1,8 @@
-include Makefile.am.libasncodec ASN_PROGRAM = j2735-dump
CFLAGS += -DASN_CONVERTER_TITLE="J2735 DSRC decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
TARGET = j2735-dump begin: MessageFrame.c maybe-wip-pause all
ASN_LIBRARY=libasncodec.a
LIBS += -lm
CFLAGS += -DASN_CONVERTER_TITLE="J2735 DSRC decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=MessageFrame -DASN_PDU_COLLECTION -I.
ASN_CONVERTER_SOURCES := \
converter-example.c\
pdu_collection.c
all: maybe-wip-pause MessageFrame.c $(TARGET)
$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
$(AR) rcs $@ $^
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -o $@ -c $<
clean:
rm -f $(TARGET) $(ASN_LIBRARY)
rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
regen: regenerate-from-asn1-source
regenerate-from-asn1-source:
../../asn1c/asn1c -S ../../skeletons -pdu=MessageFrame -fcompound-names -gen-PER -pdu=all ../J2735_201603.asn1
-include Makefile.am.example
MessageFrame.c: ../sample.makefile.regen ../J2735_201603.asn1 MessageFrame.c: ../sample.makefile.regen ../J2735_201603.asn1
make regen-makefile make regen-makefile
@ -39,13 +11,13 @@ MessageFrame.c: ../sample.makefile.regen ../J2735_201603.asn1
regen-makefile: regen-makefile:
TITLE="J2735 DSRC decoder" \ TITLE="J2735 DSRC decoder" \
ASN1CMDOPTS="-fcompound-names -gen-PER -pdu=all" \ ASN_CMDOPTS="-fcompound-names -gen-PER -pdu=all" \
ASN1MODULES="../J2735_201603.asn1" \ ASN_MODULES="../J2735_201603.asn1" \
ASN1PDU=MessageFrame \ ASN_PDU=MessageFrame \
PROGNAME=j2735-dump \ ASN_PROGRAM=j2735-dump \
../sample.makefile.regen ../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-oer check-per check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
@echo ================ @echo ================
@echo All tests passed @echo All tests passed
@echo ================ @echo ================
@ -56,13 +28,13 @@ check-ber:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
done; done; fi done; done; fi
check-xer: check-xer:
@ -71,13 +43,13 @@ check-xer:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \ diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
done; done; fi done; done; fi
check-oer: check-oer:
@ -86,13 +58,13 @@ check-oer:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \ diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait) ($$b) ..."; \ echo "Test junking $$f (please wait) ($$b) ..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
done; done; fi done; done; fi
check-per: check-per:
@ -101,28 +73,28 @@ check-per:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \ echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
rm -f ./.tmp.[123].$$$$; \ rm -f ./.tmp.[123].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
done; done; fi done; done; fi
@if test -f sample-MessageFrame-1.per ; then \ @if test -f sample-MessageFrame-1.per ; then \
for f in sample-*-[1-9].per; do \ for f in sample-*-[1-9].per; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
diff $$f ./.tmp.1.$$$$ || exit 6; \ diff $$f ./.tmp.1.$$$$ || exit 6; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
done; done; fi done; done; fi
maybe-wip-pause: maybe-wip-pause:
@ -131,5 +103,5 @@ maybe-wip-pause:
distclean: clean distclean: clean
rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_SOURCES)
rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_MODULE_HEADERS)
rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f $(ASN_PROGRAM_SOURCES) $(ASN_PROGRAM_HEADERS)
rm -f Makefile.am.example rm -f Makefile.am.example

View File

@ -1,35 +1,8 @@
-include Makefile.am.libasncodec ASN_PROGRAM = ldap3dump
CFLAGS += -DASN_CONVERTER_TITLE="Lightweight Directory Access Protocol V3 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
TARGET = ldap3dump begin: LDAPMessage.c maybe-wip-pause all
ASN_LIBRARY=libasncodec.a
LIBS += -lm
CFLAGS += -DASN_CONVERTER_TITLE="Lightweight Directory Access Protocol V3 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=LDAPMessage -I.
ASN_CONVERTER_SOURCES = \
converter-example.c
all: maybe-wip-pause LDAPMessage.c $(TARGET)
$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
$(AR) rcs $@ $(ASN_MODULE_SOURCES:.c=.o)
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -o $@ -c $<
clean:
rm -f $(TARGET) $(ASN_LIBRARY)
rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
regen: regenerate-from-asn1-source
regenerate-from-asn1-source:
../../asn1c/asn1c -S ../../skeletons -pdu=LDAPMessage -fcompound-names ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1
-include Makefile.am.example
LDAPMessage.c: ../sample.makefile.regen ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1 LDAPMessage.c: ../sample.makefile.regen ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1
make regen-makefile make regen-makefile
@ -38,13 +11,13 @@ LDAPMessage.c: ../sample.makefile.regen ../rfc4511-Lightweight-Directory-Access-
regen-makefile: regen-makefile:
TITLE="Lightweight Directory Access Protocol V3 decoder" \ TITLE="Lightweight Directory Access Protocol V3 decoder" \
ASN1CMDOPTS="-fcompound-names" \ ASN_CMDOPTS="-fcompound-names" \
ASN1MODULES="../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1" \ ASN_MODULES="../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1" \
ASN1PDU=LDAPMessage \ ASN_PDU=LDAPMessage \
PROGNAME=ldap3dump \ ASN_PROGRAM=ldap3dump \
../sample.makefile.regen ../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-oer check-per check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
@echo ================ @echo ================
@echo All tests passed @echo All tests passed
@echo ================ @echo ================
@ -52,76 +25,76 @@ check: ${TARGET} check-ber check-xer check-oer check-per
check-ber: check-ber:
@if test -f sample-LDAPMessage-1.[db]er ; then \ @if test -f sample-LDAPMessage-1.[db]er ; then \
for f in sample-*-*.[db]er; do \ for f in sample-*-*.[db]er; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
done; done; fi done; done; fi
check-xer: check-xer:
@if test -f sample-LDAPMessage-1.xer ; then \ @if test -f sample-LDAPMessage-1.xer ; then \
for f in sample-*-*.xer; do \ for f in sample-*-*.xer; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \ diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
done; done; fi done; done; fi
check-oer: check-oer:
@if test -f sample-LDAPMessage-1.*oer ; then \ @if test -f sample-LDAPMessage-1.*oer ; then \
for f in sample-*-*.*oer; do \ for f in sample-*-*.*oer; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \ diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait) ($$b) ..."; \ echo "Test junking $$f (please wait) ($$b) ..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
done; done; fi done; done; fi
check-per: check-per:
@if test -f sample-LDAPMessage-1-nopad.per ; then \ @if test -f sample-LDAPMessage-1-nopad.per ; then \
for f in sample-*-[1-9]-nopad.per; do \ for f in sample-*-[1-9]-nopad.per; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \ echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
rm -f ./.tmp.[123].$$$$; \ rm -f ./.tmp.[123].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
done; done; fi done; done; fi
@if test -f sample-LDAPMessage-1.per ; then \ @if test -f sample-LDAPMessage-1.per ; then \
for f in sample-*-[1-9].per; do \ for f in sample-*-[1-9].per; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
diff $$f ./.tmp.1.$$$$ || exit 6; \ diff $$f ./.tmp.1.$$$$ || exit 6; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
done; done; fi done; done; fi
maybe-wip-pause: maybe-wip-pause:
@ -130,5 +103,5 @@ maybe-wip-pause:
distclean: clean distclean: clean
rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_SOURCES)
rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_MODULE_HEADERS)
rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f $(ASN_PROGRAM_SOURCES) $(ASN_PROGRAM_HEADERS)
rm -f Makefile.am.example rm -f Makefile.am.example

View File

@ -3608,10 +3608,10 @@ DL-DCCH-Message.c: ../sample.makefile.regen ../lte-rrc-14.2.1.asn1
make make
regen-makefile: regen-makefile:
ASN1CMDOPTS="-pdu=auto -fcompound-names -gen-PER" \ ASN_CMDOPTS="-pdu=auto -fcompound-names -gen-PER" \
ASN1MODULES="../lte-rrc-14.2.1.asn1" \ ASN_MODULES="../lte-rrc-14.2.1.asn1" \
ASN1PDU=DL-DCCH-Message \ ASN_PDU=DL-DCCH-Message \
PROGNAME=lte-rrc-dump \ ASN_PROGRAM=lte-rrc-dump \
CFLAGS="" \ CFLAGS="" \
../sample.makefile.regen ../sample.makefile.regen

View File

@ -37,10 +37,10 @@ MegacoMessage.c: ../sample.makefile.regen ../rfc3525-MEDIA-GATEWAY-CONTROL.asn1
make make
regen-makefile: regen-makefile:
ASN1CMDOPTS="-fcompound-names" \ ASN_CMDOPTS="-fcompound-names" \
ASN1MODULES="../rfc3525-MEDIA-GATEWAY-CONTROL.asn1" \ ASN_MODULES="../rfc3525-MEDIA-GATEWAY-CONTROL.asn1" \
ASN1PDU=MegacoMessage \ ASN_PDU=MegacoMessage \
PROGNAME=megaco-dump \ ASN_PROGRAM=megaco-dump \
../sample.makefile.regen ../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-oer check-per check: ${TARGET} check-ber check-xer check-oer check-per

View File

@ -477,10 +477,10 @@ InterchangedObject.c: ../sample.makefile.regen ../ISO13522-MHEG-5.asn
make make
regen-makefile: regen-makefile:
ASN1CMDOPTS="-fcompound-names" \ ASN_CMDOPTS="-fcompound-names" \
ASN1MODULES="../ISO13522-MHEG-5.asn" \ ASN_MODULES="../ISO13522-MHEG-5.asn" \
ASN1PDU=InterchangedObject \ ASN_PDU=InterchangedObject \
PROGNAME=mheg5dump \ ASN_PROGRAM=mheg5dump \
CFLAGS="" \ CFLAGS="" \
../sample.makefile.regen ../sample.makefile.regen

View File

@ -1,35 +1,8 @@
-include Makefile.am.libasncodec ASN_PROGRAM = x509dump
CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
TARGET = x509dump begin: Certificate.c maybe-wip-pause all
ASN_LIBRARY=libasncodec.a
LIBS += -lm
CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=Certificate -I.
ASN_CONVERTER_SOURCES := \
converter-example.c
all: maybe-wip-pause Certificate.c $(TARGET)
$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
$(AR) rcs $@ $^
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -o $@ -c $<
clean:
rm -f $(TARGET) $(ASN_LIBRARY)
rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
regen: regenerate-from-asn1-source
regenerate-from-asn1-source:
../../asn1c/asn1c -S ../../skeletons -pdu=Certificate -fcompound-names -fwide-types ../rfc3280-PKIX1Explicit88.asn1 ../rfc3280-PKIX1Implicit88.asn1
-include Makefile.am.example
Certificate.c: ../sample.makefile.regen ../rfc3280-*.asn1 Certificate.c: ../sample.makefile.regen ../rfc3280-*.asn1
make regen-makefile make regen-makefile
@ -37,13 +10,13 @@ Certificate.c: ../sample.makefile.regen ../rfc3280-*.asn1
make make
regen-makefile: regen-makefile:
ASN1CMDOPTS="-fcompound-names -fwide-types" \ ASN_CMDOPTS="-fcompound-names -fwide-types" \
ASN1MODULES="../rfc3280-*.asn1" \ ASN_MODULES="../rfc3280-*.asn1" \
ASN1PDU=Certificate \ ASN_PDU=Certificate \
PROGNAME=x509dump \ ASN_PROGRAM=x509dump \
../sample.makefile.regen ../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-oer check-per check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
@echo ================ @echo ================
@echo All tests passed @echo All tests passed
@echo ================ @echo ================
@ -54,13 +27,13 @@ check-ber:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
done; done; fi done; done; fi
check-xer: check-xer:
@ -69,13 +42,13 @@ check-xer:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \ diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
done; done; fi done; done; fi
check-oer: check-oer:
@ -84,13 +57,13 @@ check-oer:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \ diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait) ($$b) ..."; \ echo "Test junking $$f (please wait) ($$b) ..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
done; done; fi done; done; fi
check-per: check-per:
@ -99,28 +72,28 @@ check-per:
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \ echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
rm -f ./.tmp.[123].$$$$; \ rm -f ./.tmp.[123].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
done; done; fi done; done; fi
@if test -f sample-Certificate-1.per ; then \ @if test -f sample-Certificate-1.per ; then \
for f in sample-*-[1-9].per; do \ for f in sample-*-[1-9].per; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \ for b in 1 17 33 980 8192; do \
echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \ echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
diff $$f ./.tmp.1.$$$$ || exit 6; \ diff $$f ./.tmp.1.$$$$ || exit 6; \
rm -f ./.tmp.[12].$$$$; \ rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \ echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \ ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \ ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
done; done; fi done; done; fi
maybe-wip-pause: maybe-wip-pause:
@ -129,5 +102,5 @@ maybe-wip-pause:
distclean: clean distclean: clean
rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_SOURCES)
rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_MODULE_HEADERS)
rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f $(ASN_PROGRAM_SOURCES) $(ASN_PROGRAM_HEADERS)
rm -f Makefile.am.example rm -f Makefile.am.example

View File

@ -38,10 +38,10 @@ DL-DCCH-Message.c: ../sample.makefile.regen ../rrc-7.1.0.asn1
make make
regen-makefile: regen-makefile:
ASN1CMDOPTS="-pdu=auto -fcompound-names -gen-PER" \ ASN_CMDOPTS="-pdu=auto -fcompound-names -gen-PER" \
ASN1MODULES="../rrc-7.1.0.asn1" \ ASN_MODULES="../rrc-7.1.0.asn1" \
ASN1PDU=DL-DCCH-Message \ ASN_PDU=DL-DCCH-Message \
PROGNAME=rrc-dump \ ASN_PROGRAM=rrc-dump \
../sample.makefile.regen ../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-oer check-per check: ${TARGET} check-ber check-xer check-oer check-per

View File

@ -38,10 +38,10 @@ DataInterChange.c: ../sample.makefile.regen ../tap3.asn1
regen-makefile: regen-makefile:
TITLE="GSM TAP3 (Transferred Account Procedure, Version 3) decoder" \ TITLE="GSM TAP3 (Transferred Account Procedure, Version 3) decoder" \
ASN1CMDOPTS="" \ ASN_CMDOPTS="" \
ASN1MODULES="../tap3.asn1" \ ASN_MODULES="../tap3.asn1" \
ASN1PDU=DataInterChange \ ASN_PDU=DataInterChange \
PROGNAME=tap3dump \ ASN_PROGRAM=tap3dump \
../sample.makefile.regen ../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-oer check-per check: ${TARGET} check-ber check-xer check-oer check-per

View File

@ -39,10 +39,10 @@ ULP-PDU.c: ../sample.makefile.regen ../ulp.asn1
regen-makefile: regen-makefile:
TITLE="OMA UserPlane Location Protocol decoder" \ TITLE="OMA UserPlane Location Protocol decoder" \
ASN1CMDOPTS="-pdu=SUPLINIT -fcompound-names -gen-PER" \ ASN_CMDOPTS="-pdu=SUPLINIT -fcompound-names -gen-PER" \
ASN1MODULES="../ulp.asn1" \ ASN_MODULES="../ulp.asn1" \
ASN1PDU=ULP-PDU \ ASN_PDU=ULP-PDU \
PROGNAME=ulp-dump \ ASN_PROGRAM=ulp-dump \
../sample.makefile.regen ../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-oer check-per check: ${TARGET} check-ber check-xer check-oer check-per

View File

@ -159,11 +159,11 @@ asn1c__save_example_makefile(arg_t *arg, const asn1c_fdeps_t *deps,
safe_fprintf( safe_fprintf(
mkf, mkf,
"include %s\n\n" "include %s\n\n"
"TARGET = converter-example\n"
"ASN_LIBRARY=libasncodec.a\n"
"LIBS += -lm\n" "LIBS += -lm\n"
"CFLAGS += $(ASN_MODULE_CFLAGS) %s%s-I.\n" "CFLAGS += $(ASN_MODULE_CFLAGS) %s%s-I.\n"
"ASN_CONVERTER_SOURCES = ", "ASN_LIBRARY ?= libasncodec.a\n"
"ASN_PROGRAM ?= converter-example\n"
"ASN_PROGRAM_SOURCES ?= ",
library_makefile_name, library_makefile_name,
(arg->flags & A1C_PDU_TYPE) ? generate_pdu_C_definition() : "", (arg->flags & A1C_PDU_TYPE) ? generate_pdu_C_definition() : "",
need_to_generate_pdu_collection(arg) ? "-DASN_PDU_COLLECTION " : ""); need_to_generate_pdu_collection(arg) ? "-DASN_PDU_COLLECTION " : "");
@ -187,9 +187,9 @@ asn1c__save_example_makefile(arg_t *arg, const asn1c_fdeps_t *deps,
safe_fprintf( safe_fprintf(
mkf, mkf,
"\n\nall: $(TARGET)\n" "\n\nall: $(ASN_PROGRAM)\n"
"\n$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)" "\n$(ASN_PROGRAM): $(ASN_LIBRARY) $(ASN_PROGRAM_SOURCES:.c=.o)"
"\n\t$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)\n" "\n\t$(CC) $(CFLAGS) $(CPPFLAGS) -o $(ASN_PROGRAM) $(ASN_PROGRAM_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)\n"
"\n$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)" "\n$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)"
"\n\t$(AR) rcs $@ $(ASN_MODULE_SOURCES:.c=.o)\n" "\n\t$(AR) rcs $@ $(ASN_MODULE_SOURCES:.c=.o)\n"
"\n.SUFFIXES:" "\n.SUFFIXES:"
@ -198,7 +198,7 @@ asn1c__save_example_makefile(arg_t *arg, const asn1c_fdeps_t *deps,
"\n\t$(CC) $(CFLAGS) -o $@ -c $<\n" "\n\t$(CC) $(CFLAGS) -o $@ -c $<\n"
"\nclean:" "\nclean:"
"\n\trm -f $(TARGET) $(ASN_LIBRARY)" "\n\trm -f $(TARGET) $(ASN_LIBRARY)"
"\n\trm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)\n" "\n\trm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_PROGRAM_SOURCES:.c=.o)\n"
"\nregen: regenerate-from-asn1-source\n" "\nregen: regenerate-from-asn1-source\n"
"\nregenerate-from-asn1-source:\n\t"); "\nregenerate-from-asn1-source:\n\t");

View File

@ -44,7 +44,6 @@ TESTS += check-src/check-39.c
TESTS += check-src/check-41.-fwide-types.c TESTS += check-src/check-41.-fwide-types.c
TESTS += check-src/check-41.c TESTS += check-src/check-41.c
TESTS += check-src/check-42.c TESTS += check-src/check-42.c
TESTS += check-src/check-42.-fwide-types.cc
TESTS += check-src/check-43.c TESTS += check-src/check-43.c
TESTS += check-src/check-44.c TESTS += check-src/check-44.c
TESTS += check-src/check-46.c TESTS += check-src/check-46.c
@ -72,8 +71,7 @@ EXTRA_DIST = \
data-119 \ data-119 \
data-126 \ data-126 \
check-src/check64-134.-gen-PER.c \ check-src/check64-134.-gen-PER.c \
check-src/check64-136.-gen-OER.c \ check-src/check64-136.-gen-OER.c
check-src/check-42.-fwide-types.cc
clean-local: clean-local:
rm -rf test-* rm -rf test-*

View File

@ -28,26 +28,10 @@ fi
source_short=$(echo "$source_full" | sed -e 's/.*\///') source_short=$(echo "$source_full" | sed -e 's/.*\///')
testno=$(echo "$source_short" | cut -f2 -d'-' | cut -f1 -d'.') testno=$(echo "$source_short" | cut -f2 -d'-' | cut -f1 -d'.')
CODECS_FLAGS=""
has_oer=$(echo "$source_short" | grep "gen-OER" || :)
if [ ! "$has_oer" ]; then
CODECS_FLAGS="${CODECS_FLAGS} -DASN_DISABLE_OER_SUPPORT"
fi
has_per=$(echo "$source_short" | grep "gen-PER" || :)
if [ ! "$has_per" ]; then
CODECS_FLAGS="${CODECS_FLAGS} -DASN_DISABLE_PER_SUPPORT"
fi
args=$(echo "$source_short" | sed -E -e 's/\.c+$//') args=$(echo "$source_short" | sed -E -e 's/\.c+$//')
source_obj=$(echo "$source_short" | sed -E -e 's/\.c+$/.o/') source_obj=$(echo "$source_short" | sed -E -e 's/\.c+$/.o/')
ext=$(echo "$source_short" | sed -E -e 's/.*\.(c+)$/\1/') ext=$(echo "$source_short" | sed -E -e 's/.*\.(c+)$/\1/')
if [ "$ext" = "cc" ]; then
COMPILER='$(CXX) $(CXX_CFLAGS)'
else
COMPILER='$(CC)'
fi
OFS=$IFS OFS=$IFS
IFS="." IFS="."
set $args set $args
@ -84,25 +68,25 @@ asn_module=$(echo "${abs_top_srcdir}/tests/tests-asn1c-compiler/${testno}"-*.asn
AUTOGENERATED="# This file is autogenerated by $0 ${source_full} ${AFLAGS}" AUTOGENERATED="# This file is autogenerated by $0 ${source_full} ${AFLAGS}"
# Create a common Makefile for the project # Create a common Makefile for the project
cat <<TARGETS > "${testdir}/Makefile.targets" cat <<END_MAKEFILE > "${testdir}/Makefile"
${AUTOGENERATED} ${AUTOGENERATED}
COMMON_FLAGS= -I. COMMON_FLAGS= -I.
CFLAGS = \${COMMON_FLAGS} ${CFLAGS:-} -g -O1 CFLAGS = \${COMMON_FLAGS} ${CFLAGS:-} -g -O1
CFLAGS += -DSRCDIR=../${srcdir} ${CODECS_FLAGS} CFLAGS += -DSRCDIR=../${srcdir}
CXXFLAGS = \${CFLAGS} ${CXXFLAGS} CXXFLAGS = \${CFLAGS} ${CXXFLAGS}
LIBFUZZER_CFLAGS = ${LIBFUZZER_CFLAGS} LIBFUZZER_CFLAGS = ${LIBFUZZER_CFLAGS}
LDFLAGS = ${LDFLAGS:-} LDFLAGS = ${LDFLAGS:-}
ASN_PROGRAM = check-program
ASN_PROGRAM_SOURCES = ${source_short}
CC ?= ${CC} CC ?= ${CC}
CXX ?= ${CXX} CXX ?= ${CXX}
all: compiled-module -include Makefile.am.example
\$(MAKE) check-executable
check-executable: \$(OBJS) all: compiled-module
@rm -f *.core \$(MAKE) check-program
${COMPILER} \$(CFLAGS) \$(LDFLAGS) -o check-executable \$(OBJS) -lm
# Compile the corresponding .asn1 spec. # Compile the corresponding .asn1 spec.
compiled-module: ${asn_module} ${abs_top_builddir}/asn1c/asn1c compiled-module: ${asn_module} ${abs_top_builddir}/asn1c/asn1c
@ -113,33 +97,30 @@ compiled-module: ${asn_module} ${abs_top_builddir}/asn1c/asn1c
rm -f converter-example.c rm -f converter-example.c
@touch compiled-module @touch compiled-module
TARGETS END_MAKEFILE
if [ "${MAKE_FUZZER}" != "yes" ]; then if [ "${MAKE_FUZZER}" != "yes" ]; then
CHECK_FUZZER="@echo \"No fuzzer defined, skipping.\"" CHECK_FUZZER="@echo \"No fuzzer defined, skipping.\""
cat <<TARGETS >> "${testdir}/Makefile.targets" cat <<END_MAKEFILE >> "${testdir}/Makefile"
.PHONY: check-fuzzer .PHONY: check-fuzzer
check-fuzzer: check-fuzzer:
TARGETS END_MAKEFILE
else else
CHECK_FUZZER="ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1 ./check-fuzzer -timeout=3 -max_total_time=60 -max_len=512 ${OPT_DATA_DIR}" CHECK_FUZZER="ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1 ./check-fuzzer -timeout=3 -max_total_time=60 -max_len=512 ${OPT_DATA_DIR}"
cat <<TARGETS >> "${testdir}/Makefile.targets" cat <<END_MAKEFILE >> "${testdir}/Makefile"
check-fuzzer: \$(OBJS) check-fuzzer: ${source_short} \$(ASN_LIBRARY)
rm -f ${source_obj} ${CC} \$(CFLAGS) \$(LIBFUZZER_CFLAGS) \$(LDFLAGS) -o check-fuzzer \$^
${COMPILER} \$(CFLAGS) \$(LIBFUZZER_CFLAGS) -c -o ${source_obj} ${source_short} END_MAKEFILE
${COMPILER} \$(CFLAGS) \$(LIBFUZZER_CFLAGS) \$(LDFLAGS) -o check-fuzzer \$(OBJS)
rm -f ${source_obj}
TARGETS
fi fi
cat <<TARGETS >> "${testdir}/Makefile.targets" cat <<END_MAKEFILE >> "${testdir}/Makefile"
check-succeeded: compiled-module check-succeeded: compiled-module \$(ASN_LIBRARY) ${source_short}
\$(MAKE) check-executable \$(MAKE) check-program
\$(MAKE) check-fuzzer \$(MAKE) check-fuzzer
@rm -f check-succeeded @rm -f check-succeeded
./check-executable ./check-program
\$(MAKE) fuzz \$(MAKE) fuzz
@touch check-succeeded @touch check-succeeded
@echo "OK: ${source_full}" @echo "OK: ${source_full}"
@ -150,43 +131,10 @@ fuzz:
check: check-succeeded check: check-succeeded
clean: END_MAKEFILE
@rm -f *.o check-executable
TARGETS
# Create a BSD- or GNU-specific Makefile for the project.
produce_specific_makefile() {
local make_type=$1
local make_file="$testdir/${make_type}makefile"
if [ ${make_type} = "BSD" ]; then
cat <<-OBJECTS > ${make_file}
${AUTOGENERATED}
SRCS_C!=find . -name \*.c
SRCS_CXX!=find . -name \*.cc
SRCS=\$(SRCS_C) \$(SRCS_CXX)
OBJS=\${SRCS_C:.c=.o} \${SRCS_CXX:.cc=.o}
include Makefile.targets
OBJECTS
else
cat <<-OBJECTS > ${make_file}
${AUTOGENERATED}
SRCS_C := \$(wildcard *.c)
SRCS_CXX := \$(wildcard *.cc)
SRCS = \$(SRCS_C) \$(SRCS_CXX)
OBJS =\$(patsubst %.c,%.o,\$(SRCS_C))
OBJS+=\$(patsubst %.cc,%.o,\$(SRCS_CXX))
include Makefile.targets
OBJECTS
fi
}
produce_specific_makefile BSD
produce_specific_makefile GNU
# Perform building and checking # Perform building and checking
${TEST_DRIVER} make -C "$testdir" check ${TEST_DRIVER} ${MAKE:-make} -C "${testdir}" check
# Make sure the test is not marked as failed any longer. # Make sure the test is not marked as failed any longer.
rm -f "${testdir}-FAILED" rm -f "${testdir}-FAILED"

View File

@ -16,12 +16,18 @@ TESTS_ENVIRONMENT= \
ASAN_ENV_FLAGS="@ASAN_ENV_FLAGS@" \ ASAN_ENV_FLAGS="@ASAN_ENV_FLAGS@" \
srcdir=${srcdir} \ srcdir=${srcdir} \
abs_top_srcdir=${abs_top_srcdir} \ abs_top_srcdir=${abs_top_srcdir} \
abs_top_builddir=${abs_top_builddir} abs_top_builddir=${abs_top_builddir} \
${srcdir}/check-bundles.sh
TESTS = $(dist_check_SCRIPTS) TESTS =
TESTS += bundles/01-1.txt
TESTS += bundles/01-2.txt
EXTRA_DIST = bundles random-test-driver.c EXTRA_DIST = \
random-test-driver.c \
$(srcdir)/bundles/README \
$(srcdir)/bundles/*.txt
clean-local: clean-local:
rm -rf .tmp.random rm -rf .tmp.*

View File

@ -26,7 +26,7 @@ usage() {
exit 1 exit 1
} }
RNDTEMP=.tmp.random RNDTEMP="${RNDTEMP:-.tmp.random}"
srcdir="${srcdir:-.}" srcdir="${srcdir:-.}"
abs_top_srcdir="${abs_top_srcdir:-`pwd`/../../}" abs_top_srcdir="${abs_top_srcdir:-`pwd`/../../}"
@ -38,7 +38,7 @@ stop_after_failed=1 # We stop after 3 failures.
need_clean_before_bundle=1 # Clean before testing a bundle file need_clean_before_bundle=1 # Clean before testing a bundle file
need_clean_before_test=0 # Before each line in a bundle file need_clean_before_test=0 # Before each line in a bundle file
encodings="" # Default is to verify all supported ASN.1 transfer syntaxes encodings="" # Default is to verify all supported ASN.1 transfer syntaxes
parallelism=4 parallelism=1
asn1c_flags="" asn1c_flags=""
make_clean_before_bundle() { make_clean_before_bundle() {
@ -229,9 +229,12 @@ asn_compile() {
fi fi
rm -f converter-example.c rm -f converter-example.c
ln -sf "../${srcdir}/random-test-driver.c" || cp "../${srcdir}/random-test-driver.c" . ln -sf "../${srcdir}/random-test-driver.c" || cp "../${srcdir}/random-test-driver.c" .
echo "CFLAGS+= -DASN1_TEXT='$short_asn'" > Makefile {
sed -e 's/converter-example/random-test-driver/' \ echo "CFLAGS+= -DASN1_TEXT='$short_asn'";
< Makefile.am.example >> Makefile echo "ASN_PROGRAM = random-test-driver"
echo "ASN_PROGRAM_SOURCES = random-test-driver.c"
echo "include Makefile.am.example"
} > Makefile
echo "Makefile.am.example -> Makefile" echo "Makefile.am.example -> Makefile"
} }
@ -271,11 +274,26 @@ test_drive() {
fi fi
} }
if echo "$*" | grep ' -- ' > /dev/null; then
TEST_DRIVER=`echo "$*" | sed -e 's/ -- .*/ -- /g'`
args=`echo "$*" | sed -e 's/.* //g'`
set "${args}"
else
TEST_DRIVER=""
fi
# Command line parsing # Command line parsing
while :; do while :; do
case "$1" in case "$1" in
-h) usage ;; -h) usage ;;
--asn1c) asn1c_flags="${asn1c_flags} $2"; shift 2; continue ;; --asn1c) asn1c_flags="${asn1c_flags} $2"; shift 2; continue ;;
--bundle)
shift
base=`basename "$1" | sed -e 's/.txt$//'`
RNDTEMP=".tmp.${base}"
test_drive verify_asn_types_in_file "$@"
break
;;
--dirty) --dirty)
need_clean_before_bundle=0 need_clean_before_bundle=0
need_clean_before_test=0 need_clean_before_test=0
@ -285,7 +303,6 @@ while :; do
-e) encodings="${encodings} -e $2"; shift 2; continue;; -e) encodings="${encodings} -e $2"; shift 2; continue;;
-j) parallelism="$1"; shift 2; continue;; -j) parallelism="$1"; shift 2; continue;;
-t) -t)
parallelism=1 # Better for debuggability
test_drive verify_asn_type "$2" "(command line)" || exit 1 ;; test_drive verify_asn_type "$2" "(command line)" || exit 1 ;;
"") "")
for bundle in `ls -1 ${srcdir}/bundles/*.txt | sort -nr`; do for bundle in `ls -1 ${srcdir}/bundles/*.txt | sort -nr`; do
@ -293,7 +310,7 @@ while :; do
done done
;; ;;
*) *)
test_drive verify_asn_types_in_file "$@" exec ${TEST_DRIVER} $0 --bundle "$@"
;; ;;
esac esac
break break