modules-test.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include "qemu/osdep.h"
  2. #include "libqtest.h"
  3. const char common_args[] = "-nodefaults -machine none";
  4. static void test_modules_load(const void *data)
  5. {
  6. QTestState *qts;
  7. const char **args = (const char **)data;
  8. qts = qtest_init(common_args);
  9. qtest_module_load(qts, args[0], args[1]);
  10. qtest_quit(qts);
  11. }
  12. int main(int argc, char *argv[])
  13. {
  14. const char *modules[] = {
  15. #ifdef CONFIG_CURL
  16. "block-", "curl",
  17. #endif
  18. #ifdef CONFIG_GLUSTERFS
  19. "block-", "gluster",
  20. #endif
  21. #ifdef CONFIG_LIBISCSI
  22. "block-", "iscsi",
  23. #endif
  24. #ifdef CONFIG_LIBNFS
  25. "block-", "nfs",
  26. #endif
  27. #ifdef CONFIG_LIBSSH
  28. "block-", "ssh",
  29. #endif
  30. #ifdef CONFIG_RBD
  31. "block-", "rbd",
  32. #endif
  33. #ifdef CONFIG_AUDIO_ALSA
  34. "audio-", "alsa",
  35. #endif
  36. #ifdef CONFIG_AUDIO_OSS
  37. "audio-", "oss",
  38. #endif
  39. #ifdef CONFIG_AUDIO_PA
  40. "audio-", "pa",
  41. #endif
  42. #ifdef CONFIG_AUDIO_SDL
  43. "audio-", "sdl",
  44. #endif
  45. #ifdef CONFIG_CURSES
  46. "ui-", "curses",
  47. #endif
  48. #if defined(CONFIG_GTK) && defined(CONFIG_VTE)
  49. "ui-", "gtk",
  50. #endif
  51. #ifdef CONFIG_SDL
  52. "ui-", "sdl",
  53. #endif
  54. #if defined(CONFIG_SPICE) && defined(CONFIG_GIO)
  55. "ui-", "spice-app",
  56. #endif
  57. };
  58. int i;
  59. g_test_init(&argc, &argv, NULL);
  60. for (i = 0; i < G_N_ELEMENTS(modules); i += 2) {
  61. char *testname = g_strdup_printf("/module/load/%s", modules[i + 1]);
  62. qtest_add_data_func(testname, modules + i, test_modules_load);
  63. g_free(testname);
  64. }
  65. return g_test_run();
  66. }