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

Last change on this file was 33078a2, checked in by Joel Sherrill <joel@…>, on 04/07/22 at 13:44:05

testsuites/libtests/[a-l]*: Change license to BSD-2

Updates #3053.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 *  COPYRIGHT (c) 1989-2012.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#define CONFIGURE_INIT
30
31#ifdef HAVE_CONFIG_H
32#include "config.h"
33#endif
34
35#include "system.h"
36#include <ctype.h>
37#include <stdlib.h>
38#include <stdio.h>
39#include <string.h>
40#include <inttypes.h>
41
42#include <rtems.h>
43#include <rtems/capture-cli.h>
44#include <rtems/captureimpl.h>
45#include <rtems/monitor.h>
46#include <rtems/shell.h>
47#include <assert.h>
48#include <tmacros.h>
49
50#define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
51
52/* forward declarations to avoid warnings */
53rtems_task Init(rtems_task_argument argument);
54
55const char rtems_test_name[] = "CAPTURE 1";
56
57rtems_task Init(
58  rtems_task_argument ignored
59)
60{
61  rtems_status_code   sc;
62  rtems_task_priority old_priority;
63  rtems_mode          old_mode;
64  rtems_name          to_name = rtems_build_name('I', 'D', 'L', 'E');;
65
66  rtems_print_printer_fprintf_putc(&rtems_test_printer);
67
68  TEST_BEGIN();
69
70  rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
71  rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
72
73  sc = rtems_capture_open (5000, NULL);
74  ASSERT_SC(sc);
75
76  sc = rtems_capture_watch_ceiling (100);
77  ASSERT_SC(sc);
78
79  sc = rtems_capture_watch_floor (102);
80  ASSERT_SC(sc);
81
82  sc = rtems_capture_watch_global (true);
83  ASSERT_SC(sc);
84
85  sc = rtems_capture_set_trigger (
86    0,
87    0,
88    to_name,
89    0,
90    rtems_capture_from_any,
91    rtems_capture_switch
92  );
93  ASSERT_SC(sc);
94
95  rtems_capture_print_watch_list();
96
97  sc = rtems_capture_set_control (true);
98  ASSERT_SC(sc);
99
100  capture_test_1();
101
102  sc = rtems_capture_set_control (false);
103  ASSERT_SC(sc);
104
105  rtems_capture_print_trace_records ( 22, false );
106  rtems_capture_print_trace_records ( 22, false );
107
108  TEST_END();
109  exit( 0 );
110}
Note: See TracBrowser for help on using the repository browser.