source: rtems/testsuites/sptests/spfatal30/init.c @ 98c6d50

5
Last change on this file since 98c6d50 was 98c6d50, checked in by Chris Johns <chrisj@…>, on 10/19/17 at 05:39:16

testsuite: Use printk for all test output where possible.

  • Remove the printf support leaving the direct printk support configured with TESTS_USE_PRINTK and all other output goes via a buffered vsniprintf call to printk.
  • Control the test's single init for functions and global data with TEST_INIT and not CONFIGURE_INIT. They are now separate.

Updates #3170.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#define TEST_INIT
20
21#define TESTS_USE_PRINTK
22#include "tmacros.h"
23
24#include <rtems.h>
25
26const char rtems_test_name[] = "SPFATAL 30";
27
28#if (CPU_HARDWARE_FP == TRUE && CPU_ALL_TASKS_ARE_FP == FALSE) \
29  || SPARC_HAS_FPU == 1
30#define EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
31#endif
32
33static volatile double f = 1.0;
34
35static void Init(rtems_task_argument arg)
36{
37  TEST_BEGIN();
38
39  f *= 123.456;
40
41#ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
42  rtems_test_assert(0);
43#else
44  TEST_END();
45  rtems_test_exit(0);
46#endif
47}
48
49#ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
50static void fatal_extension(
51  rtems_fatal_source source,
52  bool always_set_to_false,
53  rtems_fatal_code code
54)
55{
56  if (
57    source == INTERNAL_ERROR_CORE
58      && !always_set_to_false
59      && code == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
60  ) {
61    TEST_END();
62  }
63}
64
65#define CONFIGURE_INITIAL_EXTENSIONS \
66  { .fatal = fatal_extension }, \
67  RTEMS_TEST_INITIAL_EXTENSION
68
69#else /* EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT */
70
71#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
72
73#endif /* EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT */
74
75#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
76
77#define CONFIGURE_MAXIMUM_TASKS 1
78
79#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
80
81#define CONFIGURE_INIT
82
83#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.