1#!/bin/sh
2
3###############################################################################
4#
5# Author: Lasse Collin
6#
7# This file has been put into the public domain.
8# You can do whatever you want with this file.
9#
10###############################################################################
11
12# If both xz and xzdec were not build, skip this test.
13XZ=../src/xz/xz
14XZDEC=../src/xzdec/xzdec
15test -x "$XZ" || XZ=
16test -x "$XZDEC" || XZDEC=
17if test -z "$XZ$XZDEC"; then
18	(exit 77)
19	exit 77
20fi
21
22for I in "$srcdir"/files/good-*.xz
23do
24	if test -z "$XZ" || "$XZ" -dc "$I" > /dev/null; then
25		:
26	else
27		echo "Good file failed: $I"
28		(exit 1)
29		exit 1
30	fi
31
32	if test -z "$XZDEC" || "$XZDEC" "$I" > /dev/null; then
33		:
34	else
35		echo "Good file failed: $I"
36		(exit 1)
37		exit 1
38	fi
39done
40
41for I in "$srcdir"/files/bad-*.xz
42do
43	if test -n "$XZ" && "$XZ" -dc "$I" > /dev/null 2>&1; then
44		echo "Bad file succeeded: $I"
45		(exit 1)
46		exit 1
47	fi
48
49	if test -n "$XZDEC" && "$XZDEC" "$I" > /dev/null 2>&1; then
50		echo "Bad file succeeded: $I"
51		(exit 1)
52		exit 1
53	fi
54done
55
56(exit 0)
57exit 0
58