Skip to contentSkip to conversation

Add support for xfs quota tests

PATCH In review DAN LI 2 participants 7 messages Jul 17, 2013 – Aug 22, 2013 2 messages not in the archive

lore
Share & tools
lore

DAN LI

author
#0 lore raw

PATCH 1/2 Add support for xfs quota tests

Add support for xfs quota tests:

*Create a xfs block device

*Define HAVE_XFS_QUOTA to show if xfs quota is available

---
 configure.ac        |  1 +
 m4/ltp-xfs_quota.m4 | 39 +++++++++++++++++++++++++++++++++++++
 runltp              | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 m4/ltp-xfs_quota.m4
configure.ac +1 -0
index f0fc6b0..1f95603 100644
@@ -168,5 +168,6 @@ LTP_CHECK_ACL_SUPPORT
 LTP_CHECK_FS_IOC_FLAGS
 LTP_CHECK_MREMAP_FIXED
 LTP_CHECK_KERNEL_DEVEL
+LTP_CHECK_XFS_QUOTACTL
 
 AC_OUTPUT
m4/ltp-xfs_quota.m4 new file +39 -0
new file mode 100644
index 0000000..a17d4d9
@@ -0,0 +1,39 @@
+dnl
+dnl Copyright (c) 2013 Fujitsu Ltd.
+dnl Author: DAN LI <[email protected]>
+dnl
+dnl This program is free software;  you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program;  if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+dnl
+
+dnl
+dnl LTP_CHECK_XFS_QUOTACTL
+dnl ----------------------------
+dnl
+AC_DEFUN([LTP_CHECK_XFS_QUOTACTL],[dnl
+	AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <xfs/xqm.h>
+#include <sys/quota.h>
+int main(void) {
+	struct fs_quota_stat qstat;
+	return quotactl(QCMD(Q_XGETQSTAT, USRQUOTA), (const char *) "/dev/null",
+			geteuid(), (caddr_t) &qstat);
+}])],[has_xfs_quota="yes"])
+
+if test "x$has_xfs_quota" = xyes; then
+	AC_DEFINE(HAVE_XFS_QUOTA,1,[Define to 1 if you have xfs quota])
+else
+	AC_MSG_WARN(No xfs quota support)
+fi
+])
runltp +1 -0
index 28e6bed..210a332 100755
@@ -163,6 +163,7 @@ usage()
     -b DEVICE       Some tests require an unmounted block device
                     to run correctly.
     -B DEVICE_FS_TYPE The file system of test block devices.
+    -X XFS_DEVICE   Some tests require an unmounted xfs-format block device
 
 
     example: ${0##*/} -c 2 -i 2 -m 2,4,10240,1 -D 2,10,10240,1 -p -q  -l /tmp/result-log.$$ -o /tmp/result-output.$$ -C

/tmp/result-failed.$$ -d ${PWD}
@@ -211,7 +212,7 @@ main()

     version_date=$(cat "$LTPROOT/Version")

- while getopts a:c:C:d:D:f:F:ehi:K:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B: arg
+ while getopts a:c:C:d:D:f:F:ehi:K:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B:X: arg
do case $arg in
a) EMAIL_TO=$OPTARG
ALT_EMAIL_OUT=1;;
@@ -424,6 +425,7 @@ main()

             INSTANCES="-x $OPTARG";;
         b) DEVICE=$OPTARG;;
         B) DEVICE_FS_TYPE=$OPTARG;;
+        X) XFS_DEVICE=$OPTARG;;
         \?) usage;;
         esac
     done
@@ -679,6 +681,24 @@ main()
     }
     }

+ if [ -n "$XFS_DEVICE" ]; then
+ sed -i "s|XFS_DEVICE|$XFS_DEVICE|" ${TMP}/alltests
+ RC=$?
+ else
+ create_xfs_block
+ if [ $? -eq 0 ]; then
+ sed -i "s|XFS_DEVICE|$XFS_DEVICE|" ${TMP}/alltests
+ RC=$?
+ else

+            echo "No xfs-format block device was specified on commandline."
+            echo "Block device could not be created using loopback device"
+            echo "Tests which require xfs block device are disabled."
+            echo "You can specify it with option -X"
+            sed -i "/XFS_DEVICE/d"  ${TMP}/alltests
+            RC=$?
+        fi
+    fi
+
     if [ -n "$DEVICE" ]; then
         sed -i "s|DEVICE|$DEVICE|"  ${TMP}/alltests
         RC=$?

@@ -1019,9 +1039,43 @@ create_block()
fi
}

+create_xfs_block()
+{

+    #create a block device with xfs filesystem.
+    dd if=/dev/zero of=${TMP}/xfstest.img bs=1kB count=20480
+    if [ $? -ne 0 ]; then
+        echo "Failed to create loopback device image, please check disk space and re-run"
+        return 1
+    else
+        ##search for an unused loop dev
+        LOOP_DEV_XFS=$(losetup -f)
+        if [ $? -ne 0 ]; then
+            echo "no unused loop device is found"
+            return 1
+        else
+            ##attach the created file to loop dev.
+            losetup $LOOP_DEV_XFS ${TMP}/xfstest.img
+            if [ $? -ne 0 ]; then

+ echo "losetup failed to create block device"
+ return 1
+ else
+ mkfs.xfs $LOOP_DEV_XFS
+ if [ $? -ne 0 ]; then
+ echo "creating an xfs block device failed."
+ return 1
+ fi
+
+ XFS_DEVICE=$LOOP_DEV_XFS
+ return 0
+ fi
+ fi
+ fi
+}
+
cleanup()

 {
     [ "$LOOP_DEV" ] && losetup -d $LOOP_DEV
+    [ "$LOOP_DEV_XFS" ] && losetup -d $LOOP_DEV_XFS
     rm -rf ${TMP}

}

Signature · 12 lines
1.8.1

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
author
#1 lore raw

PATCH 2/2 quotactl/quotactl02.c: create a case to test basic flags of quotactl(2)

Test basic xqm-related flags of quotactl() syscall.

---
 runtest/syscalls                                |   1 +
 testcases/kernel/syscalls/.gitignore            |   1 +
 testcases/kernel/syscalls/quotactl/quotactl02.c | 258 ++++++++++++++++++++++++
 3 files changed, 260 insertions(+)
 create mode 100644 testcases/kernel/syscalls/quotactl/quotactl02.c
runtest/syscalls +1 -0
index 0ce3679..bf5da76 100644
@@ -769,6 +769,7 @@ pwrite03_64 pwrite03_64
 pwrite04_64 pwrite04_64
 
 quotactl01 quotactl01
+quotactl02 quotactl02 -D XFS_DEVICE
 
 read01 read01
 read02 read02
testcases/kernel/syscalls/.gitignore +1 -0
index f7e4ce0..7bf341f 100644
@@ -633,6 +633,7 @@
 /pwrite/pwrite04
 /pwrite/pwrite04_64
 /quotactl/quotactl01
+/quotactl/quotactl02
 /read/read01
 /read/read02
 /read/read03
testcases/kernel/syscalls/quotactl/quotactl02.c new file +258 -0

258 lines not on this page · raw message

Signature · 12 lines
1.8.1

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#2 lore raw

Re: [LTP] [PATCH 2/2] quotactl/quotactl02.c: create a case to test basic flags of quotactl(2)

Hi!

testcases/kernel/syscalls/quotactl/quotactl02.c line 29

Quoted 3 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +3 -0
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif

That ifndef shouldn't be needed unless somebody has defined _GNU_SOURCE on the compiler command line, which we do not.

testcases/kernel/syscalls/quotactl/quotactl02.c line 38

Quoted 9 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +9 -0
+#include "config.h"
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/mount.h>
+#include <linux/fs.h>
+#include <sys/types.h>

The config.h should be after the system includes.

Quoted 39 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +39 -0
+#if defined(HAVE_XFS_QUOTA)
+#include <xfs/xqm.h>
+#else
+#define BROKEN_XFS_QUOTA 1
+#endif
+
+#include "test.h"
+#include "usctest.h"
+#include "linux_syscall_numbers.h"
+#include "safe_macros.h"
+
+#define USRQCMD(cmd)	((cmd) << 8)
+#define RTBLIMIT	2000
+
+char *TCID = "quotactl02";
+int TST_TOTAL = 5;
+
+#ifndef BROKEN_XFS_QUOTA
+static void func_test(int i);
+static void setup(void);
+static void cleanup(void);
+static void help(void);
+
+static int dflag;
+static int uid = -1;
+static char dev[PATH_MAX];
+static char *block_dev;
+static struct fs_disk_quota dquota;
+static struct fs_quota_stat qstat;
+static unsigned int qflag = XFS_QUOTA_UDQ_ENFD;
+static const char mntpoint[] = "mnt_point";
+
+static option_t options[] = {
+	{"D:", &dflag, &block_dev},
+	{NULL, NULL, NULL},
+};
+
+static struct test_case_t {
+	int cmd;

testcases/kernel/syscalls/quotactl/quotactl02.c line 88

Quoted 10 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +10 -0
+	const char *dev;
+	int *id;
+	void *addr;
+} TC[] = {
+	{Q_XQUOTAOFF, dev, &uid, &qflag},
+	{Q_XQUOTAON, dev, &uid, &qflag},
+	{Q_XGETQUOTA, dev, &uid, &dquota},
+	{Q_XSETQLIM, dev, &uid, &dquota},
+	{Q_XGETQSTAT, dev, &uid, &qstat},
+};

It seems pointless to pass pointers to global variables via the test_case_t structure.

Quoted 121 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +119 -0
+int main(int argc, char *argv[])
+{
+	int i;
+	int lc;
+	char *msg;
+
+	msg = parse_opts(argc, argv, options, &help);
+	if (msg != NULL)
+		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+	if (!dflag)
+		tst_brkm(TBROK, NULL,
+			 "you must specify the device used for mounting with "
+			 "the -D option");
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); ++lc) {
+
+		tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++) {
+
+			TEST(ltp_syscall(__NR_quotactl,
+					 USRQCMD(TC[i].cmd), TC[i].dev,
+					 *TC[i].id, TC[i].addr));
+
+			if (TEST_RETURN != 0)
+				tst_resm(TFAIL | TERRNO,
+					 "cmd=0x%x failed", TC[i].cmd);
+
+			if (STD_FUNCTIONAL_TEST)
+				func_test(i);
+			else
+				tst_resm(TPASS,
+					 "quotactl call succeeded");
+
+		}
+	}
+
+	cleanup();
+
+	tst_exit();
+
+}
 
 
+void func_test(int i)
+{
+	int ret;
+
+	switch (i) {
+	case 0:
+		/* Validate Q_XQUOTAOFF flag of quotactl call */
+		ret = ltp_syscall(__NR_quotactl, USRQCMD(Q_XGETQSTAT),
+				  TC[i].dev, *TC[i].id, &qstat);
+		if (ret != 0)
+			tst_brkm(TBROK | TERRNO, cleanup,
+				 "fail to get quota stat");
+
+		if (qstat.qs_flags & XFS_QUOTA_UDQ_ENFD) {
+			tst_resm(TFAIL, "enforcement is not off");
+			return;
+		}
+
+		tst_resm(TPASS, "enforcement is off");
+		break;
+
+	case 1:
+		/* Validate Q_XQUOTAON flag of quotactl call */
+		ret = ltp_syscall(__NR_quotactl, USRQCMD(Q_XGETQSTAT),
+				  TC[i].dev, *TC[i].id, &qstat);
+		if (ret != 0)
+			tst_brkm(TBROK | TERRNO, cleanup,
+				 "fail to get quota stat");
+
+		if (!(qstat.qs_flags & XFS_QUOTA_UDQ_ENFD)) {
+			tst_resm(TFAIL, "enforcement is off");
+			return;
+		}
+
+		tst_resm(TPASS, "enforcement is on");
+		break;
+
+	case 2:
+		/* Validate Q_XGETQUOTA flag of quotactl call */
+		if (!(dquota.d_flags & XFS_USER_QUOTA)) {
+			tst_resm(TFAIL, "get incorrect quota type");
+			return;
+		}
+
+		/* for case3 */
+		dquota.d_rtb_hardlimit = RTBLIMIT;
+		dquota.d_fieldmask = FS_DQ_LIMIT_MASK;
+
+		tst_resm(TPASS, "get the right quota type");
+		break;
+
+	case 3:
+		/* Validate Q_XSETQLIM flag of quotactl call */
+		ret = ltp_syscall(__NR_quotactl, USRQCMD(Q_XGETQUOTA),
+				  TC[i].dev, *TC[i].id, &dquota);
+		if (ret != 0)
+			tst_brkm(TFAIL | TERRNO, NULL,
+				 "fail to get quota information");
+
+		if (dquota.d_rtb_hardlimit != RTBLIMIT) {
+			tst_resm(TFAIL, "limit on RTB, except %lu get %lu",
+				 (uint64_t)RTBLIMIT,
+				 (uint64_t)dquota.d_rtb_hardlimit);
+			return;
+		}
+
+		tst_resm(TPASS, "quotactl works fine with Q_XSETQLIM");
+		break;
+
+	case 4:
+		/* Validate Q_XGETQSTAT flag of quotactl call */
+		if (qstat.qs_version != FS_QSTAT_VERSION) {
+			tst_resm(TFAIL, "get incorrect qstat version");
+			return;

testcases/kernel/syscalls/quotactl/quotactl02.c line 219

Quoted 10 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +10 -0
+		}
+
+		tst_resm(TPASS, "get correct qstat version");
+		break;
+
+	default:
+		tst_brkm(TBROK, cleanup, "Got unexpected index");
+	}
+
+}

I do not like this one-function-for-all switch(). I would rather see function pointer to a particual check function in the test_case_t structure.

Quoted 1 line

+void setup()

Missing static and void

testcases/kernel/syscalls/quotactl/quotactl02.c line 233

Quoted 12 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +12 -0
+{
+
+	tst_require_root(NULL);
+
+	TEST_PAUSE;
+
+	tst_tmpdir();
+
+	SAFE_MKDIR(cleanup, mntpoint, 0755);
+
+	uid = 0;
+	strncpy(dev, block_dev, PATH_MAX);

Why copying the block_dev to dev when you can use block_dev directly?

testcases/kernel/syscalls/quotactl/quotactl02.c line 241

Quoted 7 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +7 -0
+	if (mount(dev, mntpoint, "xfs", 0, "uquota") < 0)
+		tst_brkm(TFAIL | TERRNO, NULL, "mount(2) fail");
+
+}
+
+void cleanup()
+{

Here as well.

Quoted 7 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +7 -0
+	if (umount(mntpoint) < 0)
+		tst_resm(TFAIL | TERRNO, "umount(2) fail");
+
+	TEST_CLEANUP;
+	tst_rmdir();
+}
+

testcases/kernel/syscalls/quotactl/quotactl02.c line 258

Quoted 10 lines
testcases/kernel/syscalls/quotactl/quotactl02.c new file +10 -0
+void help(void)
+{
+	printf("-D device : device used for mounting.\n");
+}
+#else
+int main(void)
+{
+	tst_brkm(TCONF, NULL, "This system doesn't support xfs quota");
+}
+#endif

I wonder where this #else and #endif starts, but maybe I've just lost the opening #ifdef. Ah found it it's the #ifndef BROKEN_XFS_QUOTA.

Now it would be better to have it organized as:

#if defined(HAVE_XFS_QUOTA)

# include <xfs/xqm.h>
#endif

#include "test.h"

...

#if defined(HAVE_XFS_QUOTA)

...

#else

#endif

As there is no need to define new symbol that is just an alias.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#3 lore raw
In reply to DAN LI

Hi!

Quoted 52 lines

Add support for xfs quota tests:

*Create a xfs block device

*Define HAVE_XFS_QUOTA to show if xfs quota is available

---
 configure.ac        |  1 +
 m4/ltp-xfs_quota.m4 | 39 +++++++++++++++++++++++++++++++++++++
 runltp              | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 m4/ltp-xfs_quota.m4
configure.ac +1 -0
index f0fc6b0..1f95603 100644
@@ -168,5 +168,6 @@ LTP_CHECK_ACL_SUPPORT
 LTP_CHECK_FS_IOC_FLAGS
 LTP_CHECK_MREMAP_FIXED
 LTP_CHECK_KERNEL_DEVEL
+LTP_CHECK_XFS_QUOTACTL
 
 AC_OUTPUT
m4/ltp-xfs_quota.m4 new file +21 -0
new file mode 100644
index 0000000..a17d4d9
@@ -0,0 +1,39 @@
+dnl
+dnl Copyright (c) 2013 Fujitsu Ltd.
+dnl Author: DAN LI <[email protected]>
+dnl
+dnl This program is free software;  you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program;  if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+dnl
+
+dnl
+dnl LTP_CHECK_XFS_QUOTACTL

m4/ltp-xfs_quota.m4 line 31

Quoted 10 lines
m4/ltp-xfs_quota.m4 new file +10 -0
+dnl ----------------------------
+dnl
+AC_DEFUN([LTP_CHECK_XFS_QUOTACTL],[dnl
+	AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <xfs/xqm.h>
+#include <sys/quota.h>
+int main(void) {
+	struct fs_quota_stat qstat;
+	return quotactl(QCMD(Q_XGETQSTAT, USRQUOTA), (const char *) "/dev/null",
+			geteuid(), (caddr_t) &qstat);

Why the (const char *) and (caddr_t) casts?

Quoted 89 lines
m4/ltp-xfs_quota.m4 new file +8 -0
+}])],[has_xfs_quota="yes"])
+
+if test "x$has_xfs_quota" = xyes; then
+	AC_DEFINE(HAVE_XFS_QUOTA,1,[Define to 1 if you have xfs quota])
+else
+	AC_MSG_WARN(No xfs quota support)
+fi
+])
runltp +1 -0
index 28e6bed..210a332 100755
@@ -163,6 +163,7 @@ usage()
     -b DEVICE       Some tests require an unmounted block device
                     to run correctly.
     -B DEVICE_FS_TYPE The file system of test block devices.
+    -X XFS_DEVICE   Some tests require an unmounted xfs-format block device
 
 
     example: ${0##*/} -c 2 -i 2 -m 2,4,10240,1 -D 2,10,10240,1 -p -q  -l /tmp/result-log.$$ -o /tmp/result-output.$$ -C

/tmp/result-failed.$$ -d ${PWD}

runltp +42 -1
@@ -211,7 +212,7 @@ main()
 
     version_date=$(cat "$LTPROOT/Version")
 
-    while getopts a:c:C:d:D:f:F:ehi:K:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B: arg
+    while getopts a:c:C:d:D:f:F:ehi:K:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B:X: arg
     do  case $arg in
         a)  EMAIL_TO=$OPTARG
             ALT_EMAIL_OUT=1;;
@@ -424,6 +425,7 @@ main()
             INSTANCES="-x $OPTARG";;
         b) DEVICE=$OPTARG;;
         B) DEVICE_FS_TYPE=$OPTARG;;
+        X) XFS_DEVICE=$OPTARG;;
         \?) usage;;
         esac
     done
@@ -679,6 +681,24 @@ main()
     }
     }
 
+    if [ -n "$XFS_DEVICE" ]; then
+        sed -i "s|XFS_DEVICE|$XFS_DEVICE|"  ${TMP}/alltests
+        RC=$?
+    else
+        create_xfs_block
+        if [ $? -eq 0 ]; then
+            sed -i "s|XFS_DEVICE|$XFS_DEVICE|"  ${TMP}/alltests
+            RC=$?
+        else
+            echo "No xfs-format block device was specified on commandline."
+            echo "Block device could not be created using loopback device"
+            echo "Tests which require xfs block device are disabled."
+            echo "You can specify it with option -X"
+            sed -i "/XFS_DEVICE/d"  ${TMP}/alltests
+            RC=$?
+        fi
+    fi
+
     if [ -n "$DEVICE" ]; then
         sed -i "s|DEVICE|$DEVICE|"  ${TMP}/alltests
         RC=$?
@@ -1019,9 +1039,43 @@ create_block()
     fi
 }
 
+create_xfs_block()
+{
+    #create a block device with xfs filesystem.
+    dd if=/dev/zero of=${TMP}/xfstest.img bs=1kB count=20480
+    if [ $? -ne 0 ]; then
+        echo "Failed to create loopback device image, please check disk space and re-run"
+        return 1
+    else
+        ##search for an unused loop dev
+        LOOP_DEV_XFS=$(losetup -f)
+        if [ $? -ne 0 ]; then
+            echo "no unused loop device is found"
+            return 1
+        else
+            ##attach the created file to loop dev.
+            losetup $LOOP_DEV_XFS ${TMP}/xfstest.img
+            if [ $? -ne 0 ]; then
+                echo "losetup failed to create block device"
+                return 1
+            else
+                mkfs.xfs $LOOP_DEV_XFS
+                if [ $? -ne 0 ]; then

runltp create_block() · line 1073

Quoted 10 lines
runltp +10 -0
+                    echo "creating an xfs block device failed."
+                    return 1
+                fi
+
+                XFS_DEVICE=$LOOP_DEV_XFS
+                return 0
+            fi
+        fi
+    fi
+}

Now this is getting a bit out of hand.

What about we change the tests (we have) to take only device to work with and let each test prepare the filesystem it needs? This will simplify the runltp script to only prepare loop device.

If we agree on that I can write the tst_mkfs() function and convert current usages.

Or has anbody better idea?

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Hi!

Quoted 10 lines
Quoted 8 lines

Now this is getting a bit out of hand.

What about we change the tests (we have) to take only device to work with and let each test prepare the filesystem it needs? This will simplify the runltp script to only prepare loop device.

If we agree on that I can write the tst_mkfs() function and convert current usages.

What about the progress of this work? :)

I've been on vacation. I will get to this next week.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#6 lore raw
In reply to a message not in the archive

Hi!

Quoted 10 lines
Quoted 8 lines

Now this is getting a bit out of hand.

What about we change the tests (we have) to take only device to work with and let each test prepare the filesystem it needs? This will simplify the runltp script to only prepare loop device.

If we agree on that I can write the tst_mkfs() function and convert current usages.

What about the progress of this work? :)

I've just pushed a patchset that implements this functionality. (It has been finished previous week but I hold it util I had time to test it properly)

Everybody please test this change and report any problems.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Hi!

Quoted 9 lines
Quoted 5 lines

I've just pushed a patchset that implements this functionality. (It has been finished previous week but I hold it util I had time to test it properly)

Everybody please test this change and report any problems.

I got a little problem when using this function.

Quoted 6 lines

Defaultly, the command mkfs.xfs will not write to the device if it suspects that there is a filesystem or partition table on the device already.
So, i need to add the "-f" option for mkfs.xfs to force the formatting.

But, the command "mkfs dev -t xfs -f" does not work as expected. Could you please change it to "mkfs -t fs_type fs_opts dev" in tst_mkfs()?

I've created and pushed a patch that shuffles the params so that they are in right order.

And I'm thinking if it actually would be better to add the -f parameter in the tst_mkfs() if fs_type is xfs. As just now if you want to run any of the tests that operate on a filesystem with xfs it fails in the same way.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list