mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
reftests: Add a --output option to the test runner
This argument specifies where to dump images instead of /tmp. It's not hooked up to the test runner, so that one will continue to dump into /tmp.
This commit is contained in:
parent
3a5669afd0
commit
d0451d6fa4
@ -34,6 +34,35 @@ typedef enum {
|
||||
/* This is exactly the style information you've been looking for */
|
||||
#define GTK_STYLE_PROVIDER_PRIORITY_FORCE G_MAXUINT
|
||||
|
||||
static char *arg_output_dir = NULL;
|
||||
|
||||
static const GOptionEntry test_args[] = {
|
||||
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &arg_output_dir,
|
||||
"Directory to save image files to", "DIR" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static gboolean
|
||||
parse_command_line (int *argc, char ***argv)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GOptionContext *context;
|
||||
|
||||
context = g_option_context_new ("- run GTK reftests");
|
||||
g_option_context_add_main_entries (context, test_args, NULL);
|
||||
g_option_context_set_ignore_unknown_options (context, TRUE);
|
||||
|
||||
if (!g_option_context_parse (context, argc, argv, &error))
|
||||
{
|
||||
g_print ("option parsing failed: %s\n", error->message);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gtk_test_init (argc, argv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_output_dir (void)
|
||||
{
|
||||
@ -43,7 +72,16 @@ get_output_dir (void)
|
||||
if (output_dir)
|
||||
return output_dir;
|
||||
|
||||
if (arg_output_dir)
|
||||
{
|
||||
GFile *file = g_file_new_for_commandline_arg (arg_output_dir);
|
||||
output_dir = g_file_get_path (file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
else
|
||||
{
|
||||
output_dir = g_get_tmp_dir ();
|
||||
}
|
||||
|
||||
if (!g_file_test (output_dir, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
@ -499,7 +537,8 @@ add_tests_for_files_in_directory (GFile *dir)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
gtk_test_init (&argc, &argv);
|
||||
if (!parse_command_line (&argc, &argv))
|
||||
return 1;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user