source: rtems/testsuites/sptests/sptasknopreempt01/init.c

Last change on this file was bcef89f2, checked in by Sebastian Huber <sebastian.huber@…>, on 05/19/23 at 06:18:25

Update company name

The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Copyright (C) 2015, 2022 embedded brains GmbH & Co. KG
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifdef HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include "tmacros.h"
33
34const char rtems_test_name[] = "SPTASKNOPREEMPT 1";
35
36static bool did_run;
37
38static void do_not_run(rtems_task_argument arg)
39{
40  rtems_test_assert(0);
41}
42
43static void test(void)
44{
45  rtems_status_code sc;
46  rtems_id task;
47
48  sc = rtems_task_create(
49    rtems_build_name('T', 'E', 'S', 'T'),
50    1,
51    RTEMS_MINIMUM_STACK_SIZE,
52    RTEMS_DEFAULT_MODES,
53    RTEMS_DEFAULT_ATTRIBUTES,
54    &task
55  );
56  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
57
58  sc = rtems_task_start(task, do_not_run, 0);
59  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
60
61  /*
62   * This will start a task with a priority of PRIORITY_MINIMUM.  Check that
63   * this task and the test task did not preempt the current task.  See also
64   * https://devel.rtems.org/ticket/2365.
65   */
66  sc = rtems_timer_initiate_server(
67    RTEMS_TIMER_SERVER_DEFAULT_PRIORITY,
68    RTEMS_MINIMUM_STACK_SIZE,
69    RTEMS_DEFAULT_ATTRIBUTES
70  );
71  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
72
73  rtems_test_assert(!did_run);
74
75  sc = rtems_task_delete(task);
76  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
77}
78
79static void Init(rtems_task_argument arg)
80{
81  TEST_BEGIN();
82
83  test();
84
85  TEST_END();
86  rtems_test_exit(0);
87}
88
89#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
90#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
91
92#define CONFIGURE_MAXIMUM_TASKS 3
93
94#define CONFIGURE_INIT_TASK_PRIORITY 2
95
96#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
97
98#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
99
100#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
101
102#define CONFIGURE_INIT
103
104#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.