xref: /freebsd/bin/dd/Makefile (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
136ace8a0SEnji Cooper.include <src.opts.mk>
236ace8a0SEnji Cooper
3ac2875faSGlen BarberPACKAGE=runtime
43066c4a4SNate LawsonPROG=	dd
53066c4a4SNate LawsonSRCS=	args.c conv.c conv_tab.c dd.c misc.c position.c
6*8acbb227SKyle EvansLIBADD= util
73d36fd42SPoul-Henning Kamp
83d36fd42SPoul-Henning Kamp#
93d36fd42SPoul-Henning Kamp# Test the character conversion functions.  We have to be explicit about
103d36fd42SPoul-Henning Kamp# which LC_LANG we use because the definition of upper and lower case
113d36fd42SPoul-Henning Kamp# depends on it.
123066c4a4SNate Lawson#
133066c4a4SNate Lawson
143066c4a4SNate LawsonCLEANFILES=	gen
153066c4a4SNate Lawson
163066c4a4SNate Lawsontest: ${PROG} gen
173d36fd42SPoul-Henning Kamp.for conv in ascii ebcdic ibm oldascii oldebcdic oldibm \
186a3d33acSPoul-Henning Kamp    pareven parnone parodd parset \
193d36fd42SPoul-Henning Kamp    swab lcase ucase
203066c4a4SNate Lawson	@${ECHO} testing conv=${conv}
213066c4a4SNate Lawson	@./gen | \
223066c4a4SNate Lawson	    LC_ALL=en_US.US-ASCII ./dd conv=${conv} 2>/dev/null | \
233066c4a4SNate Lawson	    LC_ALL=en_US.US-ASCII hexdump -C | \
243d36fd42SPoul-Henning Kamp	    diff -I FreeBSD - ${.CURDIR}/ref.${conv}
253d36fd42SPoul-Henning Kamp.endfor
26cd1832feSThomas Quinot	@${ECHO} "testing sparse file (obs zeroes)"
27cd1832feSThomas Quinot	@./gen 189284 | ./dd ibs=16 obs=8 conv=sparse of=obs_zeroes 2> /dev/null
28cd1832feSThomas Quinot	@hexdump -C obs_zeroes | diff -I FreeBSD - ${.CURDIR}/ref.obs_zeroes
29cd1832feSThomas Quinot
30cd1832feSThomas Quinot	@${ECHO} "testing spase file (all zeroes)"
31cd1832feSThomas Quinot	@./dd if=/dev/zero of=1M_zeroes bs=1048576 count=1 2> /dev/null
32cd1832feSThomas Quinot	@./dd if=1M_zeroes of=1M_zeroes.1 bs=1048576 conv=sparse 2> /dev/null
33cd1832feSThomas Quinot	@./dd if=1M_zeroes of=1M_zeroes.2 bs=1048576 2> /dev/null
34cd1832feSThomas Quinot	@diff 1M_zeroes 1M_zeroes.1
35cd1832feSThomas Quinot	@diff 1M_zeroes 1M_zeroes.2
36cd1832feSThomas Quinot
37cd1832feSThomas Quinot	@rm -f gen 1M_zeroes* obs_zeroes
383066c4a4SNate Lawson
39d511b20aSEnji CooperHAS_TESTS=
404b330699SEnji CooperSUBDIR.${MK_TESTS}+= tests
4136ace8a0SEnji Cooper
423066c4a4SNate Lawson.include <bsd.prog.mk>
43