#!/bin/bash

. run_profile.txt
. $base_dir/plans/commands/common.fns
. $base_dir/plans/commands/build_farm.fns

report "PACKAGE mmap_truncate"
# Check needed vars from run_profile.txt
[ ! -d "$run_dir" ] && fatal "$run_dir does not exist" && exit -10

SUT=`hostname -s`
log_dir="$run_dir/test_output"
report "EXEC mkdir -p $log_dir"
mkdir -p $log_dir

# use $IOFILES for test files; could expand to more fstypes later.
IOFILES=/root/tmp
report "EXEC mkdir -p $IOFILES"
mkdir -p $IOFILES
cd $IOFILES

cmd="/usr/bin/time mmap_truncate $IOFILES/testfile"
message "using: $cmd"

report "EXEC Running mmap_truncate on SUT: $SUT"
export PATH=/usr/local/bin:$PATH

run_test "mmap_truncate" "$cmd" "$log_dir" "mmap_truncate.log"
sts=$?
# convert signal 2 to success
if [ $sts = 2 ]; then
	sts=0
fi
report_status $sts mmap_truncate $sts

exit 0
