* [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs
@ 2014-05-12 5:54 Xing Gu
2014-05-12 13:27 ` chrubis
2014-05-13 3:37 ` [LTP] [PATCH v2] " Xing Gu
0 siblings, 2 replies; 4+ messages in thread
From: Xing Gu @ 2014-05-12 5:54 UTC (permalink / raw)
To: ltp-list
In the earlier version of btrfs-progs, mkfs.btrfs doesn't
support -f option. So it should be judged in advance before
the command is called.
Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
---
lib/tst_mkfs.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
index 7357cd9..92b4b54 100644
--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -35,11 +35,19 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,
* superblock on the device, which is the case here as we
* reuse one device for all tests.
*/
- if (!strcmp(fs_type, "xfs") || !strcmp(fs_type, "btrfs")) {
+ if (!strcmp(fs_type, "xfs")) {
tst_resm(TINFO, "Appending '-f' flag to mkfs.%s", fs_type);
argv[pos++] = "-f";
}
+ if (!strcmp(fs_type, "btrfs")) {
+ if (system("mkfs.btrfs 2>&1 | grep '\\-f ' >/dev/null") == 0) {
+ tst_resm(TINFO, "Appending '-f' flag to mkfs.%s",
+ fs_type);
+ argv[pos++] = "-f";
+ }
+ }
+
if (fs_opts) {
for (i = 0; fs_opts[i]; i++) {
argv[pos++] = fs_opts[i];
--
1.9.0
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs
2014-05-12 5:54 [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs Xing Gu
@ 2014-05-12 13:27 ` chrubis
2014-05-13 3:37 ` [LTP] [PATCH v2] " Xing Gu
1 sibling, 0 replies; 4+ messages in thread
From: chrubis @ 2014-05-12 13:27 UTC (permalink / raw)
To: Xing Gu; +Cc: ltp-list
Hi!
> In the earlier version of btrfs-progs, mkfs.btrfs doesn't
> support -f option. So it should be judged in advance before
> the command is called.
What system is this? What version of btrfs-progs?
(ideally these details should be included in the commit message)
> Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
> ---
> lib/tst_mkfs.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
> index 7357cd9..92b4b54 100644
> --- a/lib/tst_mkfs.c
> +++ b/lib/tst_mkfs.c
> @@ -35,11 +35,19 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,
> * superblock on the device, which is the case here as we
> * reuse one device for all tests.
> */
> - if (!strcmp(fs_type, "xfs") || !strcmp(fs_type, "btrfs")) {
> + if (!strcmp(fs_type, "xfs")) {
> tst_resm(TINFO, "Appending '-f' flag to mkfs.%s", fs_type);
> argv[pos++] = "-f";
> }
>
> + if (!strcmp(fs_type, "btrfs")) {
> + if (system("mkfs.btrfs 2>&1 | grep '\\-f ' >/dev/null") == 0) {
The system() and grep is a bit of a hack but I cannot find a better way
how to do this.
> + tst_resm(TINFO, "Appending '-f' flag to mkfs.%s",
> + fs_type);
> + argv[pos++] = "-f";
> + }
> + }
> +
> if (fs_opts) {
> for (i = 0; fs_opts[i]; i++) {
> argv[pos++] = fs_opts[i];
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread* [LTP] [PATCH v2] lib/tst_mkfs.c: fix -f option for mkfs.btrfs
2014-05-12 5:54 [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs Xing Gu
2014-05-12 13:27 ` chrubis
@ 2014-05-13 3:37 ` Xing Gu
2014-05-13 11:33 ` chrubis
1 sibling, 1 reply; 4+ messages in thread
From: Xing Gu @ 2014-05-13 3:37 UTC (permalink / raw)
To: ltp-list
In the earlier version of btrfs-progs, e.g. btrfs-progs in
RHEL6.5GA whose version is v0.20-rc1, mkfs.btrfs doesn't
support -f option. So it should be judged in advance before
the command is called.
Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
---
lib/tst_mkfs.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
index 7357cd9..92b4b54 100644
--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -35,11 +35,19 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,
* superblock on the device, which is the case here as we
* reuse one device for all tests.
*/
- if (!strcmp(fs_type, "xfs") || !strcmp(fs_type, "btrfs")) {
+ if (!strcmp(fs_type, "xfs")) {
tst_resm(TINFO, "Appending '-f' flag to mkfs.%s", fs_type);
argv[pos++] = "-f";
}
+ if (!strcmp(fs_type, "btrfs")) {
+ if (system("mkfs.btrfs 2>&1 | grep '\\-f ' >/dev/null") == 0) {
+ tst_resm(TINFO, "Appending '-f' flag to mkfs.%s",
+ fs_type);
+ argv[pos++] = "-f";
+ }
+ }
+
if (fs_opts) {
for (i = 0; fs_opts[i]; i++) {
argv[pos++] = fs_opts[i];
--
1.9.0
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH v2] lib/tst_mkfs.c: fix -f option for mkfs.btrfs
2014-05-13 3:37 ` [LTP] [PATCH v2] " Xing Gu
@ 2014-05-13 11:33 ` chrubis
0 siblings, 0 replies; 4+ messages in thread
From: chrubis @ 2014-05-13 11:33 UTC (permalink / raw)
To: Xing Gu; +Cc: ltp-list
Hi!
> In the earlier version of btrfs-progs, e.g. btrfs-progs in
> RHEL6.5GA whose version is v0.20-rc1, mkfs.btrfs doesn't
> support -f option. So it should be judged in advance before
> the command is called.
I've added a comment to the tst_mkfs.c source about the version of
btrfs-progs that firstly introduced the -f argument and pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-13 11:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12 5:54 [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs Xing Gu
2014-05-12 13:27 ` chrubis
2014-05-13 3:37 ` [LTP] [PATCH v2] " Xing Gu
2014-05-13 11:33 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox