#!/bin/bash

export TCID=fio; export TST_TOTAL=8; export TST_COUNT=1

. run_profile.txt
. $base_dir/plans/commands/common.fns
export PATH=/usr/local/bin:$PATH

tst_resm TINFO "BEGIN PACKAGE $TCID"
# Check needed vars from run_profile.txt
[ ! -d "$run_dir" ] && tst_resm TCONF "ERROR: $run_dir does not exist" && exit -10

CPUCOUNT=`cpus_online.sh`

SUT=`hostname -s`
tst_resm TINFO "Running fio on SUT: $SUT with $CPUCOUNT CPUs"
export CPUCOUNT

log_dir="$run_dir/test_output"
mkdir -p $log_dir

jobfile="$PKGS_DIR/fio/stresser.fio"
echo "===== begin jobfile: $jobfile: ====="
cat $jobfile
echo "===== end jobfile; ====="

runit="/usr/bin/time fio"

tst_resm TINFO "begin fio stresser job"
run_test "fio" "$runit $jobfile" "$log_dir" "fio-stress.log"
tst_status $? fio-stresser

# maybe print some selective log output:
# $all_pkgs_dir/posixtestsuite/posixtest-summary.sh

tst_resm TINFO fini
exit 0
