source: rtems/testsuites/libtests/capture01/init.c @ 1055ff20

5
Last change on this file since 1055ff20 was 32ceb385, checked in by Sebastian Huber <sebastian.huber@…>, on 11/07/17 at 07:30:59

tests: Use <tmacros.h>

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#include "system.h"
17#include <ctype.h>
18#include <stdlib.h>
19#include <stdio.h>
20#include <string.h>
21#include <inttypes.h>
22
23#include <rtems.h>
24#include <rtems/capture-cli.h>
25#include <rtems/captureimpl.h>
26#include <rtems/monitor.h>
27#include <rtems/shell.h>
28#include <assert.h>
29#include <tmacros.h>
30
31#define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
32
33/* forward declarations to avoid warnings */
34rtems_task Init(rtems_task_argument argument);
35
36const char rtems_test_name[] = "CAPTURE 1";
37
38rtems_task Init(
39  rtems_task_argument ignored
40)
41{
42#if BSP_SMALL_MEMORY
43  printf("NO Capture Engine. MEMORY TOO SMALL");
44#else
45  rtems_status_code   sc;
46  rtems_task_priority old_priority;
47  rtems_mode          old_mode;
48  rtems_name          to_name = rtems_build_name('I', 'D', 'L', 'E');;
49
50  rtems_print_printer_fprintf_putc(&rtems_test_printer);
51
52  TEST_BEGIN();
53
54  rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
55  rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
56
57  sc = rtems_capture_open (5000, NULL);
58  ASSERT_SC(sc);
59
60  sc = rtems_capture_watch_ceiling (100);
61  ASSERT_SC(sc);
62
63  sc = rtems_capture_watch_floor (102);
64  ASSERT_SC(sc);
65
66  sc = rtems_capture_watch_global (true);
67  ASSERT_SC(sc);
68
69  sc = rtems_capture_set_trigger (
70    0,
71    0,
72    to_name,
73    0,
74    rtems_capture_from_any,
75    rtems_capture_switch
76  );
77  ASSERT_SC(sc);
78
79  rtems_capture_print_watch_list();
80
81  sc = rtems_capture_set_control (true);
82  ASSERT_SC(sc);
83
84  capture_test_1();
85
86  sc = rtems_capture_set_control (false);
87  ASSERT_SC(sc);
88
89  rtems_capture_print_trace_records ( 22, false );
90  rtems_capture_print_trace_records ( 22, false );
91
92  TEST_END();
93  exit( 0 );
94
95#endif
96}
Note: See TracBrowser for help on using the repository browser.