This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
tsmpipe/test/test.sh

44 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/sh
set -e
2016-06-23 11:29:18 +00:00
FILE=random.1m
# Create TEST File
MD5=$(dd if=/dev/urandom bs=1024 count=1024 2>/dev/null |tee ${FILE} |md5sum |awk '{print $1}')
SIZE=$(ls -l ${FILE}|awk '{print $5}')
TSMPIPE=../tsmpipe
echo "MD5 of [${FILE}] is [${MD5}] (${SIZE})"
ln -s /opt/tivoli/tsm/client/api/bin64/EN_US
export DSMI_DIR=./
export DSMI_CONFIG=dsm.opt
2016-06-23 11:29:18 +00:00
# Send file to TSM
echo "+ TEST SEND FILE!"
cat ${FILE} | ${TSMPIPE} -Bcm MD5 -s /test -f ${FILE} -vvv -l ${SIZE} -O"-VIRTUALNODENAME=TEST -PASSWORD=TEST"
# Send a second time
echo "+ TEST SEND FILE AGAIN!"
cat ${FILE} | ${TSMPIPE} -Bcm MD5 -s /test -f ${FILE} -vvv -l ${SIZE} -O"-VIRTUALNODENAME=TEST -PASSWORD=TEST"
# List it
echo "+ TEST LIST FILE!"
${TSMPIPE} -Bts /test -f ${FILE} -vvv -O"-VIRTUALNODENAME=TEST -PASSWORD=TEST"
# Get it back
echo "+ TEST RETRIEVE FILE!"
${TSMPIPE} -Bxs /test -f ${FILE} -vvv -O"-VIRTUALNODENAME=TEST -PASSWORD=TEST" > ${FILE}.back
RETRIEVE=$(md5sum ${FILE}.back | awk '{print $1}')
if [ "${MD5}" != "${RETRIEVE}" ]; then
exit 1
else
echo "+ RETRIEVE VALID (${RETRIEVE})!"
2016-06-23 11:29:18 +00:00
fi
# Delete it
echo "+ TEST DELETE!"
${TSMPIPE} -Bds /test -f ${FILE} -vvv -O"-VIRTUALNODENAME=TEST -PASSWORD=TEST"
2016-06-23 11:29:18 +00:00
rm -f EN_US ${FILE} ${FILE}.back