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

List:       ltp-list
Subject:    Re: [LTP]
From:       Garrett Cooper <yanegomi () gmail ! com>
Date:       2010-08-23 8:17:03
Message-ID: AANLkTinL-auVn5Mm2=mc261LYkjiZYbGm_kABJCnqYG= () mail ! gmail ! com
[Download RAW message or body]

2010/8/23 Godwin Gao <godwin.gao@hotmail.com>:
> Retested the at_deny01 case, and found the same issue[2]. The below is the
> test steps, if something wrong, please note me.
>
> 1. create a runtest/at file
> root@godwin-desktop:/home/godwin/LTP_New/ltp-full-20100630# cat runtest/at
> at_deny01    at_deny01
> 2. fixed the issue[1]
> 3. ./runltp -p -l a.txt -f at
>
> Seems it is a environment setup issue, test_user_1 does not have the
> ${LTPROOT}/testcases/bin in its PATH.
> Attached the log

    Ok, I see the issue now:

‘-’
‘-l’
‘--login’
    Make the shell a login shell. This means the following. Unset all
environment variables except TERM, HOME, and SHELL (which are set as
described above), and USER and LOGNAME (which are set, even for the
super-user, as described above), and set PATH to a compiled-in default
value. Change to user's home directory. Prepend ‘-’ to the shell's
name, intended to make it read its login startup file(s).

    Note that it's a `precompiled' path (BSD explicitly calls this out
as /bin:/usr/bin, but who knows what Linux sets this as).
    Here's a quick patch for this item; please let me know how it
works in the negative case.
Thanks,
-Garrett

PS The reason why I did this was to avoid environment tainting as
setup_test says:

        # 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.

because -m/-p would have done just that (besides... environment
tainting just makes crud non-deterministic...).

["fix-at_deny01-error-conditions.diff" (application/octet-stream)]

diff --git a/testcases/commands/at/at_deny01 b/testcases/commands/at/at_deny01
index dcec684..1ba2bfb 100755
--- a/testcases/commands/at/at_deny01
+++ b/testcases/commands/at/at_deny01
@@ -34,8 +34,8 @@ TMP=${TMP:=/tmp}
 deny="/etc/at.deny"
 test_user1="test_user_1"
 test_user2="test_user_2"
-test_user2_home="/home/${test_user2}"
 test_user1_home="/home/${test_user1}"
+test_user2_home="/home/${test_user2}"
 tmpfile="$TMP/at_deny_test"
 
 #-----------------------------------------------------------------------
@@ -79,6 +79,12 @@ do_setup()
 	# users' home directories, and run it from there.
 	cp "$0" "${test_user1_home}/."
 	cp "$0" "${test_user2_home}/."
+	echo "export LTPROOT='$LTPROOT'" > "${test_user1_home}/cached_ltproot"
+	echo "export LTPROOT='$LTPROOT'" > "${test_user2_home}/cached_ltproot"
+	if [ $? -ne 0 ]; then
+		tst_resm TBROK "Couldn't copy over req'd files for test users"
+		exit 1
+	fi
 
 	# Restart atd daemon.
 	/etc/init.d/atd restart
@@ -109,6 +115,9 @@ do_cleanup()
 run_test()
 {
 	if [ $(whoami) = "${test_user1}" ]; then 
+		. "${test_user1_home}/cached_ltproot" || exit 1
+		export PATH="$PATH:$LTPROOT/testcases/bin"
+
 		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" |
@@ -131,6 +140,10 @@ run_test()
 		exit ${exit_code}
 
 	elif [ $(whoami) = "${test_user2}" ]; then
+
+		. "${test_user2_home}/cached_ltproot" || exit 1
+		export PATH="$PATH:$LTPROOT/testcases/bin"
+
 		echo "(2) TEST THAT PERSON IN ${deny} IS NOT ABLE TO RUN JOB."
 
 		echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |


------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


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

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