~gnome3-team/mutter/trunk

« back to all changes in this revision

Viewing changes to cogl/tests/unit/test-unit-main.c

  • Committer: Rui Matos
  • Date: 2016-04-27 16:36:25 UTC
  • mfrom: (0.87.3184)
  • Revision ID: git-v1:3fcbe1d3ec5c9208dde080f7e9dac24e4c379bc0
Merge cogl's cogl-1.22 branch into mutter

https://bugzilla.gnome.org/show_bug.cgi?id=760439

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <config.h>
 
2
 
 
3
#include <gmodule.h>
 
4
 
 
5
#include <test-fixtures/test-unit.h>
 
6
#include <stdlib.h>
 
7
 
 
8
int
 
9
main (int argc, char **argv)
 
10
{
 
11
  GModule *main_module;
 
12
  const CoglUnitTest *unit_test;
 
13
  int i;
 
14
 
 
15
  if (argc != 2)
 
16
    {
 
17
      g_printerr ("usage %s UNIT_TEST\n", argv[0]);
 
18
      exit (1);
 
19
    }
 
20
 
 
21
  /* Just for convenience in case people try passing the wrapper
 
22
   * filenames for the UNIT_TEST argument we normalize '-' characters
 
23
   * to '_' characters... */
 
24
  for (i = 0; argv[1][i]; i++)
 
25
    {
 
26
      if (argv[1][i] == '-')
 
27
        argv[1][i] = '_';
 
28
    }
 
29
 
 
30
  main_module = g_module_open (NULL, /* use main module */
 
31
                               0 /* flags */);
 
32
 
 
33
  if (!g_module_symbol (main_module, argv[1], (void **) &unit_test))
 
34
    {
 
35
      g_printerr ("Unknown test name \"%s\"\n", argv[1]);
 
36
      return 1;
 
37
    }
 
38
 
 
39
  test_utils_init (unit_test->requirement_flags,
 
40
                   unit_test->known_failure_flags);
 
41
  unit_test->run ();
 
42
  test_utils_fini ();
 
43
 
 
44
  return 0;
 
45
}