Commit 5a7fe385 authored by guptar's avatar guptar

added new test cases for PHY unitary simulation for secuirity

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7878 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 95ed87d1
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS False)
set(DEBUG_PHY False)
set(MU_RECIEVER Flase)
set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
......@@ -16,7 +16,7 @@ source $OPENAIR_DIR/cmake_targets/tools/test_helper
test_compile() {
xUnit_start
test_name=$1
test_name=$1.$2
compile_prog=$2
exec_prog=$3
build_dir=$tdir/$1/build
......@@ -101,8 +101,6 @@ test_compile \
test.0104 mbmssim \
mbmssim $tdir/bin/mbmssim mbmssim.Rel8
simlist=" secu_knas_encrypt_eea2 secu_knas kdf aes128_cmac_encrypt secu_knas_encrypt_eia2"
test_compile \
test.0104 test_secu_knas_encrypt_eia1 \
test_secu_knas_encrypt_eia1 $tdir/bin/test_secu_knas_encrypt_eia1 test_secu_knas_encrypt_eia1.Rel10
......
#!/bin/bash
if [ -s $OPENAIR_DIR/cmake_targets/tools/test_helper ] ; then
source $OPENAIR_DIR/cmake_targets/tools/test_helper
if [ -s $OPENAIR_DIR/cmake_targets/tools/build_helper ] ; then
source $OPENAIR_DIR/cmake_targets/tools/build_helper
else
echo "Error: no file in the file tree: is OPENAIR_DIR variable set?"
exit 1
fi
source $OPENAIR_DIR/cmake_targets/tools/test_helper
SUDO="sudo -E "
#SUDO="sudo -E "
tdir=$OPENAIR_DIR/cmake_targets/autotests
mkdir -p $tdir/bin $tdir/log
results_file="$tdir/log/execution_autotests.xml"
......@@ -29,11 +30,12 @@ cd $tdir
#\param $6 -> name of executable
#\param $7 -> arguments for running the program
#\param $8 -> search expression
#\param $9 -> number of runs
#\param $9 -> search expression which should NOT be found (for ex. segmentation fault)
#\param $10 -> number of runs
test_compile_and_run() {
xUnit_start
test_case_name=$1
test_case_name=$1.$2
log_dir=$tdir/log
log_file=$tdir/log/test.$1.txt
compile_prog=$2
......@@ -42,7 +44,8 @@ test_compile_and_run() {
pre_exec_args=$5
exec_args=$7
search_expr=$8
nruns=$9
search_expr_negative=$9
nruns=${10}
build_dir=$tdir/$1/build
exec_file=$build_dir/$6
......@@ -54,13 +57,17 @@ test_compile_and_run() {
rm -fr $build_dir
mkdir -p $build_dir
# echo "log_dir = $log_dir"
# echo "log_file = $log_file"
# echo "exec_file = $exec_file"
# echo "args = $args"
# echo "search_expr = $search_expr"
# echo "pre_exec_file = $pre_exec_file"
#echo "log_dir = $log_dir"
#echo "log_file = $log_file"
#echo "exec_file = $exec_file"
#echo "args = $args"
#echo "search_expr = $search_expr"
#echo "pre_exec_file = $pre_exec_file"
#echo "nruns = $nruns"
echo "<COMPILATION LOG>" > $log_file
cd $build_dir
{
......@@ -78,18 +85,40 @@ test_compile_and_run() {
echo "-----------------------------------------------------------------------------" >> $log_file 2>&1
echo "<EXECUTION LOG Run = $run_index >" >> $log_file 2>&1
if [ -n "$pre_exec_file" ]; then
{ source $pre_exec_file $pre_exec_args; } >> $log_file 2>&1
fi
{ $exec_file $exec_args ;} > $temp_exec_log 2>&1
source $pre_exec_file $pre_exec_args >> $log_file 2>&1
$exec_file $exec_args > $temp_exec_log 2>&1
cat $temp_exec_log >> $log_file 2>&1
echo "</EXECUTION LOG Run = $run_index >" >> $log_file 2>&1
search_result=`grep "$search_expr" $temp_exec_log`
search_result=`grep -E "$search_expr" $temp_exec_log`
test_case_result=""
if [ -z "$search_result" ]; then
xUnit_fail "execution" "$test_case_name" "FAIL" "$run_index"
test_case_result="FAIL"
else
xUnit_success "execution" "$test_case_name" "PASS" "$run_index"
test_case_result="PASS"
fi
#If we find a negative search result then there is crash of program and test case is failed even if above condition is true
search_result=`grep -iE "$search_expr_negative" $temp_exec_log`
if [ -n "$search_result" ]; then
test_case_result="FAIL"
fi
if [ "$test_case_result" == "FAIL" ]; then
echo_error "execution $test_case_name FAIL $run_index"
xUnit_fail "execution" "$test_case_name" "FAIL" "$run_index"
fi
if [ "$test_case_result" == "PASS" ]; then
echo_success "execution $test_case_name PASS $run_index"
xUnit_success "execution" "$test_case_name" "PASS" "$run_index"
fi
# End of for loop
......@@ -130,12 +159,36 @@ fi
#$5 -> arguments of pre-executable
#$6 -> name of executable
#$7 -> arguments for running the program
#$8 -> search expression
#$9 -> number of runs
#$8 -> search expression which needs to be found
#$9 -> search expression which should NOT be found (for ex. segmentation fault)
#$10 -> number of runs
#oaisim tests
test_compile_and_run 0200 "oaisim_nos1" "" "$OPENAIR_DIR/cmake_targets/tools/init_nas_nos1" "" "oaisim_nos1" " -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -b1 -u1 -n1000" "RRC_CONN" "segmentation fault|assertion" 3
test_compile_and_run 0201 "oaisim_nos1" "" "$OPENAIR_DIR/cmake_targets/tools/init_nas_nos1" "" "oaisim_nos1" " -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -b1 -u1 -a -n1000" "RRC_CONN" "segmentation fault|assertion" 3
#PHY unitary simulations for secuirity tests
test_compile_and_run 0300 "test_aes128_cmac_encrypt" "" "" "" "test_aes128_cmac_encrypt" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0301 "test_aes128_ctr_decrypt" "" "" "" "test_aes128_ctr_decrypt" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0302 "test_aes128_ctr_encrypt" "" "" "" "test_aes128_ctr_encrypt" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0303 "test_secu_kenb" "" "" "" "test_secu_kenb" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0304 "test_secu_knas" "" "" "" "test_secu_knas" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0305 "test_secu_knas_encrypt_eea1" "" "" "" "test_secu_knas_encrypt_eea1" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0306 "test_secu_knas_encrypt_eea2" "" "" "" "test_secu_knas_encrypt_eea2" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0307 "test_secu_knas_encrypt_eia1" "" "" "" "test_secu_knas_encrypt_eia1" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0200 "oaisim_nos1" "" "$OPENAIR_DIR/cmake_targets/tools/init_nas_nos1" "" "oaisim_nos1" " -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -b1 -u1 -n1000" "RRC_CONN" 3
test_compile_and_run 0308 "test_secu_knas_encrypt_eia2" "" "" "" "test_secu_knas_encrypt_eia2" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
test_compile_and_run 0201 "oaisim_nos1" "" "$OPENAIR_DIR/cmake_targets/tools/init_nas_nos1" "" "oaisim_nos1" " -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -b1 -u1 -a -n1000" "RRC_CONN" 3
test_compile_and_run 0309 "test_kdf" "" "" "" "test_kdf" " --verbose" "finished with 0 errors" "segmentation fault|assertion" 3
#test_compile_and_run 0200 "oaisim_nos1" "" "$OPENAIR_DIR/cmake_targets/tools/init_nas_nos1" "" "oaisim_nos1" " -O /home/calisson/rohit/oai_snav/taets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -b1 -u1 -a " "RRC_CONN" 3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment