source: rtems/testsuites/libtests/capture01/init.c @ f703e7f

5
Last change on this file since f703e7f was f703e7f, checked in by Sebastian Huber <sebastian.huber@…>, on 10/26/17 at 11:59:05

tests: Move rtems_test_printer definition

Statically initialize it to use printk().

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may in
6 *  the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#define CONFIGURE_INIT
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#define TEST_INIT
17
18#include "system.h"
19#include <ctype.h>
20#include <stdlib.h>
21#include <stdio.h>
22#include <string.h>
23#include <inttypes.h>
24
25#include <rtems.h>
26#include <rtems/capture-cli.h>
27#include <rtems/captureimpl.h>
28#include <rtems/monitor.h>
29#include <rtems/shell.h>
30#include <assert.h>
31
32#define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
33
34/* forward declarations to avoid warnings */
35rtems_task Init(rtems_task_argument argument);
36
37const char rtems_test_name[] = "CAPTURE 1";
38
39rtems_task Init(
40  rtems_task_argument ignored
41)
42{
43#if BSP_SMALL_MEMORY
44  printf("NO Capture Engine. MEMORY TOO SMALL");
45#else
46  rtems_status_code   sc;
47  rtems_task_priority old_priority;
48  rtems_mode          old_mode;
49  rtems_name          to_name = rtems_build_name('I', 'D', 'L', 'E');;
50
51  rtems_print_printer_printf(&rtems_test_printer);
52
53  rtems_test_begin();
54
55  rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
56  rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
57
58  sc = rtems_capture_open (5000, NULL);
59  ASSERT_SC(sc);
60
61  sc = rtems_capture_watch_ceiling (100);
62  ASSERT_SC(sc);
63
64  sc = rtems_capture_watch_floor (102);
65  ASSERT_SC(sc);
66
67  sc = rtems_capture_watch_global (true);
68  ASSERT_SC(sc);
69
70  sc = rtems_capture_set_trigger (
71    0,
72    0,
73    to_name,
74    0,
75    rtems_capture_from_any,
76    rtems_capture_switch
77  );
78  ASSERT_SC(sc);
79
80  rtems_capture_print_watch_list();
81
82  sc = rtems_capture_set_control (true);
83  ASSERT_SC(sc);
84
85  capture_test_1();
86
87  sc = rtems_capture_set_control (false);
88  ASSERT_SC(sc);
89
90  rtems_capture_print_trace_records ( 22, false );
91  rtems_capture_print_trace_records ( 22, false );
92
93  rtems_test_end();
94  exit( 0 );
95
96#endif
97}
Note: See TracBrowser for help on using the repository browser.