blob: ccb2f7b65d6528093f328c77e042e6bafdae3cb7 [file] [log] [blame]
Jon A. Cruz5a75a412015-07-02 23:36:44 -07001/*
2 * Copyright © 2015 Samsung Electronics Co., Ltd
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial
14 * portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
26#ifndef ZUC_EVENT_H
27#define ZUC_EVENT_H
28
29#include <stdint.h>
30
31#include "zunitc/zunitc_impl.h"
32
33/**
34 *
35 */
36enum zuc_event_type
37{
38 ZUC_EVENT_IMMEDIATE,
39 ZUC_EVENT_DEFERRED
40};
41
42/**
43 * Status enum for posted events.
44 */
45enum zuc_fail_state
46{
47 ZUC_CHECK_OK, /**< no problem. */
48 ZUC_CHECK_SKIP, /**< runtime skip directive encountered. */
49 ZUC_CHECK_FAIL, /**< non-fatal check fails. */
50 ZUC_CHECK_FATAL, /**< fatal assertion/check fails. */
51 ZUC_CHECK_ERROR /**< internal level problem. */
52};
53
54/**
55 * Record of an event that occurs during testing such as assert macro
56 * failures.
57 */
58struct zuc_event
59{
60 char *file;
61 int32_t line;
62 enum zuc_fail_state state;
63 enum zuc_check_op op;
64 enum zuc_check_valtype valtype;
65 intptr_t val1;
66 intptr_t val2;
67 char *expr1;
68 char *expr2;
69
70 struct zuc_event *next;
71};
72
73/**
74 * Attaches an event to the specified test.
75 *
76 * @param test the test to attach to.
77 * @param event the event to attach.
78 * @param event_type of event (immediate or deferred) to attach.
79 * @param transferred true if the event has been processed elsewhere and
80 * is being transferred for storage, false otherwise.
81 */
82void
83zuc_attach_event(struct zuc_test *test, struct zuc_event *event,
84 enum zuc_event_type event_type, bool transferred);
85
86#endif /* ZUC_EVENT_H */