[Libguestfs] [PATCH 09/16] tests: isolate iso_system_id baseline string

Pino Toscano ptoscano at redhat.com
Thu Oct 23 18:18:37 UTC 2014


Move the reference iso_system_id for the isoinfo_device test to an own
define for Linux, with an error for unknown OSes.
---
 generator/actions.ml     | 2 +-
 generator/tests_c_api.ml | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/generator/actions.ml b/generator/actions.ml
index 4cfba0d..955f638 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -9883,7 +9883,7 @@ this will create the largest possible LV." };
     tests = [
       InitNone, Always, TestResult (
         [["isoinfo_device"; "/dev/sdd"]],
-        "STREQ (ret->iso_system_id, \"LINUX\") && "^
+        "STREQ (ret->iso_system_id, GUESTFS_ISO_SYSTEM_ID) && "^
           "STREQ (ret->iso_volume_id, \"CDROM\") && "^
           "STREQ (ret->iso_volume_set_id, \"\") && "^
           "ret->iso_volume_set_size == 1 && "^
diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml
index 88aa07e..43a99e3 100644
--- a/generator/tests_c_api.ml
+++ b/generator/tests_c_api.ml
@@ -47,6 +47,12 @@ let rec generate_c_api_tests () =
 
 #include \"tests.h\"
 
+#ifdef __linux__
+#define GUESTFS_ISO_SYSTEM_ID \"LINUX\"
+#else
+#error Missing GUESTFS_ISO_SYSTEM_ID for the current OS
+#endif
+
 ";
 
   (* Generate a list of commands which are not tested anywhere. *)
-- 
1.9.3




More information about the Libguestfs mailing list