blob: 85c1e594077a1618a83526469e3aa7ff342c3edf [file] [log] [blame]
Lev Walkin294aebc2017-10-10 00:29:18 -07001ASN_PROGRAM = ulp-dump
2CFLAGS += -DASN_CONVERTER_TITLE="OMA UserPlane Location Protocol decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
3begin: ULP-PDU.c maybe-wip-pause all
Lev Walkin5aef2c52007-06-29 12:46:06 +00004
Jon Ringle3016fd52017-11-15 02:06:47 -05005-include converter-example.mk
Lev Walkin5aef2c52007-06-29 12:46:06 +00006
7ULP-PDU.c: ../sample.makefile.regen ../ulp.asn1
8 make regen-makefile
9 @touch ULP-PDU.c
10 make
11
12regen-makefile:
13 TITLE="OMA UserPlane Location Protocol decoder" \
Lev Walkin076bbbc2017-11-13 22:29:46 -080014 ASN_CMDOPTS="-pdu=SUPLINIT -fcompound-names -no-gen-OER" \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070015 ASN_MODULES="../ulp.asn1" \
16 ASN_PDU=ULP-PDU \
17 ASN_PROGRAM=ulp-dump \
Lev Walkin5aef2c52007-06-29 12:46:06 +000018 ../sample.makefile.regen
19
Lev Walkin294aebc2017-10-10 00:29:18 -070020check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
Lev Walkin5aef2c52007-06-29 12:46:06 +000021 @echo ================
22 @echo All tests passed
23 @echo ================
24
25check-ber:
26 @if test -f sample-ULP-PDU-1.[db]er ; then \
Lev Walkinad775912017-09-26 22:55:22 -070027 for f in sample-*-*.[db]er; do \
28 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000029 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -070030 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkin5aef2c52007-06-29 12:46:06 +000033 diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
34 rm -f ./.tmp.[12].$$$$; \
35 echo "Test junking $$f (please wait)..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkin5aef2c52007-06-29 12:46:06 +000038 done; done; fi
39
40check-xer:
41 @if test -f sample-ULP-PDU-1.xer ; then \
Lev Walkinad775912017-09-26 22:55:22 -070042 for f in sample-*-*.xer; do \
43 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000044 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -070045 echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkin5aef2c52007-06-29 12:46:06 +000048 diff $$f ./.tmp.2.$$$$ || exit 4; \
49 rm -f ./.tmp.[12].$$$$; \
50 echo "Test junking $$f (please wait)..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkinad775912017-09-26 22:55:22 -070053 done; done; fi
54
55check-oer:
56 @if test -f sample-ULP-PDU-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 Walkin294aebc2017-10-10 00:29:18 -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 Walkinad775912017-09-26 22:55:22 -070063 diff $$f ./.tmp.2.$$$$ || exit 4; \
64 rm -f ./.tmp.[12].$$$$; \
65 echo "Test junking $$f (please wait) ($$b) ..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkin5aef2c52007-06-29 12:46:06 +000068 done; done; fi
69
70check-per:
71 @if test -f sample-ULP-PDU-1-nopad.per ; then \
Lev Walkinad775912017-09-26 22:55:22 -070072 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/"`; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000074 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -070075 echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkin5aef2c52007-06-29 12:46:06 +000079 diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
80 rm -f ./.tmp.[123].$$$$; \
81 echo "Test junking $$f (please wait)..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkin5aef2c52007-06-29 12:46:06 +000084 done; done; fi
85 @if test -f sample-ULP-PDU-1.per ; then \
86 for f in sample-*-[1-9].per; do \
Lev Walkinad775912017-09-26 22:55:22 -070087 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000088 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -070089 echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkin5aef2c52007-06-29 12:46:06 +000093 diff $$f ./.tmp.1.$$$$ || exit 6; \
94 rm -f ./.tmp.[12].$$$$; \
95 echo "Test junking $$f (please wait)..."; \
Lev Walkin294aebc2017-10-10 00:29:18 -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 Walkin5aef2c52007-06-29 12:46:06 +000098 done; done; fi
99
Lev Walkinad775912017-09-26 22:55:22 -0700100maybe-wip-pause:
101 @if [ -f WIP ]; then cat WIP; sleep 2; fi
102
Lev Walkin5aef2c52007-06-29 12:46:06 +0000103distclean: clean
Jon Ringle7871abf2017-11-13 21:29:40 -0500104 rm -f $(ASN_MODULE_SRCS)
105 rm -f $(ASN_MODULE_HDRS)
106 rm -f $(ASN_PROGRAM_SRCS) $(ASN_PROGRAM_HDRS)
Jon Ringle3016fd52017-11-15 02:06:47 -0500107 rm -f converter-example.mk