Skip to contentSkip to conversation

qemu-iotests: Fixed no scratch directory in qemu-iotests

PATCH In review Lyu Mitnick 2 participants 2 messages Apr 8, 2011 – Apr 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-iotests: Fixed no scratch directory in qemu-iotests

This my first time to submit patch, please tell me if I have something wrong!

Create scratch/ on first run.

---
 common.config |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
common.config +9 -0
index bdd0530..09923d9 100644
@@ -102,6 +102,15 @@ export QEMU_IO="$QEMU_IO_PROG $QEMU_IO_OPTIONS"
 
 [ -f /etc/qemu-iotest.config ]       && . /etc/qemu-iotest.config
 
+if [ -e scratch -a ! -d scratch ]; then
+    echo "scratch exist and is not a directory"
+    exit 1
+fi
+
+if [ ! -e scratch ]; then
+    mkdir scratch
+fi
+
 if [ ! -e "$TEST_DIR" ]; then
     TEST_DIR=`pwd`/scratch
 fi
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 2 lines · Lyu Mitnick

This my first time to submit patch, please tell me if I have something wrong!

Please CC Christoph Hellwig <[email protected]> who maintains qemu-iotests.

Also, please prepend the email subject with "[qemu-iotests]" so it's easy to spot that this patch is for qemu-iotests.git and not qemu.git..

Quoted 10 lines
common.config +2 -0
index bdd0530..09923d9 100644
@@ -102,6 +102,15 @@ export QEMU_IO="$QEMU_IO_PROG $QEMU_IO_OPTIONS"
 
 [ -f /etc/qemu-iotest.config ]       && . /etc/qemu-iotest.config
 
+if [ -e scratch -a ! -d scratch ]; then
+    echo "scratch exist and is not a directory"

common.config export QEMU_IO="$QEMU_IO_PROG $QEMU_IO_OPTIONS" · line 116

Quoted 10 lines
common.config +7 -0
+    exit 1
+fi
+
+if [ ! -e scratch ]; then
+    mkdir scratch
+fi
+
 if [ ! -e "$TEST_DIR" ]; then
     TEST_DIR=`pwd`/scratch
 fi

TEST_DIR is the temporary directory used to keep files while a test runs. You've hardcoded 'scratch' and will create it in the current directory.

The user should be able to set TEST_DIR. Please use TEST_DIR instead of hardcoding 'scratch'.

For example, the following should create /tmp/iotests-tmp if it does not exist already:

$ TEST_DIR=/tmp/iotests-tmp ./check

And the following should create ./scratch if it does not exist already:

$ ./check

Stefan