8a3bcd2607acd5b29aa0b93632bd81819c996f5d
[com/asn1c.git] / examples / sample.source.S1AP / Makefile
1 ASN_PROGRAM = s1ap-dump
2 CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
3 begin: S1AP-PDU.c maybe-wip-pause all
4
5 -include converter-example.mk
6
7 S1AP-PDU.c: ../sample.makefile.regen ../s1ap-14.4.0.asn1
8         make regen-makefile
9         @touch S1AP-PDU.c
10         make
11
12 regen-makefile:
13         ASN_CMDOPTS="-pdu=all -fcompound-names -findirect-choice -fno-include-deps -flink-skeletons -gen-PER" \
14         ASN_MODULES="../s1ap-14.4.0.asn1" \
15         ASN_PDU=S1AP-PDU \
16         ASN_PROGRAM=s1ap-dump \
17         ../sample.makefile.regen
18
19 check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per check-aper
20         @echo ================
21         @echo All tests passed
22         @echo ================
23
24 check-ber:
25         @if test -f sample-S1AP-PDU-1.[db]er ; then \
26         for f in sample-*-*.[db]er; do \
27         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \
28         for b in 1 17 33 980 8192; do \
29         echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
30         ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
31         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
32         diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
33         rm -f ./.tmp.[12].$$$$; \
34         echo "Test junking $$f (please wait)..."; \
35         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
36         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
37         done; done; fi
38
39 check-xer:
40         @if test -f sample-S1AP-PDU-1.xer ; then \
41         for f in sample-*-*.xer; do \
42         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \
43         for b in 1 17 33 980 8192; do \
44         echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
45         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
46         ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
47         diff $$f ./.tmp.2.$$$$ || exit 4; \
48         rm -f ./.tmp.[12].$$$$; \
49         echo "Test junking $$f (please wait)..."; \
50         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
51         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
52         done; done; fi
53
54 check-oer:
55         @if test -f sample-S1AP-PDU-1.*oer ; then \
56         for f in sample-*-*.*oer; do \
57         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \
58         for b in 1 17 33 980 8192; do \
59         echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
60         ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
61         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
62         diff $$f ./.tmp.2.$$$$ || exit 4; \
63         rm -f ./.tmp.[12].$$$$; \
64         echo "Test junking $$f (please wait) ($$b) ..."; \
65         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
66         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
67         done; done; fi
68
69 check-per:
70         @if test -f sample-S1AP-PDU-1-nopad.per ; then \
71         for f in sample-*-[1-9]-nopad.per; do \
72         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \
73         for b in 1 17 33 980 8192; do \
74         echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
75         ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
76         ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
77         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
78         diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
79         rm -f ./.tmp.[123].$$$$; \
80         echo "Test junking $$f (please wait)..."; \
81         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
82         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
83         done; done; fi
84         @if test -f sample-S1AP-PDU-1.per ; then \
85         for f in sample-*-[1-9].per; do \
86         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \
87         for b in 1 17 33 980 8192; do \
88         echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
89         ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
90         ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
91         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
92         diff $$f ./.tmp.1.$$$$ || exit 6; \
93         rm -f ./.tmp.[12].$$$$; \
94         echo "Test junking $$f (please wait)..."; \
95         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
96         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
97         done; done; fi
98
99 check-aper:
100         @files=$$(find . -type f -regex '^.*\/sample-.*-[0-9]+.aper$$' | sort -V); \
101         if [ -n "$$files" ]; then \
102         for f in $$files; do \
103         pdu=`echo $$f | sed -E -e "s/.*sample-([A-Za-z0-9-]+)-[0-9]+.*/\\1/"`; \
104         for b in 1 17 33 980 8192; do \
105         echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
106         ./${ASN_PROGRAM} -p $$pdu -b $$b -iaper -oxer $$f > ./.tmp.1.$$$$ || exit 3; \
107         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oaper ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
108         diff $$f ./.tmp.2.$$$$ || exit 6; \
109         rm -f ./.tmp.[12].$$$$; \
110         echo "Test junking $$f (please wait)..."; \
111         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iaper -onull $$f || exit 7; \
112         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iaper -onull $$f || exit 8; \
113         done; done; fi
114
115 maybe-wip-pause:
116         @if [ -f WIP ]; then cat WIP; sleep 2; fi
117
118 distclean: clean
119         rm -f $(ASN_MODULE_SRCS)
120         rm -f $(ASN_MODULE_HDRS)
121         rm -f $(ASN_PROGRAM_SRCS) $(ASN_PROGRAM_HDRS)
122         rm -f converter-example.mk