Hi,

The runltp has the parameter "-d" to identify the temporary directory by
user. 
------------
#./runltp -h
....
-d TMPDIR       Directory where temporary files will be created.

    example: ./runltp -c 2 -i 2 -m 2,4,10240,1 -D 2,10,10240,1 -p -q  -l
/tmp/result-log.11947 -o /tmp/result-output.11947 -C
/tmp/result-failed.11947 -d /home/ltp/cvs_ltp.orig


But in the latest runltp, there're two problem:
1> Always use "/tmp" as the temporary directory and never use the one
that user defined. 
2> It will be in error if the parameter "TMPDIR" is a relative path.
Just use one case as the example:
-------
# venuslp12:/home/ltp/cvs_ltp.orig # ./runltp -d /home/ltp/cvs_ltp.orig
 -s access04

Running tests.......
<<<test_start>>>
tag=access04 stime=1224514095
cmdline="access04"
contacts=""
analysis=exit
initiation_status="ok"
<<<test_output>>>
incrementing stop
access04    1  BROK  :  tst_tmpdir():
mkdtemp(/home/ltp/cvs_ltp.orig/accYgbqtF) failed; errno = 13: Permission
denied
access04    0  WARN  :  tst_tmpdir(): No user cleanup function called
before exiting
<<<execution_status>>>
duration=1 termination_type=exited termination_id=6 corefile=no
cutime=0 cstime=0
<<<test_end>>>
INFO: pan reported some tests FAIL

# venuslp12:/home/ltp/cvs_ltp.orig # ./runltp -d ./temp -s access04

Running tests.......
<<<test_start>>>
tag=access04 stime=1224514282
cmdline="access04"
contacts=""
analysis=exit
initiation_status="ok"
<<<test_output>>>
incrementing stop
access04    1  BROK  :  tst_tmpdir(): mkdtemp(./temp/accWIHTjK) failed;
errno = 2: No such file or directory
access04    0  WARN  :  tst_tmpdir(): No user cleanup function called
before exiting
<<<execution_status>>>
duration=0 termination_type=exited termination_id=6 corefile=no
cutime=0 cstime=0
<<<test_end>>>
INFO: pan reported some tests FAIL


==============
After patching
==============
[EMAIL PROTECTED] cvs_ltp]# ./runltp -d /home/ltp/cvs_ltp -s access04

Running tests.......
<<<test_start>>>
tag=access04 stime=1224514707
cmdline="access04"
contacts=""
analysis=exit
initiation_status="ok"
<<<test_output>>>
incrementing stop
access04    1  PASS  :  Functionality of access(testdir/testfile, F_OK)
successful
<<<execution_status>>>
duration=0 termination_type=exited termination_id=0 corefile=no
cutime=0 cstime=0
<<<test_end>>>
INFO: pan reported all tests PASS

[EMAIL PROTECTED] cvs_ltp]# ./runltp -d ./tmp -s access04

Running tests.......
<<<test_start>>>
tag=access04 stime=1224514796
cmdline="access04"
contacts=""
analysis=exit
initiation_status="ok"
<<<test_output>>>
incrementing stop
access04    1  PASS  :  Functionality of access(testdir/testfile, F_OK)
successful
<<<execution_status>>>
duration=0 termination_type=exited termination_id=0 corefile=no
cutime=0 cstime=0
<<<test_end>>>
INFO: pan reported all tests PASS

Signed-off-by: Jin Bing Guo <[EMAIL PROTECTED]>
-----

Thanks,
-- Jin Bing Guo
--- cvs_ltp.orig/runltp	2008-10-20 04:55:05.000000000 -0500
+++ cvs_ltp/runltp	2008-10-20 05:17:57.000000000 -0500
@@ -76,8 +76,6 @@ setup()
     }
     export LTPROOT=${PWD}
     export TMPBASE="/tmp"
-    # use mktemp to create "safe" temporary directories
-    export TMPTEMPLATE="${TMPBASE}/ltp-XXXXXXXXXX"
     export PATH="${PATH}:${LTPROOT}/testcases/bin"
 
     [ -d $LTPROOT/testcases/bin ] ||
@@ -214,8 +212,8 @@ main()
                 ALT_DIR_OUT=1 ;;
             esac ;;
                    
-        d)  # use mktemp to create "safe" temporary directories
-	    export TMPDIR="${OPTARG}" ;;
+        d)  # convert the user path to absolute path.
+            export TMPBASE=`cd \`dirname ${OPTARG}\`; pwd`/`basename ${OPTARG}` ;;
 
         D)  NUM_PROCS=1; NUM_FILES=1; NUM_BYTES=$((1024 * 1024 * 1024)); CLEAN_FLAG=0
             ARGUMENT_LIST=$OPTARG
@@ -447,12 +445,21 @@ main()
 
     # Added -m 777 for tests that call tst_tmpdir() and try to 
     #  write to it as user nobody
+    mkdir -m 777 -p $TMPBASE || \
+    {
+        echo "FATAL: Unable to make temporary directory $TMPBASE"
+        exit 1
+    }
+    # use mktemp to create "safe" temporary directories
+    export TMPTEMPLATE="${TMPBASE}/ltp-XXXXXXXXXX"
     TMP=`mktemp -d $TMPTEMPLATE` || \
     {
         echo "FATAL: Unable to make temporary directory: $TMP"
         exit 1
     }
     export TMP
+    # To be evoked by tst_tmpdir()
+    export TMPDIR="$TMP" 
 
     chmod 777 $TMP || \
     {
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to