[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-cvs
Subject:    [Ltp-cvs] ltp/testcases/commands/at at_deny01,1.4,1.5
From:       Garrett Cooper <yaberauneya () users ! sourceforge ! net>
Date:       2010-01-31 22:43:29
Message-ID: E1NbiVt-0002b4-Ee () sfp-cvsdas-2 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ltp/ltp/testcases/commands/at
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9871/testcases/commands/at

Modified Files:
	at_deny01 
Log Message:
1. Correct some style notes.
2. Add a check for the at command.
3. Parameterize $TMP.

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>



Index: at_deny01
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/commands/at/at_deny01,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** at_deny01	23 Aug 2009 06:31:45 -0000	1.4
--- at_deny01	31 Jan 2010 22:43:27 -0000	1.5
***************
*** 28,31 ****
--- 28,32 ----
  #
  
+ TMP=${TMP:=/tmp}
  deny="/etc/at.deny"
  test_user1="test_user_1"
***************
*** 33,37 ****
  test_user2_home="/home/${test_user2}"
  test_user1_home="/home/${test_user1}"
! tmpfile="/tmp/at_deny_test"
  
  #-----------------------------------------------------------------------
--- 34,38 ----
  test_user2_home="/home/${test_user2}"
  test_user1_home="/home/${test_user1}"
! tmpfile="$TMP/at_deny_test"
  
  #-----------------------------------------------------------------------
***************
*** 57,62 ****
  
      # Create the 1st user.
!     useradd -g users -d "${test_user1_home}" -m "${test_user1}"
!     if [ $? != 0 ]; then
  	echo "Could not add test user ${test_user1} to system."
  	exit 1
--- 58,62 ----
  
      # Create the 1st user.
!     if ! useradd -g users -d "${test_user1_home}" -m "${test_user1}"; then
  	echo "Could not add test user ${test_user1} to system."
  	exit 1
***************
*** 64,69 ****
  
      # Create the 2nd user.
!     useradd -g users -d "${test_user2_home}" -m "${test_user2}"
!     if [ $? != 0 ]; then
  	echo "Could not add test user ${test_user2} to system."
  	exit 1
--- 64,68 ----
  
      # Create the 2nd user.
!     if ! useradd -g users -d "${test_user2_home}" -m "${test_user2}"; then
  	echo "Could not add test user ${test_user2} to system."
  	exit 1
***************
*** 112,116 ****
          echo "(1) TEST THAT PERSON NOT IN ${deny} IS ABLE TO RUN JOB."
  	echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
!          at -m now + 1 minutes	
          if [ $? != 0 ]; then
              echo "Error while adding job using at for user ${test_user1}."
--- 111,115 ----
          echo "(1) TEST THAT PERSON NOT IN ${deny} IS ABLE TO RUN JOB."
  	echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
!         at -m now + 1 minutes	
          if [ $? != 0 ]; then
              echo "Error while adding job using at for user ${test_user1}."
***************
*** 153,157 ****
          rm -f "${tmpfile}" >/dev/null 2>&1
  	exit ${exit_code}
! fi
  }
  
--- 152,156 ----
          rm -f "${tmpfile}" >/dev/null 2>&1
  	exit ${exit_code}
!     fi
  }
  
***************
*** 159,174 ****
  # FUNCTION: main
  #-----------------------------------------------------------------------
! if [ $(whoami) = "root" ]; then
      do_setup
      echo "${test_user2}" >"${deny}"
      exit_code=0
!     
!     su "${test_user1}" -lc "${test_user1_home}/$(basename $0)"
!     if [ $? != 0 ]; then
  	exit_code=1
!     fi
!     
!     su "${test_user2}" -lc "${test_user2_home}/$(basename $0)"
!     if [ $? != 0 ]; then
  	exit_code=1
      fi 
--- 158,171 ----
  # FUNCTION: main
  #-----------------------------------------------------------------------
! if type at > /dev/null; then
!     tst_resm TCONF "at command not found on system"
! elif [ "$(id -ru)" = 0 ]; then
      do_setup
      echo "${test_user2}" >"${deny}"
      exit_code=0
! 
!     if ! su "${test_user1}" -lc "${test_user1_home}/${0##*/}" ; then
  	exit_code=1
!     elif ! su "${test_user2}" -lc "${test_user2_home}/${0##*/}"; then
  	exit_code=1
      fi 


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Ltp-cvs mailing list
Ltp-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic