On Wed, Apr 28, 2010 at 2:04 PM, Garrett Cooper <[email protected]> wrote:
> The first item is different from the other two. The first one ignores the
> signal (SIG_IGN), whereas the latter two cases reset the handler to the
> default one (SIG_DFL). I prefer the former format, because otherwise the
> signal handlers become reentrable on accident.

I see. Thank you.

The final patch ;-)

Cheers,
-Caspar

-- 
Tags: Ant, Beijing, BUPT, Caspar, Kernel QA, Linux, Open Source,
Photography, Programmer, Red Hat Inc., Zhejianger, etc.

Current: Kernel Associate Quality Engineer @ Red Hat Inc.

Home Page: http://www.CasparZhang.com/
Hi,
	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 <[email protected]>
---
diff --git a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
--- a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh	2010-04-01 14:23:11.000000000 +0800
+++ b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh	2010-04-28 14:23:42.505422152 +0800
@@ -43,6 +43,23 @@
      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
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to