#!/bin/sh
# PCP QA Test No. 1669
# exercise pmlogls
#
# Copyright (c) 2026 Ken McDonell.  All Rights Reserved.
#

if [ $# -eq 0 ]
then
    seq=`basename $0`
    echo "QA output created by $seq"
else
    # use $seq from caller, unless not set
    [ -n "$seq" ] || seq=`basename $0`
    echo "QA output created by `basename $0` $*"
fi

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

_filter()
{
    sed \
	-e "s@$here@HERE@" \
    # end
}

status=0	# success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

# real QA test starts here

for arg in archives/foo+ archives/ok-mv-bigbin no-such-archive \
	    tmparch/mv-bar.meta $here/archives/amdgpu-0.0.xz
do
    echo
    echo "=== $arg ===" | _filter
    pmlogls $arg 2>&1 | _filter
done

# no dir component
#
cd archives
for arg in foo+ amdgpu-0.0.xz
do
    echo
    echo "=== $arg ===" | _filter
    pmlogls $arg 2>&1 | _filter
done

# success, all done
exit
