[libvirt] [PATCH] fchosttest: Run the test only under linux

Currently, we have functions to handle fc_host implemented just for linux. On all other platforms an error is thrown. It makes no sense to run the test on those platforms then. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- tests/fchosttest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/fchosttest.c b/tests/fchosttest.c index 05ff20b..46bd784 100644 --- a/tests/fchosttest.c +++ b/tests/fchosttest.c @@ -163,6 +163,11 @@ mymain(void) { int ret = 0; +#ifndef __linux__ + fputs("Not compiled under linux, skipping this test\n", stderr); + return EXIT_AM_SKIP; +#endif + if (virAsprintf(&fchost_prefix, "%s/%s", abs_srcdir, "fchostdata/fc_host/") < 0) { ret = -1; -- 1.8.1.5

On 09/27/2013 08:51 AM, Michal Privoznik wrote:
Currently, we have functions to handle fc_host implemented just for linux. On all other platforms an error is thrown. It makes no sense to run the test on those platforms then.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- tests/fchosttest.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tests/fchosttest.c b/tests/fchosttest.c index 05ff20b..46bd784 100644 --- a/tests/fchosttest.c +++ b/tests/fchosttest.c @@ -163,6 +163,11 @@ mymain(void) { int ret = 0;
+#ifndef __linux__ + fputs("Not compiled under linux, skipping this test\n", stderr); + return EXIT_AM_SKIP; +#endif
For other Linux-specific tests, we have stubbed out the entire file, rather than just a line in main() (for example, virsystemdtest.c). But this approach works too. ACK, worth having in 1.1.3. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Fri, Sep 27, 2013 at 09:19:12AM -0600, Eric Blake wrote:
On 09/27/2013 08:51 AM, Michal Privoznik wrote:
Currently, we have functions to handle fc_host implemented just for linux. On all other platforms an error is thrown. It makes no sense to run the test on those platforms then.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- tests/fchosttest.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tests/fchosttest.c b/tests/fchosttest.c index 05ff20b..46bd784 100644 --- a/tests/fchosttest.c +++ b/tests/fchosttest.c @@ -163,6 +163,11 @@ mymain(void) { int ret = 0;
+#ifndef __linux__ + fputs("Not compiled under linux, skipping this test\n", stderr); + return EXIT_AM_SKIP; +#endif
For other Linux-specific tests, we have stubbed out the entire file, rather than just a line in main() (for example, virsystemdtest.c). But this approach works too. ACK, worth having in 1.1.3.
The reason for stubbing the whole file is to avoid warnings about unused variables. eg won't this code cause a warning about 'ret' being unused, or report that the rest of 'mymain' is unreachable code. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Michal Privoznik