11556Srgrimes#	@(#)Makefile	8.1 (Berkeley) 5/31/93
250471Speter# $FreeBSD: stable/11/bin/dd/Makefile 338364 2018-08-29 02:18:13Z kevans $
31556Srgrimes
4289487Sngie.include <src.opts.mk>
5289487Sngie
6298107SgjbPACKAGE=runtime
71556SrgrimesPROG=	dd
81556SrgrimesSRCS=	args.c conv.c conv_tab.c dd.c misc.c position.c
9338364SkevansLIBADD= util
101556Srgrimes
11126666Sphk#
12126666Sphk# Test the character conversion functions.  We have to be explicit about
13126666Sphk# which LC_LANG we use because the definition of upper and lower case
14126666Sphk# depends on it.
15128048Snjl#
16128048Snjl
17128048SnjlCLEANFILES=	gen
18128048Snjl
19128048Snjltest: ${PROG} gen
20126666Sphk.for conv in ascii ebcdic ibm oldascii oldebcdic oldibm \
21126667Sphk    pareven parnone parodd parset \
22126666Sphk    swab lcase ucase
23128048Snjl	@${ECHO} testing conv=${conv}
24128048Snjl	@./gen | \
25128048Snjl	    LC_ALL=en_US.US-ASCII ./dd conv=${conv} 2>/dev/null | \
26128048Snjl	    LC_ALL=en_US.US-ASCII hexdump -C | \
27128048Snjl	    diff -I FreeBSD - ${.CURDIR}/ref.${conv}
28126666Sphk.endfor
29295749Sthomas	@${ECHO} "testing sparse file (obs zeroes)"
30295749Sthomas	@./gen 189284 | ./dd ibs=16 obs=8 conv=sparse of=obs_zeroes 2> /dev/null
31295749Sthomas	@hexdump -C obs_zeroes | diff -I FreeBSD - ${.CURDIR}/ref.obs_zeroes
32128048Snjl
33295749Sthomas	@${ECHO} "testing spase file (all zeroes)"
34295749Sthomas	@./dd if=/dev/zero of=1M_zeroes bs=1048576 count=1 2> /dev/null
35295749Sthomas	@./dd if=1M_zeroes of=1M_zeroes.1 bs=1048576 conv=sparse 2> /dev/null
36295749Sthomas	@./dd if=1M_zeroes of=1M_zeroes.2 bs=1048576 2> /dev/null
37295749Sthomas	@diff 1M_zeroes 1M_zeroes.1
38295749Sthomas	@diff 1M_zeroes 1M_zeroes.2
39295749Sthomas
40295749Sthomas	@rm -f gen 1M_zeroes* obs_zeroes
41295749Sthomas
42289487Sngie.if ${MK_TESTS} != "no"
43289487SngieSUBDIR+=	tests
44289487Sngie.endif
45289487Sngie
46128048Snjl.include <bsd.prog.mk>
47