summaryrefslogtreecommitdiff
path: root/regress/usr.bin/gzip/t2.sh
blob: 9d2d39f4c67c66f3c8aeb7b38ecbbf793a5f1eb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
# $OpenBSD: t2.sh,v 1.1 2008/08/20 09:29:51 mpf Exp $

# test basic gzip functionality

gzip -c /etc/rc > t1.gz
if ! gzip -vt t1.gz; then
	echo "=> ERROR: could not gzip"
	exit 1
else
	echo "=> OK"
fi

if ! gunzip -c t1.gz | cmp -s - /etc/rc; then
	echo "=> ERROR: uncompressed file does not match"
	gunzip -c t1.gz | diff - /etc/rc
	exit 1
else
	echo "=> OK"
fi

gzip -c /etc/rc /etc/motd > t1.gz
if ! gzip -vt t1.gz; then
	echo "=> ERROR: could not gzip multiple files"
	exit 1
else
	echo "=> OK"
fi

cat /etc/rc /etc/motd > rcmotd.test
if ! gunzip -c t1.gz | cmp -s - rcmotd.test; then
	echo "=> ERROR: gunzipped files do not match"
	gunzip -c t1.gz | diff - rcmotd.test
	exit 1
else
	echo "=> OK"
fi

exit 0