#!/bin/sh
export TCID="atuned.cnf module configuration test"
. ./test_lib.sh
init()
{
echo "init the system"
cp -a $ATUNE_CONF $ATUNE_CONF.bak
change_conf_value sample_num 2
}
cleanup()
{
echo "===================="
echo "Clean the System"
echo "===================="
mv $ATUNE_CONF.bak $ATUNE_CONF
}
test01()
{
tst_resm TINFO "atuned.cnf file's module configuration test"
array=("mem_topo" "cpu_topo" "net_topo" "storage_topo" "mem_topo, cpu_topo, net_topo, storage_topo")
for ((i=0;i<${#array[@]};i++));do
rm -rf /usr/share/atuned/checker/*
change_conf_value module ${array[i]}
systemctl restart $ATUNE_SERVICE_NAME
check_result $? 0
wait_service_ready $ATUNE_SERVICE_NAME
if [ `expr index "${array[i]}" ","` -ne 0 ];then
arr=(${array[i]//,/})
for ((j=0;j<${#arr[@]};j++));do
wait_condition 10 'ls -l /usr/share/atuned/checker/${arr[j]}.xml'
ls -l /usr/share/atuned/checker/${arr[j]}.xml
check_result $? 0
done
else
wait_condition 10 'ls -l /usr/share/atuned/checker/${array[i]}.xml'
check_result $? 0
fi
atune-adm analysis
check_result $? 0
done
array1=("$SPECIAL_CHARACTERS" "$ULTRA_LONG_CHARACTERS" "")
for ((i=0;i<${#array1[@]};i++));do
rm -rf /usr/share/atuned/checker/*
change_conf_value module ${array1[i]}
atune-adm rollback
systemctl restart $ATUNE_SERVICE_NAME
check_result $? 0
wait_service_ready $ATUNE_SERVICE_NAME
wait_condition 10 'ls -l /usr/share/atuned/checker/*_topo.xml'
check_result $? 1
ls -l /usr/share/atuned/checker/
atune-adm analysis
check_result $? 0
done
rm -rf /usr/share/atuned/checker/*
comment_conf_value module
systemctl restart $ATUNE_SERVICE_NAME
check_result $? 0
wait_service_ready $ATUNE_SERVICE_NAME
xml_files=`ls -l /usr/share/atuned/checker/*.xml | wc -l`
if [ $xml_files -ne 0 ];then
((EXIT_FLAG++))
fi
ls -l /usr/share/atuned/checker/
atune-adm analysis
check_result $? 0
if [ $EXIT_FLAG -ne 0 ];then
tst_resm TFAIL
else
tst_resm TPASS
fi
}
TST_CLEANUP=cleanup
init
test01
tst_exit