Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
49c70ff9
Commit
49c70ff9
authored
Oct 27, 2015
by
Rohit Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed sudo permission issue of autotests
parent
36c9872e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
33 deletions
+56
-33
cmake_targets/autotests/run_exec_autotests.bash
cmake_targets/autotests/run_exec_autotests.bash
+14
-31
cmake_targets/build_oai
cmake_targets/build_oai
+7
-2
cmake_targets/tools/build_helper
cmake_targets/tools/build_helper
+35
-0
cmake_targets/tools/init_nas_nos1
cmake_targets/tools/init_nas_nos1
+0
-0
No files found.
cmake_targets/autotests/run_exec_autotests.bash
View file @
49c70ff9
...
...
@@ -7,8 +7,11 @@ else
exit
1
fi
trap
handle_ctrl_c INT
source
$OPENAIR_DIR
/cmake_targets/tools/test_helper
#SUDO="sudo -E "
tdir
=
$OPENAIR_DIR
/cmake_targets/autotests
rm
-fr
$tdir
/bin
$tdir
/log
...
...
@@ -36,7 +39,7 @@ cd $tdir
#\param $12 -> class of the test case (compilation, execution)
#\param $13 -> output of compilation program that needs to be found for test case to pass
#\param $14 -> tags to help identify the test case for readability in output xml file
test_compile
()
{
function
test_compile
()
{
xUnit_start
test_case_name
=
$1
...
...
@@ -130,8 +133,9 @@ test_compile() {
#\param $12 -> class of the test case (compilation, execution)
#\param $13 -> output of compilation program that needs to be found for test case to pass
#\param $14 -> tags to help identify the test case for readability in output xml file
#\param $15 => password for the user to run certain commands as sudo
test_compile_and_run
()
{
function
test_compile_and_run
()
{
xUnit_start
test_case_name
=
$1
log_dir
=
$tdir
/log
...
...
@@ -149,16 +153,13 @@ test_compile_and_run() {
class
=
${
12
}
compile_prog_out
=
${
13
}
tags
=
${
14
}
mypassword
=
${
15
}
build_dir
=
$tdir
/
$1
/build
exec_file
=
$build_dir
/
$6
#Temporary log file where execution log is stored.
temp_exec_log
=
$log_dir
/temp_log.txt
#echo "log_dir = $log_dir"
#echo "log_file = $log_file"
#echo "exec_file = $exec_file"
...
...
@@ -217,7 +218,8 @@ test_compile_and_run() {
echo
"<EXECUTION LOG Run =
$run_index
>"
>>
$log_file
2>&1
if
[
-n
"
$pre_exec_file
"
]
;
then
{
eval
"source
$pre_exec_file
$pre_exec_args
"
;
}
>>
$log_file
2>&1
{
eval
" echo '
$mypassword
' |sudo -S -E
$pre_exec_file
$pre_exec_args
"
;
}>>
$log_file
2>&1
fi
echo
"Executing
$exec_file
$main_exec_args_array_index
"
echo
"Executing
$exec_file
$main_exec_args_array_index
"
>>
$log_file
...
...
@@ -280,29 +282,8 @@ test_compile_and_run() {
dbin
=
$OPENAIR_DIR
/cmake_targets/autotests/bin
dlog
=
$OPENAIR_DIR
/cmake_targets/autotests/log
run_test
()
{
case
=
case
$1
;
shift
cmd
=
$1
;
shift
expected
=
$3
;
shift
echo
"expected =
$expected
"
exit
$cmd
>
$dlog
/
$case
.txt 2>&1
if
[
$expected
=
"true"
]
;
then
if
$*
$dlog
/
$case
.txt
;
then
echo_success
"test
$case
, command:
$cmd
ok"
else
echo_error
"test
$case
, command:
$cmd
Failed"
fi
else
if
$*
$dlog
/
$case
.txt
;
then
echo_error
"test
$case
, command:
$cmd
Failed"
else
echo_success
"test
$case
, command:
$cmd
ok"
fi
fi
}
print_help
(
)
{
function
print_help
()
{
echo_info
'
This program runs automated test case system for OpenAirInterface
You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14
...
...
@@ -314,11 +295,13 @@ Options
'
}
main
()
{
function
main
()
{
RUN_GROUP
=
0
test_case_group
=
""
test_case_group_array
=()
test_case_array
=()
echo_info
"Note that the user should be sudoer for executing certain commands, for example loading kernel modules"
read
-s
-p
"Enter Password: "
mypassword
until
[
-z
"
$1
"
]
do
...
...
@@ -421,7 +404,7 @@ for search_expr in "${test_case_array[@]}"
if
[
"
$class
"
==
"compilation"
]
;
then
test_compile
"
$name
"
"
$compile_prog
"
"
$compile_prog_args
"
"
$pre_exec
"
"
$pre_exec_args
"
"
$main_exec
"
"
$main_exec_args
"
"search_array_true[@]"
"
$search_expr_false
"
"
$nruns
"
"
$pre_compile_prog
"
"
$class
"
"
$compile_prog_out
"
"
$tags
"
elif
[
"
$class
"
==
"execution"
]
;
then
test_compile_and_run
"
$name
"
"
$compile_prog
"
"
$compile_prog_args
"
"
$pre_exec
"
"
$pre_exec_args
"
"
$main_exec
"
"
$main_exec_args
"
"search_array_true[@]"
"
$search_expr_false
"
"
$nruns
"
"
$pre_compile_prog
"
"
$class
"
"
$compile_prog_out
"
"
$tags
"
test_compile_and_run
"
$name
"
"
$compile_prog
"
"
$compile_prog_args
"
"
$pre_exec
"
"
$pre_exec_args
"
"
$main_exec
"
"
$main_exec_args
"
"search_array_true[@]"
"
$search_expr_false
"
"
$nruns
"
"
$pre_compile_prog
"
"
$class
"
"
$compile_prog_out
"
"
$tags
"
"
$mypassword
"
else
echo
"Unexpected class of test case...Exiting...."
fi
...
...
cmake_targets/build_oai
View file @
49c70ff9
...
...
@@ -54,6 +54,8 @@ CFLAGS_PROCESSOR_USER=""
RUN_GROUP
=
0
TEST_CASE_GROUP
=
""
trap
handle_ctrl_c INT
function
print_help
()
{
echo_info
'
This program installs OpenAirInterface Software
...
...
@@ -583,13 +585,16 @@ function main() {
#####################
if
[
"
$OAI_TEST
"
=
"1"
]
;
then
echo_info
"10. Running OAI pre commit tests (pre-ci) ..."
echo_info
"The log file for the autotests is located here:
$OPENAIR_DIR
/cmake_targets/autotests/log/autotests.log "
echo_info
"You can hit CTRL-C any time to terminate the autotests..."
rm
-fr
$OPENAIR_DIR
/cmake_targets/autotests/log
mkdir
-p
$OPENAIR_DIR
/cmake_targets/autotests/log
if
[
"
$RUN_GROUP
"
-eq
"1"
]
;
then
$
SUDO
$OPENAIR_DIR
/cmake_targets/autotests/run_exec_autotests.bash
-g
"
$TEST_CASE_GROUP
"
$
OPENAIR_DIR
/cmake_targets/autotests/run_exec_autotests.bash
-g
"
$TEST_CASE_GROUP
"
>
&
$OPENAIR_DIR
/cmake_targets/autotests/log/autotests.log &
else
$
SUDO
$OPENAIR_DIR
/cmake_targets/autotests/run_exec_autotests.bash
$
OPENAIR_DIR
/cmake_targets/autotests/run_exec_autotests.bash
>
&
$OPENAIR_DIR
/cmake_targets/autotests/log/autotests.log &
fi
wait
else
echo_info
"10. Bypassing the Tests ..."
fi
...
...
cmake_targets/tools/build_helper
View file @
49c70ff9
...
...
@@ -319,3 +319,38 @@ set_openair_env(){
export OPENAIR_TARGETS=$openair_path/targets
}
################################
# Function to killall the subprocesses when Ctrl-C Key is hit
###############################
function handle_ctrl_c(){
CURPID=$$
ppid=$$
arraycounter=1
echo_info "** Trapped CTRL-C. Killing all subprocesses now..."
while true
do
FORLOOP=FALSE
# Get all the child process id
for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'`
do
if [ $i -ne $CURPID ] ; then
procid[$arraycounter]=$i
arraycounter=`expr $arraycounter + 1`
ppid=$i
FORLOOP=TRUE
fi
done
if [ "$FORLOOP" = "FALSE" ] ; then
arraycounter=`expr $arraycounter - 1`
## We want to kill child process id first and then parent id's
while [ $arraycounter -ne 0 ]
do
$SUDO kill -9 "${procid[$arraycounter]}" >/dev/null
arraycounter=`expr $arraycounter - 1`
done
exit
fi
done
}
cmake_targets/tools/init_nas_nos1
100644 → 100755
View file @
49c70ff9
File mode changed from 100644 to 100755
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment