From: Anders Roxell <anders.roxell@linaro.org>
To: davej@redhat.com
Cc: trinity@vger.kernel.org, patches@linaro.org,
Anders Roxell <anders.roxell@linaro.org>
Subject: [PATCH 2/3] scripts: change mkdir tmp to mktemp
Date: Wed, 9 Oct 2013 12:56:25 +0200 [thread overview]
Message-ID: <1381316186-8562-3-git-send-email-anders.roxell@linaro.org> (raw)
In-Reply-To: <1381316186-8562-1-git-send-email-anders.roxell@linaro.org>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
scripts/find.sh | 10 ++++------
scripts/test-all-syscalls-parallel.sh | 8 +++-----
scripts/test-all-syscalls-sequentially.sh | 9 +++------
scripts/test-multi.sh | 12 +++++-------
scripts/test-vm.sh | 8 +++-----
5 files changed, 18 insertions(+), 29 deletions(-)
diff --git a/scripts/find.sh b/scripts/find.sh
index 5528210..3f10c58 100755
--- a/scripts/find.sh
+++ b/scripts/find.sh
@@ -6,6 +6,7 @@
#
TRINITY_PATH=${TRINITY_PATH:-.}
+TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
check_tainted()
{
@@ -15,11 +16,8 @@ check_tainted()
fi
}
-if [ ! -d tmp ]; then
- mkdir tmp
-fi
-chmod 755 tmp
-cd tmp
+chmod 755 $TRINITY_TMP
+cd $TRINITY_TMP
TAINT=$(cat /proc/sys/kernel/tainted)
@@ -46,7 +44,7 @@ do
check_tainted
- chmod 755 ../tmp
+ chmod 755 $TRINITY_TMP
done
diff --git a/scripts/test-all-syscalls-parallel.sh b/scripts/test-all-syscalls-parallel.sh
index c713cce..312fd2a 100755
--- a/scripts/test-all-syscalls-parallel.sh
+++ b/scripts/test-all-syscalls-parallel.sh
@@ -1,12 +1,10 @@
#!/bin/bash
TRINITY_PATH=${TRINITY_PATH:-.}
+TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
-if [ ! -d tmp ]; then
- mkdir tmp
-fi
-chmod 755 tmp
-cd tmp
+chmod 755 $TRINITY_TMP
+cd $TRINITY_TMP
while [ 1 ];
do
diff --git a/scripts/test-all-syscalls-sequentially.sh b/scripts/test-all-syscalls-sequentially.sh
index 6d79db4..2b726fc 100755
--- a/scripts/test-all-syscalls-sequentially.sh
+++ b/scripts/test-all-syscalls-sequentially.sh
@@ -4,6 +4,7 @@
# causing trinity to segfault.
TRINITY_PATH=${TRINITY_PATH:-.}
+TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
check_tainted()
{
@@ -13,18 +14,14 @@ check_tainted()
fi
}
-if [ ! -d tmp ]; then
- mkdir tmp
-fi
-
TAINT=$(cat /proc/sys/kernel/tainted)
while [ 1 ]
do
for syscall in $($TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
do
- chmod 755 tmp
- pushd tmp
+ chmod 755 $TRINITY_TMP
+ pushd $TRINITY_TMP
if [ ! -f $TRINITY_PATH/trinity ]; then
echo lost!
diff --git a/scripts/test-multi.sh b/scripts/test-multi.sh
index 993e124..0b2a629 100755
--- a/scripts/test-multi.sh
+++ b/scripts/test-multi.sh
@@ -1,6 +1,7 @@
#!/bin/bash
TRINITY_PATH=${TRINITY_PATH:-.}
+TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
check_tainted()
{
@@ -10,11 +11,8 @@ check_tainted()
fi
}
-if [ ! -d tmp ]; then
- mkdir tmp
-fi
-chmod 755 tmp
-cd tmp
+chmod 755 $TRINITY_TMP
+cd $TRINITY_TMP
TAINT=$(cat /proc/sys/kernel/tainted)
@@ -29,7 +27,7 @@ do
for i in `seq 1 $NR_PROCESSES`
do
- chmod 755 ../tmp
+ chmod 755 ../$TRINITY_TMP
if [ -d tmp.$i ]; then
chmod 755 tmp.$i
rm -rf tmp.$i
@@ -55,7 +53,7 @@ do
sleep 1
check_tainted
- chmod 755 ../tmp
+ chmod 755 ../$TRINITY_TMP
for i in `seq 1 $NR_PROCESSES`
do
diff --git a/scripts/test-vm.sh b/scripts/test-vm.sh
index 6b75e8d..6804c0e 100755
--- a/scripts/test-vm.sh
+++ b/scripts/test-vm.sh
@@ -1,12 +1,10 @@
#!/bin/bash
TRINITY_PATH=${TRINITY_PATH:-.}
+TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
-if [ ! -d tmp ]; then
- mkdir tmp
-fi
-chmod 755 tmp
-cd tmp
+chmod 755 $TRINITY_TMP
+cd $TRINITY_TMP
NR_CPUS=`grep ^processor /proc/cpuinfo | /usr/bin/wc -l`
NR_PROCESSES=$(($NR_CPUS * 2))
--
1.8.1.2
next prev parent reply other threads:[~2013-10-09 10:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 10:56 [PATCH 0/3] script enhancements Anders Roxell
2013-10-09 10:56 ` [PATCH 1/3] scripts: TRINITY_PATH defaults to "." Anders Roxell
2013-10-09 10:56 ` Anders Roxell [this message]
2013-10-09 10:56 ` [PATCH 3/3] scripts: arch dependent to get the syscall_list Anders Roxell
2013-10-09 16:41 ` Dave Jones
2013-10-10 8:45 ` Anders Roxell
2013-10-10 8:41 ` [PATCHv2 3/3] tables.c: change the output format of -L Anders Roxell
2013-10-10 17:20 ` Dave Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381316186-8562-3-git-send-email-anders.roxell@linaro.org \
--to=anders.roxell@linaro.org \
--cc=davej@redhat.com \
--cc=patches@linaro.org \
--cc=trinity@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox