2016-12-12 22:46:52 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-12-20 05:05:22 -06:00
|
|
|
source test-variables
|
|
|
|
SUMMARY=0
|
|
|
|
if [[ "$1" == "summary" ]] ; then
|
|
|
|
SUMMARY=plain
|
|
|
|
elif [[ "$1" == "csv" ]] ; then
|
|
|
|
SUMMARY=csv
|
2016-12-20 05:15:31 -06:00
|
|
|
else
|
|
|
|
if [[ -z $MEM_TESTABLE ]] ; then
|
|
|
|
source scan-meminfo
|
|
|
|
fi
|
|
|
|
CONCURRENCY=`echo $1 | sed 's/[^0-9]//g'`
|
2016-12-20 05:05:22 -06:00
|
|
|
fi
|
|
|
|
|
2016-12-20 05:15:31 -06:00
|
|
|
if [[ -z $OUTPUT_DIR ]] ; then
|
|
|
|
source scan-dmidecode
|
2016-12-13 19:52:26 -06:00
|
|
|
fi
|
|
|
|
|
2016-12-20 05:05:22 -06:00
|
|
|
DEFAULT_CONCURRENCY=4
|
|
|
|
[[ -z $CONCURRENCY ]] && CONCURRENCY=$DEFAULT_CONCURRENCY
|
2016-12-14 19:45:04 -06:00
|
|
|
[[ $CONCURRENCY == 0 ]] && exit 10
|
|
|
|
|
2016-12-20 05:05:22 -06:00
|
|
|
if [[ $SUMMARY == 0 ]] ; then
|
|
|
|
MEM_PER_PROC=`echo $(( MEM_TESTABLE / CONCURRENCY )) | sed 's/\..*$//'`
|
|
|
|
for (( PROC=1; PROC<=$CONCURRENCY; PROC=PROC+1 )) ; do
|
|
|
|
echo "Process $PROC: testing $MEM_PER_PROC kB with memtester ..."
|
|
|
|
#memtester ${MEM_TESTABLE}K 1 > $OUTPUT_DIR/memtester
|
|
|
|
wrapper-memtester $MEM_PER_PROC $PROC &
|
|
|
|
#sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
JOBS_WAITING=$CONCURRENCY
|
2016-12-20 05:48:03 -06:00
|
|
|
while (( $JOBS_WAITING > 0 )) ; do
|
|
|
|
sleep 1
|
2016-12-20 05:05:22 -06:00
|
|
|
JOBS_WAITING=`jobs -r | wc -l`
|
|
|
|
#echo "Jobs waiting: $JOBS_WAITING"
|
|
|
|
done
|
2016-12-20 05:48:03 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
#snapshot
|
|
|
|
mkdir -p $SNAPSHOT_D
|
|
|
|
cp -af $OUTPUT_DIR/* $SNAPSHOT_D/
|
|
|
|
|
|
|
|
#echo "summary: $SUMMARY"
|
|
|
|
if [[ "$SUMMARY" != "0" ]] ; then
|
2016-12-20 05:05:22 -06:00
|
|
|
if [[ $SUMMARY == plain ]] ; then
|
2016-12-20 05:15:31 -06:00
|
|
|
echo "=====> MEMTESTER SUMMARY <====="
|
2016-12-20 05:05:22 -06:00
|
|
|
elif [[ $SUMMARY == csv ]] ; then
|
2016-12-20 05:15:31 -06:00
|
|
|
echo "=====> MEMTESTER CSV SUMMARY <====="
|
2016-12-20 05:19:00 -06:00
|
|
|
echo "SERVER|PROCESS|TESTED_MEMORY|DURATION|RESULT|COMMENT" \
|
2016-12-20 05:05:22 -06:00
|
|
|
> $OUTPUT_DIR/memtester.csv
|
|
|
|
fi
|
|
|
|
for (( PROC=1; PROC<=$CONCURRENCY; PROC=PROC+1 )) ; do
|
|
|
|
if [[ $SUMMARY == plain ]] ; then
|
|
|
|
if [[ -f $OUTPUT_DIR/memtester_$PROC.result ]] ; then
|
|
|
|
cat $OUTPUT_DIR/memtester_$PROC.result
|
|
|
|
fi
|
|
|
|
elif [[ $SUMMARY == csv ]] ; then
|
|
|
|
if [[ -f $OUTPUT_DIR/memtester_$PROC.csv ]] ; then
|
|
|
|
cat $OUTPUT_DIR/memtester_$PROC.csv \
|
|
|
|
>> $OUTPUT_DIR/memtester.csv
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ $SUMMARY == csv ]] ; then
|
2016-12-20 05:15:31 -06:00
|
|
|
cat $OUTPUT_DIR/memtester.csv \
|
|
|
|
| sed "s/^\([^|]\+\)/${BLD}\1${OFF}/ ; s/OK/${GRN}OK${OFF}/ ; s/FAIL/${RED}FAIL${OFF}/ ; s/RESULT/${BLD}RESULT${OFF}/ "
|
2016-12-20 05:05:22 -06:00
|
|
|
fi
|
|
|
|
fi
|
2016-12-13 19:52:26 -06:00
|
|
|
|