[tracker] tests/libtracker-common: Missing file in previous commit (sched test)



commit 48450eeb103344a05fe596b7800f664f697ac65b
Author: Ivan Frade <ivan frade gmail com>
Date:   Thu Oct 27 11:41:34 2011 +0300

    tests/libtracker-common: Missing file in previous commit (sched test)

 tests/libtracker-common/tracker-sched-test.c |   62 ++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/tests/libtracker-common/tracker-sched-test.c b/tests/libtracker-common/tracker-sched-test.c
new file mode 100644
index 0000000..2f431c3
--- /dev/null
+++ b/tests/libtracker-common/tracker-sched-test.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2011, Nokia <ivan frade nokia com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+#include "config.h"
+
+#include <glib.h>
+#include <libtracker-common/tracker-sched.h>
+
+#ifdef __linux__
+#include <linux/sched.h>
+#endif
+
+
+#include <sched.h>
+#include <errno.h>
+
+
+gboolean
+scheduler_is (gint scheduler) 
+{
+#ifdef __linux__
+        return (sched_getscheduler (0) == scheduler);
+#else
+        return TRUE;
+#endif
+}
+
+void
+test_sched_set_and_get ()
+{
+        g_assert (scheduler_is (SCHED_OTHER));
+        g_assert (tracker_sched_idle ());
+        g_assert (scheduler_is (SCHED_IDLE));
+}
+
+
+gint
+main (gint argc, gchar **argv)
+{
+        g_type_init ();
+        g_test_init (&argc, &argv, NULL);
+
+        g_test_add_func ("/libtracker-common/sched/set_and_get",
+                         test_sched_set_and_get);
+
+        return g_test_run ();
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]