#!/bin/sh
# PCP QA Test No. 1570
# Exercise compressed archive files - zstd version
#
# Copyright (c) 2014 Red Hat.
# Copyright (c) 2010,2024 Ken McDonell.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

. ./common.compress

which zstd >/dev/null 2>&1 || _notrun No zstd binary installed

args=''
for try in --rm --quiet --no-progress
do
    touch $tmp.try
    if zstd -c "$try" $tmp.try >/dev/null 2>&1
    then
	args="$args $try"
    fi
done
rm -f $tmp.try

status=1	# failure is the default!
trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15

echo "args=$args" >>$seq_full

# real QA test starts here
_prepare_compress "zstd$args" "zstd -d$args" zst
_exercise_compression 2>&1 \
| sed -e "s/$args/ ARGS/"

status=0	# success, we're all done
exit
