2
* Copyright (C) 2011 Google Inc.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General
15
* Public License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17
* Boston, MA 02111-1307, USA.
19
* Author: Nikki VonHollen <vonhollen@google.com>
22
#include "polkittesthelper.h"
26
/* TODO: Log handling with unit tests is horrible. Figure out a way to always
27
* show logs, without munging up test output. For now, we hide them
28
* unless --verbose is used with g_test_message(...).
32
polkit_test_log_handler (const gchar *log_domain,
33
GLogLevelFlags log_level,
37
g_test_message("%s", message);
41
* Send all future log messages to g_test_message(...).
43
* Logs will only be shown when test programs are run with --verbose.
46
polkit_test_redirect_logs (void)
48
g_log_set_default_handler (polkit_test_log_handler, NULL);
52
* Get absolute path to test data.
54
* Requires POLKIT_TEST_DATA environment variable to point to root data dir.
56
* @param relpath Relative path to test data
57
* @return Full path to data as string. Free with g_free().
60
polkit_test_get_data_path (const gchar *relpath)
62
const gchar *root = getenv ("POLKIT_TEST_DATA");
66
return g_strconcat(root, "/", relpath, NULL);