blob: 47c830b4b26924581add88ea6dd5f682d2545916 [file] [log] [blame]
Lev Walkinad775912017-09-26 22:55:22 -07001-include Makefile.am.libasncodec
Lev Walkind83172f2006-09-09 04:49:45 +00002
Lev Walkin61c391b2006-09-28 09:19:34 +00003TARGET = megaco-dump
Lev Walkinad775912017-09-26 22:55:22 -07004ASN_LIBRARY=libasncodec.a
5LIBS += -lm
6CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=MegacoMessage -I.
7ASN_CONVERTER_SOURCES := \
8 converter-example.c
Lev Walkind83172f2006-09-09 04:49:45 +00009
Lev Walkinad775912017-09-26 22:55:22 -070010all: maybe-wip-pause MegacoMessage.c $(TARGET)
Lev Walkind83172f2006-09-09 04:49:45 +000011
Lev Walkinad775912017-09-26 22:55:22 -070012$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
13 $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
14
15$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
16 $(AR) rcs $@ $^
Lev Walkind83172f2006-09-09 04:49:45 +000017
18.SUFFIXES:
19.SUFFIXES: .c .o
20
21.c.o:
Lev Walkinad775912017-09-26 22:55:22 -070022 $(CC) $(CFLAGS) -o $@ -c $<
Lev Walkind83172f2006-09-09 04:49:45 +000023
24clean:
Lev Walkinad775912017-09-26 22:55:22 -070025 rm -f $(TARGET) $(ASN_LIBRARY)
26 rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
Lev Walkind83172f2006-09-09 04:49:45 +000027
28regen: regenerate-from-asn1-source
29
30regenerate-from-asn1-source:
Lev Walkind7f5cb92006-09-23 02:56:19 +000031 ../../asn1c/asn1c -S ../../skeletons -pdu=MegacoMessage -fcompound-names ../rfc3525-MEDIA-GATEWAY-CONTROL.asn1
Lev Walkind83172f2006-09-09 04:49:45 +000032
33
Lev Walkin13afe532006-09-18 21:30:04 +000034MegacoMessage.c: ../sample.makefile.regen ../rfc3525-MEDIA-GATEWAY-CONTROL.asn1
Lev Walkincc7c94e2006-09-17 04:01:29 +000035 make regen-makefile
36 @touch MegacoMessage.c
37 make
38
39regen-makefile:
Lev Walkinf5b49392006-09-12 06:19:15 +000040 ASN1CMDOPTS="-fcompound-names" \
41 ASN1MODULES="../rfc3525-MEDIA-GATEWAY-CONTROL.asn1" \
42 ASN1PDU=MegacoMessage \
Lev Walkin61c391b2006-09-28 09:19:34 +000043 PROGNAME=megaco-dump \
Lev Walkin2fd86de2006-09-13 02:10:23 +000044 ../sample.makefile.regen
Lev Walkind83172f2006-09-09 04:49:45 +000045
Lev Walkinad775912017-09-26 22:55:22 -070046check: ${TARGET} check-ber check-xer check-oer check-per
Lev Walkin1f12da42006-09-24 19:47:07 +000047 @echo ================
48 @echo All tests passed
49 @echo ================
50
51check-ber:
Lev Walkin13afe532006-09-18 21:30:04 +000052 @if test -f sample-MegacoMessage-1.[db]er ; then \
Lev Walkinad775912017-09-26 22:55:22 -070053 for f in sample-*-*.[db]er; do \
54 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +000055 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -070056 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
57 ./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
58 ./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000059 diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
Lev Walkin13afe532006-09-18 21:30:04 +000060 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +000061 echo "Test junking $$f (please wait)..."; \
Lev Walkinad775912017-09-26 22:55:22 -070062 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
63 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +000064 done; done; fi
Lev Walkin1f12da42006-09-24 19:47:07 +000065
66check-xer:
Lev Walkin13afe532006-09-18 21:30:04 +000067 @if test -f sample-MegacoMessage-1.xer ; then \
Lev Walkinad775912017-09-26 22:55:22 -070068 for f in sample-*-*.xer; do \
69 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +000070 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -070071 echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
72 ./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
73 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000074 diff $$f ./.tmp.2.$$$$ || exit 4; \
Lev Walkin13afe532006-09-18 21:30:04 +000075 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +000076 echo "Test junking $$f (please wait)..."; \
Lev Walkinad775912017-09-26 22:55:22 -070077 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
78 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
79 done; done; fi
80
81check-oer:
82 @if test -f sample-MegacoMessage-1.*oer ; then \
83 for f in sample-*-*.*oer; do \
84 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
85 for b in 1 17 33 980 8192; do \
86 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
87 ./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
88 ./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
89 diff $$f ./.tmp.2.$$$$ || exit 4; \
90 rm -f ./.tmp.[12].$$$$; \
91 echo "Test junking $$f (please wait) ($$b) ..."; \
92 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
93 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +000094 done; done; fi
Lev Walkin1f12da42006-09-24 19:47:07 +000095
96check-per:
Lev Walkin5aef2c52007-06-29 12:46:06 +000097 @if test -f sample-MegacoMessage-1-nopad.per ; then \
Lev Walkinad775912017-09-26 22:55:22 -070098 for f in sample-*-[1-9]-nopad.per; do \
99 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +0000100 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -0700101 echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
102 ./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
103 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
104 ./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
Lev Walkin5aef2c52007-06-29 12:46:06 +0000105 diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
Lev Walkin13afe532006-09-18 21:30:04 +0000106 rm -f ./.tmp.[123].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +0000107 echo "Test junking $$f (please wait)..."; \
Lev Walkinad775912017-09-26 22:55:22 -0700108 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
109 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
Lev Walkin13afe532006-09-18 21:30:04 +0000110 done; done; fi
Lev Walkin5aef2c52007-06-29 12:46:06 +0000111 @if test -f sample-MegacoMessage-1.per ; then \
112 for f in sample-*-[1-9].per; do \
Lev Walkinad775912017-09-26 22:55:22 -0700113 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +0000114 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -0700115 echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
116 ./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
117 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
118 ./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
Lev Walkin5aef2c52007-06-29 12:46:06 +0000119 diff $$f ./.tmp.1.$$$$ || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +0000120 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +0000121 echo "Test junking $$f (please wait)..."; \
Lev Walkinad775912017-09-26 22:55:22 -0700122 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
123 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
Lev Walkin13afe532006-09-18 21:30:04 +0000124 done; done; fi
Lev Walkinc744a022006-09-15 18:33:25 +0000125
Lev Walkinad775912017-09-26 22:55:22 -0700126maybe-wip-pause:
127 @if [ -f WIP ]; then cat WIP; sleep 2; fi
128
Lev Walkind83172f2006-09-09 04:49:45 +0000129distclean: clean
Lev Walkinbcda5ff2006-09-17 03:29:51 +0000130 rm -f $(ASN_MODULE_SOURCES)
131 rm -f $(ASN_MODULE_HEADERS)
Lev Walkinf5b49392006-09-12 06:19:15 +0000132 rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
Lev Walkinad775912017-09-26 22:55:22 -0700133 rm -f Makefile.am.example