added -m=thorough support to gtester.
[platform/upstream/glib.git] / glib / gtester.c
1 /* GLib testing framework runner
2  * Copyright (C) 2007 Sven Herzberg
3  * Copyright (C) 2007 Tim Janik
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 #include <glib.h>
21 #include <gstdio.h>
22 #include <string.h>
23 #include <stdlib.h>
24 #include <unistd.h>
25 #include <fcntl.h>
26 #include <sys/wait.h>
27 #include <errno.h>
28 #include <signal.h>
29
30 /* the read buffer size in bytes */
31 #define READ_BUFFER_SIZE 4096
32
33 /* --- prototypes --- */
34 static int      main_selftest   (int    argc,
35                                  char **argv);
36 static void     parse_args      (gint           *argc_p,
37                                  gchar        ***argv_p);
38
39 /* --- variables --- */
40 static GIOChannel  *ioc_report = NULL;
41 static gboolean     gtester_quiet = FALSE;
42 static gboolean     gtester_verbose = FALSE;
43 static gboolean     gtester_list_tests = FALSE;
44 static gboolean     gtester_selftest = FALSE;
45 static gboolean     subtest_running = FALSE;
46 static gint         subtest_exitstatus = 0;
47 static gboolean     subtest_io_pending = FALSE;
48 static gboolean     subtest_quiet = TRUE;
49 static gboolean     subtest_verbose = FALSE;
50 static gboolean     subtest_mode_fatal = TRUE;
51 static gboolean     subtest_mode_perf = FALSE;
52 static gboolean     subtest_mode_quick = TRUE;
53 static const gchar *subtest_seedstr = NULL;
54 static gchar       *subtest_last_seed = NULL;
55 static GSList      *subtest_paths = NULL;
56 static GSList      *subtest_args = NULL;
57 static gboolean     testcase_open = FALSE;
58 static guint        testcase_count = 0;
59 static guint        testcase_fail_count = 0;
60 static const gchar *output_filename = NULL;
61 static guint        log_indent = 0;
62 static gint         log_fd = -1;
63
64 /* --- functions --- */
65 static const char*
66 sindent (guint n)
67 {
68   static const char spaces[] = "                                                                                                    ";
69   int l = sizeof (spaces) - 1;
70   n = MIN (n, l);
71   return spaces + l - n;
72 }
73
74 static void G_GNUC_PRINTF (1, 2)
75 test_log_printfe (const char *format,
76                   ...)
77 {
78   char *result;
79   int r;
80   va_list args;
81   va_start (args, format);
82   result = g_markup_vprintf_escaped (format, args);
83   va_end (args);
84   do
85     r = write (log_fd, result, strlen (result));
86   while (r < 0 && errno == EINTR);
87   g_free (result);
88 }
89
90 static void
91 terminate (void)
92 {
93   kill (getpid(), SIGTERM);
94   abort();
95 }
96
97 static void
98 testcase_close (long double duration,
99                 gint        exit_status,
100                 guint       n_forks)
101 {
102   g_return_if_fail (testcase_open > 0);
103   test_log_printfe ("%s<duration>%.6Lf</duration>\n", sindent (log_indent), duration);
104   test_log_printfe ("%s<status exit-status=\"%d\" n-forks=\"%d\" result=\"%s\"/>\n",
105                     sindent (log_indent), exit_status, n_forks,
106                     exit_status ? "failed" : "success");
107   log_indent -= 2;
108   test_log_printfe ("%s</testcase>\n", sindent (log_indent));
109   testcase_open--;
110   if (gtester_verbose)
111     g_print ("%s\n", exit_status ? "FAIL" : "OK");
112   if (exit_status && subtest_last_seed)
113     g_print ("GTester: last random seed: %s\n", subtest_last_seed);
114   if (exit_status)
115     testcase_fail_count += 1;
116   if (subtest_mode_fatal && testcase_fail_count)
117     terminate();
118 }
119
120 static void
121 test_log_msg (GTestLogMsg *msg)
122 {
123   switch (msg->log_type)
124     {
125     case G_TEST_LOG_NONE:
126       break;
127     case G_TEST_LOG_ERROR:
128       g_printerr ("%s\n", msg->strings[0]);
129       break;
130     case G_TEST_LOG_START_BINARY:
131       test_log_printfe ("%s<binary file=\"%s\"/>\n", sindent (log_indent), msg->strings[0]);
132       subtest_last_seed = g_strdup (msg->strings[1]);
133       test_log_printfe ("%s<random-seed>%s</random-seed>\n", sindent (log_indent), subtest_last_seed);
134       break;
135     case G_TEST_LOG_LIST_CASE:
136       g_print ("%s\n", msg->strings[0]);
137       break;
138     case G_TEST_LOG_START_CASE:
139       testcase_count++;
140       if (gtester_verbose)
141         {
142           gchar *sc = g_strconcat (msg->strings[0], ":", NULL);
143           gchar *sleft = g_strdup_printf ("%-68s", sc);
144           g_free (sc);
145           g_print ("%70s ", sleft);
146           g_free (sleft);
147         }
148       g_return_if_fail (testcase_open == 0);
149       testcase_open++;
150       test_log_printfe ("%s<testcase path=\"%s\">\n", sindent (log_indent), msg->strings[0]);
151       log_indent += 2;
152       break;
153     case G_TEST_LOG_SKIP_CASE:
154       if (FALSE && gtester_verbose) // enable to debug test case skipping logic
155         {
156           gchar *sc = g_strconcat (msg->strings[0], ":", NULL);
157           gchar *sleft = g_strdup_printf ("%-68s", sc);
158           g_free (sc);
159           g_print ("%70s SKIPPED\n", sleft);
160           g_free (sleft);
161         }
162       test_log_printfe ("%s<testcase path=\"%s\" skipped=\"1\"/>\n", sindent (log_indent), msg->strings[0]);
163       break;
164     case G_TEST_LOG_STOP_CASE:
165       testcase_close (msg->nums[2], (int) msg->nums[0], (int) msg->nums[1]);
166       break;
167     case G_TEST_LOG_MIN_RESULT:
168     case G_TEST_LOG_MAX_RESULT:
169       test_log_printfe ("%s<performance minimize=\"%d\" maximize=\"%d\" value=\"%.16Lg\">\n",
170                         sindent (log_indent), msg->log_type == G_TEST_LOG_MIN_RESULT, msg->log_type == G_TEST_LOG_MAX_RESULT, msg->nums[0]);
171       test_log_printfe ("%s%s\n", sindent (log_indent + 2), msg->strings[0]);
172       test_log_printfe ("%s</performance>\n", sindent (log_indent));
173       break;
174     case G_TEST_LOG_MESSAGE:
175       test_log_printfe ("%s<message>\n%s\n%s</message>\n", sindent (log_indent), msg->strings[0], sindent (log_indent));
176       break;
177     }
178 }
179
180 static gboolean
181 child_report_cb (GIOChannel  *source,
182                  GIOCondition condition,
183                  gpointer     data)
184 {
185   GTestLogBuffer *tlb = data;
186   GIOStatus status = G_IO_STATUS_NORMAL;
187   gsize length = 0;
188   do
189     {
190       guint8 buffer[READ_BUFFER_SIZE];
191       GError *error = NULL;
192       status = g_io_channel_read_chars (source, (gchar*) buffer, sizeof (buffer), &length, &error);
193       if (length)
194         {
195           GTestLogMsg *msg;
196           g_test_log_buffer_push (tlb, length, buffer);
197           do
198             {
199               msg = g_test_log_buffer_pop (tlb);
200               if (msg)
201                 {
202                   test_log_msg (msg);
203                   g_test_log_msg_free (msg);
204                 }
205             }
206           while (msg);
207         }
208       g_clear_error (&error);
209       /* ignore the io channel status, which seems to be bogus especially for non blocking fds */
210       (void) status;
211     }
212   while (length > 0);
213   if (condition & (G_IO_ERR | G_IO_HUP))
214     {
215       /* if there's no data to read and select() reports an error or hangup,
216        * the fd must have been closed remotely
217        */
218       subtest_io_pending = FALSE;
219       return FALSE;
220     }
221   return TRUE; /* keep polling */
222 }
223
224 static void
225 child_watch_cb (GPid     pid,
226                 gint     status,
227                 gpointer data)
228 {
229   g_spawn_close_pid (pid);
230   if (WIFEXITED (status)) /* normal exit */
231     subtest_exitstatus = WEXITSTATUS (status);
232   else /* signal or core dump, etc */
233     subtest_exitstatus = 0xffffffff;
234   subtest_running = FALSE;
235 }
236
237 static gchar*
238 queue_gfree (GSList **slistp,
239              gchar   *string)
240 {
241   *slistp = g_slist_prepend (*slistp, string);
242   return string;
243 }
244
245 static void
246 unset_cloexec_fdp (gpointer fdp_data)
247 {
248   int r, *fdp = fdp_data;
249   do
250     r = fcntl (*fdp, F_SETFD, 0 /* FD_CLOEXEC */);
251   while (r < 0 && errno == EINTR);
252 }
253
254 static gboolean
255 launch_test_binary (const char *binary,
256                     guint       skip_tests)
257 {
258   GTestLogBuffer *tlb;
259   GSList *slist, *free_list = NULL;
260   GError *error = NULL;
261   const gchar *argv[99 + g_slist_length (subtest_args) + g_slist_length (subtest_paths)];
262   GPid pid = 0;
263   gint report_pipe[2] = { -1, -1 };
264   gint i = 0;
265
266   if (pipe (report_pipe) < 0)
267     {
268       if (subtest_mode_fatal)
269         g_error ("Failed to open pipe for test binary: %s: %s", binary, g_strerror (errno));
270       else
271         g_warning ("Failed to open pipe for test binary: %s: %s", binary, g_strerror (errno));
272       return FALSE;
273     }
274
275   /* setup argv */
276   argv[i++] = binary;
277   for (slist = subtest_args; slist; slist = slist->next)
278     argv[i++] = (gchar*) slist->data;
279   // argv[i++] = "--debug-log";
280   if (subtest_quiet)
281     argv[i++] = "--quiet";
282   if (subtest_verbose)
283     argv[i++] = "--verbose";
284   if (!subtest_mode_fatal)
285     argv[i++] = "--keep-going";
286   if (subtest_mode_quick)
287     argv[i++] = "-m=quick";
288   else
289     argv[i++] = "-m=slow";
290   if (subtest_mode_perf)
291     argv[i++] = "-m=perf";
292   if (gtester_list_tests)
293     argv[i++] = "-l";
294   if (subtest_seedstr)
295     argv[i++] = queue_gfree (&free_list, g_strdup_printf ("--seed=%s", subtest_seedstr));
296   argv[i++] = queue_gfree (&free_list, g_strdup_printf ("--GTestLogFD=%u", report_pipe[1]));
297   if (skip_tests)
298     argv[i++] = queue_gfree (&free_list, g_strdup_printf ("--GTestSkipCount=%u", skip_tests));
299   for (slist = subtest_paths; slist; slist = slist->next)
300     argv[i++] = queue_gfree (&free_list, g_strdup_printf ("-p=%s", (gchar*) slist->data));
301   argv[i++] = NULL;
302
303   g_spawn_async_with_pipes (NULL, /* g_get_current_dir() */
304                             (gchar**) argv,
305                             NULL, /* envp */
306                             G_SPAWN_DO_NOT_REAP_CHILD, /* G_SPAWN_SEARCH_PATH */
307                             unset_cloexec_fdp, &report_pipe[1], /* pre-exec callback */
308                             &pid,
309                             NULL,       /* standard_input */
310                             NULL,       /* standard_output */
311                             NULL,       /* standard_error */
312                             &error);
313   g_slist_foreach (free_list, (void(*)(void*,void*)) g_free, NULL);
314   g_slist_free (free_list);
315   free_list = NULL;
316   close (report_pipe[1]);
317
318   if (!gtester_quiet)
319     g_print ("(pid=%lu)\n", (unsigned long) pid);
320
321   if (error)
322     {
323       close (report_pipe[0]);
324       if (subtest_mode_fatal)
325         g_error ("Failed to execute test binary: %s: %s", argv[0], error->message);
326       else
327         g_warning ("Failed to execute test binary: %s: %s", argv[0], error->message);
328       g_clear_error (&error);
329       return FALSE;
330     }
331
332   subtest_running = TRUE;
333   subtest_io_pending = TRUE;
334   tlb = g_test_log_buffer_new();
335   if (report_pipe[0] >= 0)
336     {
337       ioc_report = g_io_channel_unix_new (report_pipe[0]);
338       g_io_channel_set_flags (ioc_report, G_IO_FLAG_NONBLOCK, NULL);
339       g_io_channel_set_encoding (ioc_report, NULL, NULL);
340       g_io_channel_set_buffered (ioc_report, FALSE);
341       g_io_add_watch_full (ioc_report, G_PRIORITY_DEFAULT - 1, G_IO_IN | G_IO_ERR | G_IO_HUP, child_report_cb, tlb, NULL);
342       g_io_channel_unref (ioc_report);
343     }
344   g_child_watch_add_full (G_PRIORITY_DEFAULT + 1, pid, child_watch_cb, NULL, NULL);
345
346   while (subtest_running ||             /* FALSE once child exits */
347          subtest_io_pending ||          /* FALSE once ioc_report closes */
348          g_main_context_pending (NULL)) /* TRUE while idler, etc are running */
349     g_main_context_iteration (NULL, TRUE);
350
351   close (report_pipe[0]);
352   g_test_log_buffer_free (tlb);
353
354   return TRUE;
355 }
356
357 static void
358 launch_test (const char *binary)
359 {
360   gboolean success = TRUE;
361   GTimer *btimer = g_timer_new();
362   gboolean need_restart;
363   testcase_count = 0;
364   testcase_fail_count = 0;
365   if (!gtester_quiet)
366     g_print ("TEST: %s... ", binary);
367
368  retry:
369   test_log_printfe ("%s<testbinary path=\"%s\">\n", sindent (log_indent), binary);
370   log_indent += 2;
371   g_timer_start (btimer);
372   subtest_exitstatus = 0;
373   success &= launch_test_binary (binary, testcase_count);
374   success &= subtest_exitstatus == 0;
375   need_restart = testcase_open != 0;
376   if (testcase_open)
377     testcase_close (0, -256, 0);
378   g_timer_stop (btimer);
379   test_log_printfe ("%s<duration>%.6f</duration>\n", sindent (log_indent), g_timer_elapsed (btimer, NULL));
380   log_indent -= 2;
381   test_log_printfe ("%s</testbinary>\n", sindent (log_indent));
382   g_free (subtest_last_seed);
383   subtest_last_seed = NULL;
384   if (need_restart)
385     {
386       /* restart test binary, skipping processed test cases */
387       goto retry;
388     }
389
390   if (!gtester_quiet)
391     g_print ("%s: %s\n", testcase_fail_count || !success ? "FAIL" : "PASS", binary);
392   g_timer_destroy (btimer);
393   if (subtest_mode_fatal && !success)
394     terminate();
395 }
396
397 static void
398 usage (gboolean just_version)
399 {
400   if (just_version)
401     {
402       g_print ("gtester version %d.%d.%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
403       return;
404     }
405   g_print ("Usage: gtester [OPTIONS] testprogram...\n");
406   /*        12345678901234567890123456789012345678901234567890123456789012345678901234567890 */
407   g_print ("Options:\n");
408   g_print ("  -h, --help                  show this help message\n");
409   g_print ("  -v, --version               print version informations\n");
410   g_print ("  --g-fatal-warnings          make warnings fatal (abort)\n");
411   g_print ("  -k, --keep-going            continue running after tests failed\n");
412   g_print ("  -l                          list paths of available test cases\n");
413   g_print ("  -m=perf, -m=slow, -m=quick -m=thorough\n");
414   g_print ("                              run test cases in mode perf, slow/thorough or quick (default)\n");
415   g_print ("  -p=TESTPATH                 only start test cases matching TESTPATH\n");
416   g_print ("  --seed=SEEDSTRING           start all tests with random number seed SEEDSTRING\n");
417   g_print ("  -o=LOGFILE                  write the test log to LOGFILE\n");
418   g_print ("  -q, --quiet                 suppress per test binary output\n");
419   g_print ("  --verbose                   report success per testcase\n");
420 }
421
422 static void
423 parse_args (gint    *argc_p,
424             gchar ***argv_p)
425 {
426   guint argc = *argc_p;
427   gchar **argv = *argv_p;
428   guint i, e;
429   /* parse known args */
430   for (i = 1; i < argc; i++)
431     {
432       if (strcmp (argv[i], "--g-fatal-warnings") == 0)
433         {
434           GLogLevelFlags fatal_mask = (GLogLevelFlags) g_log_set_always_fatal ((GLogLevelFlags) G_LOG_FATAL_MASK);
435           fatal_mask = (GLogLevelFlags) (fatal_mask | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL);
436           g_log_set_always_fatal (fatal_mask);
437           argv[i] = NULL;
438         }
439       else if (strcmp (argv[i], "--gtester-selftest") == 0)
440         {
441           gtester_selftest = TRUE;
442           argv[i] = NULL;
443           break;        // stop parsing regular gtester arguments
444         }
445       else if (strcmp (argv[i], "-h") == 0 || strcmp (argv[i], "--help") == 0)
446         {
447           usage (FALSE);
448           exit (0);
449           argv[i] = NULL;
450         }
451       else if (strcmp (argv[i], "-v") == 0 || strcmp (argv[i], "--version") == 0)
452         {
453           usage (TRUE);
454           exit (0);
455           argv[i] = NULL;
456         }
457       else if (strcmp (argv[i], "--keep-going") == 0 ||
458                strcmp (argv[i], "-k") == 0)
459         {
460           subtest_mode_fatal = FALSE;
461           argv[i] = NULL;
462         }
463       else if (strcmp ("-p", argv[i]) == 0 || strncmp ("-p=", argv[i], 3) == 0)
464         {
465           gchar *equal = argv[i] + 2;
466           if (*equal == '=')
467             subtest_paths = g_slist_prepend (subtest_paths, equal + 1);
468           else if (i + 1 < argc)
469             {
470               argv[i++] = NULL;
471               subtest_paths = g_slist_prepend (subtest_paths, argv[i]);
472             }
473           argv[i] = NULL;
474         }
475       else if (strcmp ("--test-arg", argv[i]) == 0 || strncmp ("--test-arg=", argv[i], 11) == 0)
476         {
477           gchar *equal = argv[i] + 10;
478           if (*equal == '=')
479             subtest_args = g_slist_prepend (subtest_args, equal + 1);
480           else if (i + 1 < argc)
481             {
482               argv[i++] = NULL;
483               subtest_args = g_slist_prepend (subtest_args, argv[i]);
484             }
485           argv[i] = NULL;
486         }
487       else if (strcmp ("-o", argv[i]) == 0 || strncmp ("-o=", argv[i], 3) == 0)
488         {
489           gchar *equal = argv[i] + 2;
490           if (*equal == '=')
491             output_filename = equal + 1;
492           else if (i + 1 < argc)
493             {
494               argv[i++] = NULL;
495               output_filename = argv[i];
496             }
497           argv[i] = NULL;
498         }
499       else if (strcmp ("-m", argv[i]) == 0 || strncmp ("-m=", argv[i], 3) == 0)
500         {
501           gchar *equal = argv[i] + 2;
502           const gchar *mode = "";
503           if (*equal == '=')
504             mode = equal + 1;
505           else if (i + 1 < argc)
506             {
507               argv[i++] = NULL;
508               mode = argv[i];
509             }
510           if (strcmp (mode, "perf") == 0)
511             subtest_mode_perf = TRUE;
512           else if (strcmp (mode, "slow") == 0 || strcmp (mode, "thorough") == 0)
513             subtest_mode_quick = FALSE;
514           else if (strcmp (mode, "quick") == 0)
515             {
516               subtest_mode_quick = TRUE;
517               subtest_mode_perf = FALSE;
518             }
519           else
520             g_error ("unknown test mode: -m %s", mode);
521           argv[i] = NULL;
522         }
523       else if (strcmp ("-q", argv[i]) == 0 || strcmp ("--quiet", argv[i]) == 0)
524         {
525           gtester_quiet = TRUE;
526           gtester_verbose = FALSE;
527           argv[i] = NULL;
528         }
529       else if (strcmp ("--verbose", argv[i]) == 0)
530         {
531           gtester_quiet = FALSE;
532           gtester_verbose = TRUE;
533           argv[i] = NULL;
534         }
535       else if (strcmp ("-l", argv[i]) == 0)
536         {
537           gtester_list_tests = TRUE;
538           argv[i] = NULL;
539         }
540       else if (strcmp ("--seed", argv[i]) == 0 || strncmp ("--seed=", argv[i], 7) == 0)
541         {
542           gchar *equal = argv[i] + 6;
543           if (*equal == '=')
544             subtest_seedstr = equal + 1;
545           else if (i + 1 < argc)
546             {
547               argv[i++] = NULL;
548               subtest_seedstr = argv[i];
549             }
550           argv[i] = NULL;
551         }
552     }
553   /* collapse argv */
554   e = 1;
555   for (i = 1; i < argc; i++)
556     if (argv[i])
557       {
558         argv[e++] = argv[i];
559         if (i >= e)
560           argv[i] = NULL;
561       }
562   *argc_p = e;
563 }
564
565 int
566 main (int    argc,
567       char **argv)
568 {
569   guint ui;
570
571   /* some unices need SA_RESTART for SIGCHLD to return -EAGAIN for io.
572    * we must fiddle with sigaction() *before* glib is used, otherwise
573    * we could revoke signal hanmdler setups from glib initialization code.
574    */
575   if (TRUE)
576     {
577       struct sigaction sa;
578       struct sigaction osa;
579       sa.sa_handler = SIG_DFL;
580       sigfillset (&sa.sa_mask);
581       sa.sa_flags = SA_RESTART;
582       sigaction (SIGCHLD, &sa, &osa);
583     }
584
585   g_set_prgname (argv[0]);
586   parse_args (&argc, &argv);
587   if (gtester_selftest)
588     return main_selftest (argc, argv);
589
590   if (argc <= 1)
591     {
592       usage (FALSE);
593       return 1;
594     }
595
596   if (output_filename)
597     {
598       log_fd = g_open (output_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
599       if (log_fd < 0)
600         g_error ("Failed to open log file '%s': %s", output_filename, g_strerror (errno));
601     }
602
603   test_log_printfe ("<?xml version=\"1.0\"?>\n");
604   test_log_printfe ("%s<gtester>\n", sindent (log_indent));
605   log_indent += 2;
606   for (ui = 1; ui < argc; ui++)
607     {
608       const char *binary = argv[ui];
609       launch_test (binary);
610       /* we only get here on success or if !subtest_mode_fatal */
611     }
612   log_indent -= 2;
613   test_log_printfe ("%s</gtester>\n", sindent (log_indent));
614
615   close (log_fd);
616
617   return 0;
618 }
619
620 static void
621 fixture_setup (guint        *fix,
622                gconstpointer test_data)
623 {
624   g_assert_cmphex (*fix, ==, 0);
625   *fix = 0xdeadbeef;
626 }
627 static void
628 fixture_test (guint        *fix,
629               gconstpointer test_data)
630 {
631   g_assert_cmphex (*fix, ==, 0xdeadbeef);
632   g_test_message ("This is a test message API test message.");
633   g_test_bug_base ("http://www.example.com/bugtracker/");
634   g_test_bug ("123");
635   g_test_bug_base ("http://www.example.com/bugtracker?bugnum=%s;cmd=showbug");
636   g_test_bug ("456");
637 }
638 static void
639 fixture_teardown (guint        *fix,
640                   gconstpointer test_data)
641 {
642   g_assert_cmphex (*fix, ==, 0xdeadbeef);
643 }
644
645 static int
646 main_selftest (int    argc,
647                char **argv)
648 {
649   /* gtester main() for --gtester-selftest invokations */
650   g_test_init (&argc, &argv, NULL);
651   g_test_add ("/gtester/fixture-test", guint, NULL, fixture_setup, fixture_test, fixture_teardown);
652   return g_test_run();
653 }