Hi,

There are three failures found when running the LTP at_deny01 case.



[1] at_deny01    1  TCONF  :  at command not found on system

[2] /home/test_user_1/at_deny01: line 129: tst_resm: command not found

[3] You are required to change your password immediately (root enforced)



The root causes of these failures:



[1] In the shell script, if the return value of a function is 0, it view as 
TRUE. In the at_deny01

162 if type at > /dev/null; then

163         tst_resm TCONF "at command not found on system"

if the system has at function, shell script will print "at command not found on 
system". This is opposite.



[2] In the at_deny01, root user will create user named a test_user_1,
copy the file at_deny01 to the home directory of test_user_1,

change user to test_user_1 and run the at_deny01 script.

when run the script, ${LTPROOT}/testcase/bin is in the environment
variable of root, but NOT in the test_user_1. So when the test_user_1

run this script, it can NOT find the tst_resm command.



[3] When some boards boot up, the system time is
010100001970. the Linux system will let NON-root user change its password 
immediately 
and stop the script running. This patch will let the script run normally 
without changing the password. 



Patch attached, I have checked it on the Ubuntu.

Signed-off-by: Godwin Gao <[email protected]>



Best Regard

Godwin Gao                                        
From 0122b5d907ec0fa6d2b75d42e8967da23c0b2729 Mon Sep 17 00:00:00 2001
From: Godwin Gao <[email protected]>
Date: Fri, 20 Aug 2010 11:29:42 +0800
Subject: [PATCH] Fix the at_deny01

Three failures are found in the LTP at_deny01.

[1] at_deny01    1  TCONF  :  at command not found on system
[2] /home/test_user_1/at_deny01: line 129: tst_resm: command not found
[3] You are required to change your password immediately (root enforced)

The root causes of these failures:

[1] In the shell script, if the return value of a function is 0, it view as TRUE. In the at_deny01
162 if type at > /dev/null; then
163         tst_resm TCONF "at command not found on system"
if the system has at function, shell script will print "at command not found on system". This is opposite.

[2] In the at_deny01, root user will create user named a test_user_1,  copy the file at_deny01 to the home directory of test_user_1
change user to test_user_1 and run the at_deny01 script.
when run the script, ${LTPROOT}/testcase/bin is in the environment variable of root, but NOT in the test_user_1. So the test_user_1
run this script, it can NOT find the tst_resm command.

[3] When some boards boot up, its time is 010100001970. the Linux system will let NON-root user change its password immediately
and stop the script running. This patch will let the script run normally without changing the password.

Signed-off-by: Godwin Gao <[email protected]>
---
 testcases/commands/at/at_deny01 |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/testcases/commands/at/at_deny01 b/testcases/commands/at/at_deny01
index dcec684..42cbbb1 100755
--- a/testcases/commands/at/at_deny01
+++ b/testcases/commands/at/at_deny01
@@ -64,12 +64,14 @@ do_setup()
 		echo "Could not add test user ${test_user1} to system."
 		exit 1
 	fi
+	chage -d 10 ${test_user1}
 
 	# 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
+	chage -d 10 ${test_user2}
 
 	# This is the workaround for a potential bug.
 	# [Bug 468337] At Refuse to Work with Non-login Shell
@@ -157,15 +159,15 @@ run_test()
 #-----------------------------------------------------------------------
 # FUNCTION: main
 #-----------------------------------------------------------------------
-if type at > /dev/null; then
+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
+		elif ! su "${test_user1}" -plc "${test_user1_home}/${0##*/}"; then
 			exit_code=1
-		elif ! su "${test_user2}" -lc "${test_user2_home}/${0##*/}"; then
+		elif ! su "${test_user2}" -plc "${test_user2_home}/${0##*/}"; then
 			exit_code=1
 		else
 			exit_code=0
-- 
1.5.6.3

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to