From: Subrata <ris...@li...> - 2010-09-06 11:47:09
|
The branch, master, has been updated via d31e427199635809815390cda5141719425c1002 (commit) from 63bb9536f66b8117a723e99149ee8091dcae4fad (commit) - Log ----------------------------------------------------------------- commit d31e427199635809815390cda5141719425c1002 Author: Subrata Modak <sub...@su...> Date: Mon Sep 6 17:15:17 2010 +0530 Most automated testing systems have no tty when running tests, so the utimensat01 test may fail with the following error msg: sudo: sorry, you must have a tty to run sudo to avoid this, commenting `Defaults requiretty' line in /etc/sudoers can make this testcase work. After test finished, restore this line. Signed-off-by: Caspar Zhang <cz...@re...>. ----------------------------------------------------------------------- Summary of changes: .../kernel/syscalls/utimensat/utimensat_tests.sh | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh index a861d61..5ef5267 100644 --- a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh +++ b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh @@ -43,6 +43,23 @@ if [ ! -f $LTPROOT/testcases/bin/$TEST_PROG ]; then exit 1; fi +# Since some automated testing systems have no tty while testing, +# comment this line in /etc/sudoers to avoid the error message: +# `sudo: sorry, you must have a tty to run sudo' +# Use trap to restore this line after program terminates. +pattern="[[:space:]]*Defaults[[:space:]]*requiretty.*" +if grep -q "^${pattern}" /etc/sudoers; then + echo "${TEST_PROG} 0 INFO : Comment requiretty in /etc/sudoers for automated testing systems" + sed -E -i"" -e "s/^($pattern)/#\1/" /etc/sudoers + trap 'trap "" EXIT; teardown' EXIT +fi + +teardown() +{ + echo "${TEST_PROG} 0 INFO : Restore requiretty in /etc/sudoers" + sed -E -i"" -e "s/^#($pattern)/\1/" /etc/sudoers +} + # Summary counters of all test results test_num=0 hooks/post-receive -- ltp |