blob: 79570fe35ff6ed47a545002d31b8dc58fe3ebbe8 [file] [log] [blame]
Lev Walkin40b8a7a2017-10-08 22:36:29 -07001ASN_PROGRAM = j2735-dump
2CFLAGS += -DASN_CONVERTER_TITLE="J2735 DSRC decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
3begin: MessageFrame.c maybe-wip-pause all
Lev Walkine29e6122017-08-04 02:46:28 -07004
Lev Walkin40b8a7a2017-10-08 22:36:29 -07005-include Makefile.am.example
Lev Walkine29e6122017-08-04 02:46:28 -07006
Lev Walkind3cc9de2017-08-05 23:01:38 -07007MessageFrame.c: ../sample.makefile.regen ../J2735_201603.asn1
Lev Walkine29e6122017-08-04 02:46:28 -07008 make regen-makefile
9 @touch MessageFrame.c
10 make
11
12regen-makefile:
13 TITLE="J2735 DSRC decoder" \
Lev Walkin076bbbc2017-11-13 22:29:46 -080014 ASN_CMDOPTS="-fcompound-names -pdu=auto" \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070015 ASN_MODULES="../J2735_201603.asn1" \
16 ASN_PDU=MessageFrame \
17 ASN_PROGRAM=j2735-dump \
Lev Walkine29e6122017-08-04 02:46:28 -070018 ../sample.makefile.regen
19
Lev Walkin40b8a7a2017-10-08 22:36:29 -070020check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
Lev Walkine29e6122017-08-04 02:46:28 -070021 @echo ================
22 @echo All tests passed
23 @echo ================
24
25check-ber:
26 @if test -f sample-MessageFrame-1.[db]er ; then \
Lev Walkina926fce2017-08-27 12:54:25 -070027 for f in sample-*-*.[db]er; do \
Lev Walkine4ea1752017-09-05 02:52:19 -070028 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkine29e6122017-08-04 02:46:28 -070029 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -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 Walkine29e6122017-08-04 02:46:28 -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 Walkine29e6122017-08-04 02:46:28 -070038 done; done; fi
39
40check-xer:
41 @if test -f sample-MessageFrame-1.xer ; then \
Lev Walkina926fce2017-08-27 12:54:25 -070042 for f in sample-*-*.xer; do \
Lev Walkine4ea1752017-09-05 02:52:19 -070043 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkine29e6122017-08-04 02:46:28 -070044 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -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 Walkine29e6122017-08-04 02:46:28 -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 Walkine29e6122017-08-04 02:46:28 -070053 done; done; fi
54
Lev Walkine4ea1752017-09-05 02:52:19 -070055check-oer:
56 @if test -f sample-MessageFrame-1.*oer ; then \
57 for f in sample-*-*.*oer; do \
58 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
59 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 Walkine4ea1752017-09-05 02:52:19 -070063 diff $$f ./.tmp.2.$$$$ || exit 4; \
64 rm -f ./.tmp.[12].$$$$; \
65 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 Walkine4ea1752017-09-05 02:52:19 -070068 done; done; fi
69
Lev Walkine29e6122017-08-04 02:46:28 -070070check-per:
Lev Walkin399f1cf2017-09-13 00:14:46 -070071 @if test -f sample-MessageFrame-1-nopad.per ; then \
72 for f in sample-*-[1-9]-nopad.per; do \
73 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
74 for b in 1 17 33 980 8192; do \
75 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 Walkin399f1cf2017-09-13 00:14:46 -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 Walkin399f1cf2017-09-13 00:14:46 -070084 done; done; fi
Lev Walkine29e6122017-08-04 02:46:28 -070085 @if test -f sample-MessageFrame-1.per ; then \
86 for f in sample-*-[1-9].per; do \
Lev Walkine4ea1752017-09-05 02:52:19 -070087 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkine29e6122017-08-04 02:46:28 -070088 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -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 Walkine29e6122017-08-04 02:46:28 -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 Walkine29e6122017-08-04 02:46:28 -070098 done; done; fi
99
Lev Walkin6aae7c62017-08-10 17:58:48 -0700100maybe-wip-pause:
101 @if [ -f WIP ]; then cat WIP; sleep 2; fi
102
Lev Walkine29e6122017-08-04 02:46:28 -0700103distclean: 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