[prev in list] [next in list] [prev in thread] [next in thread]
List: ltp-cvs
Subject: [Ltp-cvs] ltp/testcases/commands/at at_allow01, 1.5, 1.6 at_deny01,
From: Garrett Cooper <yaberauneya () users ! sourceforge ! net>
Date: 2010-01-31 23:00:00
Message-ID: E1Nbilt-00032y-0M () 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-serv11646/testcases/commands/at
Modified Files:
at_allow01 at_deny01
Log Message:
Apply the rest of the needed cleanup:
1. Add needed variables for tst_resm(1) to function.
2. Fix indentation.
Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
Index: at_allow01
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/commands/at/at_allow01,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** at_allow01 31 Jan 2010 22:46:15 -0000 1.5
--- at_allow01 31 Jan 2010 22:59:58 -0000 1.6
***************
*** 25,31 ****
#
# HISTORY:
! # 04/03 Jerone Young (jyoung5@us.ibm.com)
#
TMP=${TMP:=/tmp}
allow="/etc/at.allow"
--- 25,34 ----
#
# HISTORY:
! # 04/03 Jerone Young (jyoung5@us.ibm.com)
#
+ export TCID=at_allow01
+ export TST_TOTAL=1
+ export TST_COUNT=1
TMP=${TMP:=/tmp}
allow="/etc/at.allow"
***************
*** 42,77 ****
do_setup()
{
! # Move any files that may get in the way.
! rm "${tmpfile}" >/dev/null 2>&1
! mv "${allow}" "${allow}.old" >/dev/null 2>&1
! # Remove users for clean enviroment.
! rm -rf "${test_user1_home}" "${test_user2_home}"
! userdel -r "${test_user1}" >/dev/null 2>&1
! userdel -r "${test_user2}" >/dev/null 2>&1
! # 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
! fi
! # 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
! fi
! # This is the workaround for a potential bug.
! # [Bug 468337] At Refuse to Work with Non-login Shell
! # https://bugzilla.redhat.com/show_bug.cgi?id=468337
! # As we are running in non-login shell now, we cannot run the script
! # by simply given it a relative path. Therefore, we copy it to test
! # users' home directories, and run it from there.
! cp "$0" "${test_user1_home}"
! cp "$0" "${test_user2_home}"
! # Restart atd daemon.
! /etc/init.d/atd restart
}
--- 45,80 ----
do_setup()
{
! # Move any files that may get in the way.
! rm "${tmpfile}" >/dev/null 2>&1
! mv "${allow}" "${allow}.old" >/dev/null 2>&1
! # Remove users for clean enviroment.
! rm -rf "${test_user1_home}" "${test_user2_home}"
! userdel -r "${test_user1}" >/dev/null 2>&1
! userdel -r "${test_user2}" >/dev/null 2>&1
! # 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
! fi
! # 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
! fi
! # This is the workaround for a potential bug.
! # [Bug 468337] At Refuse to Work with Non-login Shell
! # https://bugzilla.redhat.com/show_bug.cgi?id=468337
! # As we are running in non-login shell now, we cannot run the script
! # by simply given it a relative path. Therefore, we copy it to test
! # users' home directories, and run it from there.
! cp "$0" "${test_user1_home}/."
! cp "$0" "${test_user2_home}/."
! # Restart atd daemon.
! /etc/init.d/atd restart
}
***************
*** 81,92 ****
do_cleanup()
{
! # We forcefully remove those files anyway. Otherwise userdel may
! # give us bad warnings.
! rm -rf "${test_user1_home}" "${test_user2_home}"
! userdel -r "${test_user1}" >/dev/null 2>&1
! userdel -r "${test_user2}" >/dev/null 2>&1
! rm "${allow}"
! mv "${allow}.old" "${allow}" >/dev/null 2>&1
! rm "${tmpfile}" >/dev/null 2>&1
}
--- 84,95 ----
do_cleanup()
{
! # We forcefully remove those files anyway. Otherwise userdel may
! # give us bad warnings.
! rm -rf "${test_user1_home}" "${test_user2_home}"
! userdel -r "${test_user1}" >/dev/null 2>&1
! userdel -r "${test_user2}" >/dev/null 2>&1
! rm "${allow}"
! mv "${allow}.old" "${allow}" >/dev/null 2>&1
! rm "${tmpfile}" >/dev/null 2>&1
}
***************
*** 96,146 ****
run_test()
{
! if [ $(whoami) = "${test_user1}" ]; then
! echo "TEST: $allow should allow only those who in the file to\
! run jobs."
! echo "(1) TEST THAT PERSON IN ${allow} 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}."
! exit 1
! fi
! echo " Sleeping for 75 seconds...."
! sleep 75
! exit_code=1
! test -e "${tmpfile}" && exit_code=0
! if [ ${exit_code} -eq 1 ]; then
! echo "At did not allow user to execute job, TEST FAILED."
else
! echo "At allowed user to execute test job, TEST PASSED."
fi
rm -f "${tmpfile}" >/dev/null 2>&1
! exit ${exit_code}
! elif [ $(whoami) = "${test_user2}" ]; then
! echo "(2) TEST PERSON THAT IS NOT IN ${allow} IS NOT ABLE TO\
! RUN JOB."
! echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
! at -m now + 1 minutes
! if [ $? != 0 ]; then
! echo "Expected error while adding job user at for user\
! ${test_user2}"
! fi
echo "Sleeping for 75 seconds...."
! sleep 75
! exit_code=1
! test -e "${tmpfile}" || exit_code=0
! if [ ${exit_code} -eq 1 ]; then
! echo "At allowed user to execute test job, TEST FAILED."
! else
! echo "At did not allow user to execute job, TEST PASSED."
! fi
! rm -f "${tmpfile}" >/dev/null 2>&1
! exit ${exit_code}
! fi
}
--- 99,144 ----
run_test()
{
! if [ $(whoami) = "${test_user1}" ]; then
! echo "TEST: $allow should allow only those who in the file to run jobs."
! echo "(1) TEST THAT PERSON IN ${allow} IS ABLE TO RUN JOB."
! echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
! if ! at -m now + 1 minutes ; then
! echo "Error while adding job using at for user ${test_user1}."
! exit 1
! fi
! echo " Sleeping for 75 seconds...."
! sleep 75
! exit_code=1
! test -e "${tmpfile}" && exit_code=0
! if [ ${exit_code} -eq 1 ]; then
! tst_resm TFAIL "At did not allow user to execute job"
else
! tst_resm TPASS "At allowed user to execute test job"
fi
rm -f "${tmpfile}" >/dev/null 2>&1
! exit ${exit_code}
! elif [ $(whoami) = "${test_user2}" ]; then
! echo "(2) TEST PERSON THAT IS NOT IN ${allow} IS NOT ABLE TO RUN JOB."
! echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
! if ! at -m now + 1 minutes; then
! echo "Expected error while adding job user at for user ${test_user2}"
! fi
echo "Sleeping for 75 seconds...."
! sleep 75
! exit_code=1
! test -e "${tmpfile}" || exit_code=0
! if [ ${exit_code} -eq 1 ]; then
! tst_resm TFAIL "At allowed user to execute test job"
! else
! tst_resm TPASS "At did not allow user to execute job"
! fi
! rm -f "${tmpfile}" >/dev/null 2>&1
! exit ${exit_code}
! fi
}
***************
*** 149,171 ****
#-----------------------------------------------------------------------
if type at > /dev/null; then
! tst_resm TCONF "at command not found on system"
elif [ "$(id -ru)" = 0 ]; then
! do_setup
! echo "${test_user1}" >"${allow}"
! 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
! do_cleanup
! exit ${exit_code}
else
! run_test
! exit 0
fi
--- 147,172 ----
#-----------------------------------------------------------------------
if type at > /dev/null; then
! tst_resm TCONF "at command not found on system"
elif [ "$(id -ru)" = 0 ]; then
! if do_setup; then
!
! if ! echo "${test_user1}" >"${allow}"; then
! exit_code=1
! elif ! 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
! else
! exit_code=0
! fi
!
! do_cleanup
!
! else
! exit_code=1
! fi
! exit ${exit_code}
else
! run_test
! exit 0
fi
Index: at_deny01
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/commands/at/at_deny01,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** at_deny01 31 Jan 2010 22:43:27 -0000 1.5
--- at_deny01 31 Jan 2010 22:59:58 -0000 1.6
***************
*** 25,31 ****
#
# HISTORY:
! # 04/03 Jerone Young (jyoung5@us.ibm.com)
#
TMP=${TMP:=/tmp}
deny="/etc/at.deny"
--- 25,34 ----
#
# HISTORY:
! # 04/03 Jerone Young (jyoung5@us.ibm.com)
#
+ export TCID=at_deny01
+ export TST_TOTAL=1
+ export TST_COUNT=1
TMP=${TMP:=/tmp}
deny="/etc/at.deny"
***************
*** 42,83 ****
do_setup()
{
! # Move any files that may get in the way.
! rm "${tmpfile}" >/dev/null 2>&1
! mv "${deny}" "${deny}.old" >/dev/null 2>&1
! # if /etc/at.allow is there, /etc/at.deny will be ignored. So, we
! # need to remove it first.
! if [ -f "/etc/at.allow" ]; then
! mv /etc/at.allow /etc/at.allow.old
! fi
! # Remove users for clean enviroment.
! rm -rf "${test_user1_home}" "${test_user2_home}"
! userdel -r "${test_user1}" >/dev/null 2>&1
! userdel -r "${test_user2}" >/dev/null 2>&1
! # 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
! fi
! # 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
! fi
! # This is the workaround for a potential bug.
! # [Bug 468337] At Refuse to Work with Non-login Shell
! # https://bugzilla.redhat.com/show_bug.cgi?id=468337
! # As we are running in non-login shell now, we cannot run the script
! # by simply given it a relative path. Therefore, we copy it to test
! # users' home directories, and run it from there.
! cp "$0" "${test_user1_home}"
! cp "$0" "${test_user2_home}"
! # Restart atd daemon.
! /etc/init.d/atd restart
}
--- 45,86 ----
do_setup()
{
! # Move any files that may get in the way.
! rm "${tmpfile}" >/dev/null 2>&1
! mv "${deny}" "${deny}.old" >/dev/null 2>&1
! # if /etc/at.allow is there, /etc/at.deny will be ignored. So, we
! # need to remove it first.
! if [ -f "/etc/at.allow" ]; then
! mv /etc/at.allow /etc/at.allow.old
! fi
! # Remove users for clean enviroment.
! rm -rf "${test_user1_home}" "${test_user2_home}"
! userdel -r "${test_user1}" >/dev/null 2>&1
! userdel -r "${test_user2}" >/dev/null 2>&1
! # 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
! fi
! # 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
! fi
! # This is the workaround for a potential bug.
! # [Bug 468337] At Refuse to Work with Non-login Shell
! # https://bugzilla.redhat.com/show_bug.cgi?id=468337
! # As we are running in non-login shell now, we cannot run the script
! # by simply given it a relative path. Therefore, we copy it to test
! # users' home directories, and run it from there.
! cp "$0" "${test_user1_home}/."
! cp "$0" "${test_user2_home}/."
! # Restart atd daemon.
! /etc/init.d/atd restart
}
***************
*** 87,102 ****
do_cleanup()
{
! # We forcefully remove those files anyway. Otherwise userdel may
! # give us bad warnings.
! rm -rf "${test_user1_home}" "${test_user2_home}"
! userdel -r "${test_user1}" >/dev/null 2>&1
! userdel -r "${test_user2}" >/dev/null 2>&1
! rm "${deny}"
! mv "${deny}.old" "${deny}" >/dev/null 2>&1
! rm "${tmpfile}" >/dev/null 2>&1
! if [ -f /etc/at.allow.old ]; then
! mv /etc/at.allow.old /etc/at.allow
! fi
}
--- 90,105 ----
do_cleanup()
{
! # We forcefully remove those files anyway. Otherwise userdel may
! # give us bad warnings.
! rm -rf "${test_user1_home}" "${test_user2_home}"
! userdel -r "${test_user1}" >/dev/null 2>&1
! userdel -r "${test_user2}" >/dev/null 2>&1
! rm "${deny}"
! mv "${deny}.old" "${deny}" >/dev/null 2>&1
! rm "${tmpfile}" >/dev/null 2>&1
! if [ -f /etc/at.allow.old ]; then
! mv /etc/at.allow.old /etc/at.allow
! fi
}
***************
*** 106,156 ****
run_test()
{
! if [ $(whoami) = "${test_user1}" ]; then
! echo "TEST: ${deny} should deny only those who are not in the\
! file to run jobs."
! 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}."
! exit 1
! fi
! echo " Sleeping for 75 seconds...."
! sleep 75
! exit_code=1
! test -e "${tmpfile}" && exit_code=0
! if [ ${exit_code} -eq 1 ]; then
! echo "At denyed user to execute test job, TEST FAILED."
! else
! echo "At did not deny user to execute job, TEST PASSED."
! fi
! rm -f "${tmpfile}" >/dev/null 2>&1
! exit ${exit_code}
! elif [ $(whoami) = "${test_user2}" ]; then
! echo "(2) TEST THAT PERSON IN ${deny} IS NOT ABLE TO RUN JOB."
!
! echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
! at -m now + 1 minutes
! if [ $? != 0 ]; then
! echo "Expected error while adding job user at for user\
! ${test_user2}"
! fi
! echo "Sleeping for 75 seconds...."
! sleep 75
! exit_code=1
! test -e "${tmpfile}" || exit_code=0
! if [ ${exit_code} -eq 1 ]; then
! echo "At did not deny user to execute job, TEST FAILED."
! else
! echo "At denyed user to execute test job, TEST PASSED."
! fi
! rm -f "${tmpfile}" >/dev/null 2>&1
! exit ${exit_code}
! fi
}
--- 109,156 ----
run_test()
{
! if [ $(whoami) = "${test_user1}" ]; then
! echo "TEST: ${deny} should deny only those who are not in the file to run jobs."
! echo "(1) TEST THAT PERSON NOT IN ${deny} IS ABLE TO RUN JOB."
! echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
! if ! at -m now + 1 minutes; then
! echo "Error while adding job using at for user ${test_user1}."
! exit 1
! fi
! echo " Sleeping for 75 seconds...."
! sleep 75
! exit_code=1
! test -e "${tmpfile}" && exit_code=0
! if [ ${exit_code} -eq 1 ]; then
! tst_resm TFAIL "At denyed user to execute test job"
! else
! tst_resm TPASS "At did not deny user to execute job"
! fi
! rm -f "${tmpfile}" >/dev/null 2>&1
! exit ${exit_code}
! elif [ $(whoami) = "${test_user2}" ]; then
! echo "(2) TEST THAT PERSON IN ${deny} IS NOT ABLE TO RUN JOB."
! echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
! if ! at -m now + 1 minutes; then
! echo "Expected error while adding job user at for user ${test_user2}"
! fi
! echo "Sleeping for 75 seconds...."
! sleep 75
! exit_code=1
! test -e "${tmpfile}" || exit_code=0
! if [ ${exit_code} -eq 1 ]; then
! echo "At did not deny user to execute job, TEST FAILED."
! else
! echo "At denyed user to execute test job, TEST PASSED."
! fi
!
! rm -f "${tmpfile}" >/dev/null 2>&1
! exit ${exit_code}
!
! fi
}
***************
*** 159,177 ****
#-----------------------------------------------------------------------
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
! do_cleanup
! exit ${exit_code}
else
! run_test
! exit 0
fi
--- 159,181 ----
#-----------------------------------------------------------------------
if type at > /dev/null; then
! tst_resm TCONF "at command not found on system"
elif [ "$(id -ru)" = 0 ]; then
! if do_setup ; then
! if ! echo "${test_user2}" >"${deny}"; then
! exit_code=1
! elif ! 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
! else
! exit_code=0
! fi
! do_cleanup
! else
! exit_code=1
! fi
! exit ${exit_code}
else
! run_test
! exit 0
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