Skip to contentSkip to conversation

exec: silence hugetlbfs warning under qtest

PATCH In review [email protected] 3 participants 6 messages Oct 27, 2015 – Nov 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec: silence hugetlbfs warning under qtest

From: Marc-André Lureau <[email protected]>

vhost-user-test prints a warning. A test should not need to run on hugetlbfs, let's silence the warning under qtest. Unfortunately, the condition can't check on qtest_enabled() or qtest_driver() since they are initialized later.

---
 exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
exec.c +2 -1
index 8af2570..d9c231d 100644
@@ -1194,8 +1194,9 @@ static long gethugepagesize(const char *path, Error **errp)
         return 0;
     }
 
-    if (fs.f_type != HUGETLBFS_MAGIC)
+    if (fs.f_type != HUGETLBFS_MAGIC && !getenv("QTEST_QEMU_BINARY")) {
         fprintf(stderr, "Warning: path not on HugeTLBFS: %s\n", path);
+    }
 
     return fs.f_bsize;
 }
Signature · 1 line
2.4.3
#1 lore raw
Quoted 8 lines · On Tue, Oct 27, 2015 at 05:29:43PM +0100, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

vhost-user-test prints a warning. A test should not need to run on hugetlbfs, let's silence the warning under qtest. Unfortunately, the condition can't check on qtest_enabled() or qtest_driver() since they are initialized later.

Let's move the warning to somewhere later then.

Quoted 21 lines
---
 exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
exec.c +2 -1
index 8af2570..d9c231d 100644
@@ -1194,8 +1194,9 @@ static long gethugepagesize(const char *path, Error **errp)
         return 0;
     }
 
-    if (fs.f_type != HUGETLBFS_MAGIC)
+    if (fs.f_type != HUGETLBFS_MAGIC && !getenv("QTEST_QEMU_BINARY")) {
         fprintf(stderr, "Warning: path not on HugeTLBFS: %s\n", path);
+    }
 
     return fs.f_bsize;
 }
Signature · 1 line
2.4.3
#2 lore raw
In reply to [email protected]
Quoted 8 lines · On Tue, Oct 27, 2015 at 05:29:43PM +0100, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

vhost-user-test prints a warning. A test should not need to run on hugetlbfs, let's silence the warning under qtest. Unfortunately, the condition can't check on qtest_enabled() or qtest_driver() since they are initialized later.

I guess we need a command line option to suppress the warning. Seems a lot of work for very little benefit, but that's the best I could come up with.

Quoted 21 lines
---
 exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
exec.c +2 -1
index 8af2570..d9c231d 100644
@@ -1194,8 +1194,9 @@ static long gethugepagesize(const char *path, Error **errp)
         return 0;
     }
 
-    if (fs.f_type != HUGETLBFS_MAGIC)
+    if (fs.f_type != HUGETLBFS_MAGIC && !getenv("QTEST_QEMU_BINARY")) {
         fprintf(stderr, "Warning: path not on HugeTLBFS: %s\n", path);
+    }
 
     return fs.f_bsize;
 }
Signature · 1 line
2.4.3
#3 lore raw
In reply to [email protected]
Quoted 8 lines · On Tue, Oct 27, 2015 at 05:29:43PM +0100, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

vhost-user-test prints a warning. A test should not need to run on hugetlbfs, let's silence the warning under qtest. Unfortunately, the condition can't check on qtest_enabled() or qtest_driver() since they are initialized later.

Any idea what's the best way to address this?
Is poking at environment like this appropriate?
Maybe a command line flag to silence the warning?

Quoted 21 lines
---
 exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
exec.c +2 -1
index 8af2570..d9c231d 100644
@@ -1194,8 +1194,9 @@ static long gethugepagesize(const char *path, Error **errp)
         return 0;
     }
 
-    if (fs.f_type != HUGETLBFS_MAGIC)
+    if (fs.f_type != HUGETLBFS_MAGIC && !getenv("QTEST_QEMU_BINARY")) {
         fprintf(stderr, "Warning: path not on HugeTLBFS: %s\n", path);
+    }
 
     return fs.f_bsize;
 }
Signature · 1 line
2.4.3
#4 lore raw
Quoted 11 lines · Michael S. Tsirkin
Quoted 8 lines · On Tue, Oct 27, 2015 at 05:29:43PM +0100, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

vhost-user-test prints a warning. A test should not need to run on hugetlbfs, let's silence the warning under qtest. Unfortunately, the condition can't check on qtest_enabled() or qtest_driver() since they are initialized later.

Any idea what's the best way to address this?

Can we reorder things so that qtest_enabled() can be used?

Quoted 1 line

Is poking at environment like this appropriate?

I'm afraid it isn't. QTEST_QEMU_BINARY can be in the environment even when you're not running under qtest.

Quoted 1 line

Maybe a command line flag to silence the warning?

There's -qtest and -qtest-log. I guess keying on those would be less unclean than QTEST_QEMU_BINARY.

Quoted 21 lines
Quoted 21 lines
---
 exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
exec.c +2 -1
index 8af2570..d9c231d 100644
@@ -1194,8 +1194,9 @@ static long gethugepagesize(const char *path, Error **errp)
         return 0;
     }
 
-    if (fs.f_type != HUGETLBFS_MAGIC)
+    if (fs.f_type != HUGETLBFS_MAGIC && !getenv("QTEST_QEMU_BINARY")) {
         fprintf(stderr, "Warning: path not on HugeTLBFS: %s\n", path);
+    }
 
     return fs.f_bsize;
 }
Signature · 1 line
2.4.3
#5 lore raw
In reply to [email protected]
Quoted 8 lines · On Tue, Oct 27, 2015 at 05:29:43PM +0100, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

vhost-user-test prints a warning. A test should not need to run on hugetlbfs, let's silence the warning under qtest. Unfortunately, the condition can't check on qtest_enabled() or qtest_driver() since they are initialized later.

OK so far this is the best we could come up with, so I'll queue this up for after 2.5 unless someone objects.

Quoted 21 lines
---
 exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
exec.c +2 -1
index 8af2570..d9c231d 100644
@@ -1194,8 +1194,9 @@ static long gethugepagesize(const char *path, Error **errp)
         return 0;
     }
 
-    if (fs.f_type != HUGETLBFS_MAGIC)
+    if (fs.f_type != HUGETLBFS_MAGIC && !getenv("QTEST_QEMU_BINARY")) {
         fprintf(stderr, "Warning: path not on HugeTLBFS: %s\n", path);
+    }
 
     return fs.f_bsize;
 }
Signature · 1 line
2.4.3