blob: 2e24bbc6ef782588d1871929bcbd861727b935a1 [file] [log] [blame]
Lev Walkinad775912017-09-26 22:55:22 -07001-include Makefile.am.libasncodec
Lev Walkind748bff2017-08-07 17:47:50 -07002
Lev Walkind748bff2017-08-07 17:47:50 -07003TARGET = 1609-2-dump
Lev Walkinad775912017-09-26 22:55:22 -07004ASN_LIBRARY=libasncodec.a
Lev Walkin96d388c2017-09-12 22:40:15 -07005LIBS += -lm
Lev Walkinad775912017-09-26 22:55:22 -07006CFLAGS += -DASN_CONVERTER_TITLE="IEEE 1609.2-2016 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=Certificate -DASN_PDU_COLLECTION -I.
7ASN_CONVERTER_SOURCES := \
8 converter-example.c\
9 pdu_collection.c
Lev Walkind748bff2017-08-07 17:47:50 -070010
11all: maybe-wip-pause Certificate.c $(TARGET)
12
Lev Walkinad775912017-09-26 22:55:22 -070013$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
14 $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
15
16$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
17 $(AR) rcs $@ $^
Lev Walkind748bff2017-08-07 17:47:50 -070018
19.SUFFIXES:
20.SUFFIXES: .c .o
21
22.c.o:
Lev Walkinad775912017-09-26 22:55:22 -070023 $(CC) $(CFLAGS) -o $@ -c $<
Lev Walkind748bff2017-08-07 17:47:50 -070024
25clean:
Lev Walkinad775912017-09-26 22:55:22 -070026 rm -f $(TARGET) $(ASN_LIBRARY)
27 rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
Lev Walkind748bff2017-08-07 17:47:50 -070028
29regen: regenerate-from-asn1-source
30
31regenerate-from-asn1-source:
Lev Walkinfe4e0472017-09-04 22:34:50 -070032 ../../asn1c/asn1c -S ../../skeletons -pdu=Certificate -pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER ../IEEE-1609.2-2016.asn1
Lev Walkind748bff2017-08-07 17:47:50 -070033
34
35Certificate.c: ../sample.makefile.regen ../IEEE-1609.2-2016.asn1
36 make regen-makefile
37 @touch Certificate.c
38 make
39
40regen-makefile:
41 TITLE="IEEE 1609.2-2016 decoder" \
Lev Walkinfe4e0472017-09-04 22:34:50 -070042 ASN1CMDOPTS="-pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER" \
Lev Walkind748bff2017-08-07 17:47:50 -070043 ASN1MODULES="../IEEE-1609.2-2016.asn1" \
44 ASN1PDU=Certificate \
45 PROGNAME=1609-2-dump \
Lev Walkind748bff2017-08-07 17:47:50 -070046 ../sample.makefile.regen
47
Lev Walkinaa7e94f2017-08-27 23:44:58 -070048check: ${TARGET} check-ber check-xer check-oer check-per
Lev Walkind748bff2017-08-07 17:47:50 -070049 @echo ================
50 @echo All tests passed
51 @echo ================
52
53check-ber:
54 @if test -f sample-Certificate-1.[db]er ; then \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070055 for f in sample-*-*.[db]er; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -070056 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkind748bff2017-08-07 17:47:50 -070057 for b in 1 17 33 980 8192; do \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070058 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
59 ./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
60 ./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkind748bff2017-08-07 17:47:50 -070061 diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
62 rm -f ./.tmp.[12].$$$$; \
63 echo "Test junking $$f (please wait)..."; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070064 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
65 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
Lev Walkind748bff2017-08-07 17:47:50 -070066 done; done; fi
67
68check-xer:
69 @if test -f sample-Certificate-1.xer ; then \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070070 for f in sample-*-*.xer; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -070071 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkind748bff2017-08-07 17:47:50 -070072 for b in 1 17 33 980 8192; do \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070073 echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
74 ./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
75 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkind748bff2017-08-07 17:47:50 -070076 diff $$f ./.tmp.2.$$$$ || exit 4; \
77 rm -f ./.tmp.[12].$$$$; \
78 echo "Test junking $$f (please wait)..."; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070079 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
80 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
81 done; done; fi
82
83check-oer:
84 @if test -f sample-Certificate-1.*oer ; then \
Lev Walkin3b6cba52017-08-31 01:57:04 -070085 for f in sample-*-*.*oer; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -070086 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070087 for b in 1 17 33 980 8192; do \
88 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
89 ./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
Lev Walkin3b6cba52017-08-31 01:57:04 -070090 ./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
91 diff $$f ./.tmp.2.$$$$ || exit 4; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070092 rm -f ./.tmp.[12].$$$$; \
Lev Walkin3b6cba52017-08-31 01:57:04 -070093 echo "Test junking $$f (please wait) ($$b) ..."; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070094 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
95 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
Lev Walkind748bff2017-08-07 17:47:50 -070096 done; done; fi
97
98check-per:
99 @if test -f sample-Certificate-1-nopad.per ; then \
Lev Walkinaa7e94f2017-08-27 23:44:58 -0700100 for f in sample-*-[1-9]-nopad.per; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -0700101 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkind748bff2017-08-07 17:47:50 -0700102 for b in 1 17 33 980 8192; do \
Lev Walkinaa7e94f2017-08-27 23:44:58 -0700103 echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
104 ./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
105 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
106 ./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
Lev Walkind748bff2017-08-07 17:47:50 -0700107 diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
108 rm -f ./.tmp.[123].$$$$; \
109 echo "Test junking $$f (please wait)..."; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -0700110 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
111 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
Lev Walkind748bff2017-08-07 17:47:50 -0700112 done; done; fi
113 @if test -f sample-Certificate-1.per ; then \
114 for f in sample-*-[1-9].per; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -0700115 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkind748bff2017-08-07 17:47:50 -0700116 for b in 1 17 33 980 8192; do \
Lev Walkinaa7e94f2017-08-27 23:44:58 -0700117 echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
118 ./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
119 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
120 ./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
Lev Walkind748bff2017-08-07 17:47:50 -0700121 diff $$f ./.tmp.1.$$$$ || exit 6; \
122 rm -f ./.tmp.[12].$$$$; \
123 echo "Test junking $$f (please wait)..."; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -0700124 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
125 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
Lev Walkind748bff2017-08-07 17:47:50 -0700126 done; done; fi
127
128maybe-wip-pause:
Lev Walkinaa7e94f2017-08-27 23:44:58 -0700129 @if [ -f WIP ]; then cat WIP; sleep 2; fi
Lev Walkind748bff2017-08-07 17:47:50 -0700130
131distclean: clean
132 rm -f $(ASN_MODULE_SOURCES)
133 rm -f $(ASN_MODULE_HEADERS)
134 rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
Lev Walkinad775912017-09-26 22:55:22 -0700135 rm -f Makefile.am.example