1 /* EINA - EFL data type library
2 * Copyright (C) 2008 Cedric Bail
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.1 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 Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
23 #if defined(EFL_HAVE_THREADS) && defined __linux__
26 #include <sys/resource.h>
29 #include "eina_suite.h"
32 #if defined(EFL_HAVE_THREADS) && defined __linux__
35 * TODO: Test if RT priorities are right. However, make check should be run as
40 _thread_run(void *arg __UNUSED__)
42 int niceval = getpriority(PRIO_PROCESS, 0);
44 eina_sched_prio_drop();
46 niceval2 = getpriority(PRIO_PROCESS, 0);
47 fail_if((niceval2 != 19) && (niceval2 != niceval+5));
52 START_TEST(eina_test_sched_prio_drop)
54 int niceval = getpriority(PRIO_PROCESS, 0);
60 pthread_create(&tid, NULL, _thread_run, NULL);
62 niceval2 = getpriority(PRIO_PROCESS, 0);
63 /* niceness of main thread should not have changed */
64 fail_if(niceval2 != niceval);
66 pthread_join(tid, NULL);
67 /* niceness of main thread should not have changed */
68 fail_if(niceval2 != niceval);
74 START_TEST(eina_test_sched_prio_drop)
76 fprintf(stderr, "scheduler priority is not supported by your configuration.\n");
82 eina_test_sched(TCase *tc)
84 tcase_add_test(tc, eina_test_sched_prio_drop);