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
2016-06-23 21:29:18 +10:00

42 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
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=./
# 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!"
fi
# Delete it
echo "+ TEST DELETE!"
./${TSMPIPE} -Bds /test -f ${FILE} -vvv -O"-VIRTUALNODENAME=TEST -PASSWORD=TEST"
rm -f EN_US ${FILE} ${FILE}.back