From 958738477c52cf5d0a3bdacf11400e8ed19f6420 Mon Sep 17 00:00:00 2001
From: Rohit Gupta <rohit.gupta@eurecom.fr>
Date: Tue, 8 Dec 2015 10:31:32 +0100
Subject: [PATCH] minor updates to the autotest launch script

---
 cmake_targets/autotests/run_exec_autotests.bash |  7 ++++---
 cmake_targets/build_oai                         | 13 +++++++++----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/cmake_targets/autotests/run_exec_autotests.bash b/cmake_targets/autotests/run_exec_autotests.bash
index a447ac3b93..2101c84735 100755
--- a/cmake_targets/autotests/run_exec_autotests.bash
+++ b/cmake_targets/autotests/run_exec_autotests.bash
@@ -400,12 +400,13 @@ else
 fi
 
 tmpfile=`mktemp`
-echo \'$passwd\' | sudo echo $HOME >& $tmpfile
+echo \'$passwd\' | $SUDO echo $HOME >& $tmpfile
 tstsudo=`cat $tmpfile`
 if [ "$tstsudo" != "$HOME" ]; then
-  echo "User might not have sudo privileges. Exiting" 
-  echo "tstsudo = $tstsudo"
+  echo "$USER might not have sudo privileges. Exiting" 
   exit
+else
+  echo "$USER has sudo privileges"
 fi
 echo "tstsudo = $tstsudo"
 rm -fr $tmpfile
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 6d337c6d52..25bec96b98 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -555,17 +555,22 @@ function main() {
   #####################
   if [ "$OAI_TEST" = "1" ]; then
     echo_info "10. Running OAI pre commit tests (pre-ci) ..."
-    read -s -p "Enter Password: " mypassword
-    echo -e "\n"
+    echo_error "These scripts ASSUME that user is in /etc/sudoers and can execute commands without PASSWORD prompt"
+    echo_error "Add the following lines in /etc/sudoers file to make your __user_name__ sudo without password prompt"
+    echo_error " __your_user_name__ ALL = (ALL:ALL) NOPASSWD: ALL"
+    echo_error " __your_user_name__ ALL = (ALL) NOPASSWD: ALL "
     echo_info "The log file for the autotest script for debugging is located here: $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log "
     echo_info "The results of autotests results is located here: $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml "
     echo_info "You can hit CTRL-C any time to terminate the autotests..."
+    echo "Current User Name: $USER"
+    read -s -p "Enter Password: " mypassword
+    echo -e "\n"
     rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
     mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
     if [ "$RUN_GROUP" -eq "1" ]; then
-        echo '$mypassword'  | $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
+        $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" -p '$mypassword' >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
     else
-        echo '$mypassword'  | $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
+        $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -p '$mypassword' >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
     fi
     wait
   else
-- 
GitLab