selftests: ftrace: Introduce TMPDIR for temporary files
authorMasami Hiramatsu <mhiramat@kernel.org>
Wed, 16 Nov 2016 08:14:21 +0000 (17:14 +0900)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 22 Nov 2016 20:53:58 +0000 (15:53 -0500)
Introduce TMPDIR variable which is removed after each test
is done, so that the test script can put their temporary
files in that.

Link: http://lkml.kernel.org/r/147928406116.22982.8761924340108532378.stgit@devbox
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/testing/selftests/ftrace/ftracetest

index d08235f65202ddd86a6e67badd97ab8d4c4964aa..685376b485a2de9c9abd8adad27c0e3a9409959a 100755 (executable)
@@ -242,6 +242,7 @@ __run_test() { # testfile
 run_test() { # testfile
   local testname=`basename $1`
   local testlog=`mktemp $LOG_DIR/${testname}-log.XXXXXX`
+  export TMPDIR=`mktemp -d /tmp/ftracetest-dir.XXXXXX`
   testcase $1
   echo "execute: "$1 > $testlog
   SIG_RESULT=0
@@ -258,6 +259,7 @@ run_test() { # testfile
     [ $BE_QUIET -eq 0 ] && catlog $testlog
     TOTAL_RESULT=1
   fi
+  rm -rf $TMPDIR
 }
 
 # load in the helper functions