blob: 9bb5387b6def3ac2ab34aad4020111a5273160ea [file] [log] [blame]
Lev Walkin40b8a7a2017-10-08 22:36:29 -07001ASN_PROGRAM = 1609-2-dump
2CFLAGS += -DASN_CONVERTER_TITLE="IEEE 1609.2-2016 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
3begin: Certificate.c maybe-wip-pause all
Lev Walkind748bff2017-08-07 17:47:50 -07004
Lev Walkin40b8a7a2017-10-08 22:36:29 -07005-include Makefile.am.example
Lev Walkind748bff2017-08-07 17:47:50 -07006
7Certificate.c: ../sample.makefile.regen ../IEEE-1609.2-2016.asn1
8 make regen-makefile
9 @touch Certificate.c
10 make
11
12regen-makefile:
13 TITLE="IEEE 1609.2-2016 decoder" \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070014 ASN_CMDOPTS="-pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER" \
15 ASN_MODULES="../IEEE-1609.2-2016.asn1" \
16 ASN_PDU=Certificate \
17 ASN_PROGRAM=1609-2-dump \
Lev Walkind748bff2017-08-07 17:47:50 -070018 ../sample.makefile.regen
19
Lev Walkin40b8a7a2017-10-08 22:36:29 -070020check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
Lev Walkind748bff2017-08-07 17:47:50 -070021 @echo ================
22 @echo All tests passed
23 @echo ================
24
25check-ber:
26 @if test -f sample-Certificate-1.[db]er ; then \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070027 for f in sample-*-*.[db]er; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -070028 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkind748bff2017-08-07 17:47:50 -070029 for b in 1 17 33 980 8192; do \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070030 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070031 ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
32 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkind748bff2017-08-07 17:47:50 -070033 diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
34 rm -f ./.tmp.[12].$$$$; \
35 echo "Test junking $$f (please wait)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070036 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
37 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
Lev Walkind748bff2017-08-07 17:47:50 -070038 done; done; fi
39
40check-xer:
41 @if test -f sample-Certificate-1.xer ; then \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070042 for f in sample-*-*.xer; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -070043 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkind748bff2017-08-07 17:47:50 -070044 for b in 1 17 33 980 8192; do \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070045 echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070046 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
47 ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkind748bff2017-08-07 17:47:50 -070048 diff $$f ./.tmp.2.$$$$ || exit 4; \
49 rm -f ./.tmp.[12].$$$$; \
50 echo "Test junking $$f (please wait)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070051 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
52 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070053 done; done; fi
54
55check-oer:
56 @if test -f sample-Certificate-1.*oer ; then \
Lev Walkin3b6cba52017-08-31 01:57:04 -070057 for f in sample-*-*.*oer; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -070058 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070059 for b in 1 17 33 980 8192; do \
60 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070061 ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
62 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin3b6cba52017-08-31 01:57:04 -070063 diff $$f ./.tmp.2.$$$$ || exit 4; \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070064 rm -f ./.tmp.[12].$$$$; \
Lev Walkin3b6cba52017-08-31 01:57:04 -070065 echo "Test junking $$f (please wait) ($$b) ..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070066 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
67 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
Lev Walkind748bff2017-08-07 17:47:50 -070068 done; done; fi
69
70check-per:
71 @if test -f sample-Certificate-1-nopad.per ; then \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070072 for f in sample-*-[1-9]-nopad.per; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -070073 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkind748bff2017-08-07 17:47:50 -070074 for b in 1 17 33 980 8192; do \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070075 echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070076 ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
77 ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
78 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
Lev Walkind748bff2017-08-07 17:47:50 -070079 diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
80 rm -f ./.tmp.[123].$$$$; \
81 echo "Test junking $$f (please wait)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070082 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
83 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
Lev Walkind748bff2017-08-07 17:47:50 -070084 done; done; fi
85 @if test -f sample-Certificate-1.per ; then \
86 for f in sample-*-[1-9].per; do \
Lev Walkinfe4e0472017-09-04 22:34:50 -070087 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkind748bff2017-08-07 17:47:50 -070088 for b in 1 17 33 980 8192; do \
Lev Walkinaa7e94f2017-08-27 23:44:58 -070089 echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070090 ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
91 ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
92 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
Lev Walkind748bff2017-08-07 17:47:50 -070093 diff $$f ./.tmp.1.$$$$ || exit 6; \
94 rm -f ./.tmp.[12].$$$$; \
95 echo "Test junking $$f (please wait)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070096 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
97 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
Lev Walkind748bff2017-08-07 17:47:50 -070098 done; done; fi
99
100maybe-wip-pause:
Lev Walkinaa7e94f2017-08-27 23:44:58 -0700101 @if [ -f WIP ]; then cat WIP; sleep 2; fi
Lev Walkind748bff2017-08-07 17:47:50 -0700102
103distclean: clean
104 rm -f $(ASN_MODULE_SOURCES)
105 rm -f $(ASN_MODULE_HEADERS)
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700106 rm -f $(ASN_PROGRAM_SOURCES) $(ASN_PROGRAM_HEADERS)
Lev Walkinad775912017-09-26 22:55:22 -0700107 rm -f Makefile.am.example