11556Srgrimes#	@(#)Makefile	8.1 (Berkeley) 5/31/93
250471Speter# $FreeBSD$
31556Srgrimes
4290574Sngie.include <bsd.own.mk>
5290574Sngie
61556SrgrimesPROG=	dd
71556SrgrimesSRCS=	args.c conv.c conv_tab.c dd.c misc.c position.c
81556Srgrimes
9126666Sphk#
10126666Sphk# Test the character conversion functions.  We have to be explicit about
11126666Sphk# which LC_LANG we use because the definition of upper and lower case
12126666Sphk# depends on it.
13128048Snjl#
14128048Snjl
15128048SnjlCLEANFILES=	gen
16128048Snjl
17128048Snjltest: ${PROG} gen
18126666Sphk.for conv in ascii ebcdic ibm oldascii oldebcdic oldibm \
19126667Sphk    pareven parnone parodd parset \
20126666Sphk    swab lcase ucase
21128048Snjl	@${ECHO} testing conv=${conv}
22128048Snjl	@./gen | \
23128048Snjl	    LC_ALL=en_US.US-ASCII ./dd conv=${conv} 2>/dev/null | \
24128048Snjl	    LC_ALL=en_US.US-ASCII hexdump -C | \
25128048Snjl	    diff -I FreeBSD - ${.CURDIR}/ref.${conv}
26126666Sphk.endfor
27298258Sthomas	@${ECHO} "testing sparse file (obs zeroes)"
28298258Sthomas	@./gen 189284 | ./dd ibs=16 obs=8 conv=sparse of=obs_zeroes 2> /dev/null
29298258Sthomas	@hexdump -C obs_zeroes | diff -I FreeBSD - ${.CURDIR}/ref.obs_zeroes
30128048Snjl
31298258Sthomas	@${ECHO} "testing spase file (all zeroes)"
32298258Sthomas	@./dd if=/dev/zero of=1M_zeroes bs=1048576 count=1 2> /dev/null
33298258Sthomas	@./dd if=1M_zeroes of=1M_zeroes.1 bs=1048576 conv=sparse 2> /dev/null
34298258Sthomas	@./dd if=1M_zeroes of=1M_zeroes.2 bs=1048576 2> /dev/null
35298258Sthomas	@diff 1M_zeroes 1M_zeroes.1
36298258Sthomas	@diff 1M_zeroes 1M_zeroes.2
37298258Sthomas
38298258Sthomas	@rm -f gen 1M_zeroes* obs_zeroes
39298258Sthomas
40290574Sngie.if ${MK_TESTS} != "no"
41290574SngieSUBDIR+=	tests
42290574Sngie.endif
43290574Sngie
44128048Snjl.include <bsd.prog.mk>
45