summaryrefslogtreecommitdiff
path: root/test/tx/cmake/module_qemu/tests/harness_checks.c
blob: 4b7cff05d1b7e0ab054751373ddfbfa06e3ef53a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/***************************************************************************
 * Copyright (c) 2026 Eclipse ThreadX contributors
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * AI Disclosure: This file was largely AI-generated by Claude Code (Opus 5.5).
 * The AI-generated portions may be considered public domain (CC0-1.0)
 * and not subject to the project's licence. The human contributor has
 * reviewed and verified that the code is correct.
 *
 * SPDX-License-Identifier: MIT and CC0-1.0
 **************************************************************************/


/**************************************************************************/
/**************************************************************************/
/**                                                                       */
/** ThreadX Test                                                          */
/**                                                                       */
/**   Module execution harness: checks shared by the test images          */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/

#include "harness_checks.h"


VOID  harness_check_services(ULONG cycle)
{
    harness_expect("module start thread ran", MODULE_SHARED[MODULE_OUT_STARTED], MODULE_STARTED_MAGIC);
    harness_expect("module saw the load cycle", MODULE_SHARED[MODULE_OUT_CYCLE_SEEN], cycle);
    harness_expect("module object allocation", MODULE_SHARED[MODULE_OUT_OBJECT_STATUS], (ULONG) TX_SUCCESS);
    harness_expect("module object creation and queue send", MODULE_SHARED[MODULE_OUT_CREATE_STATUS], (ULONG) TX_SUCCESS);
    harness_expect("module worker received the message", MODULE_SHARED[MODULE_OUT_QUEUE_VALUE], MODULE_QUEUE_MESSAGE);
    harness_expect("module worker ran once", MODULE_SHARED[MODULE_OUT_WORKER_RUNS], 1UL);
    harness_expect("module semaphore get", MODULE_SHARED[MODULE_OUT_SEMAPHORE_STATUS], (ULONG) TX_SUCCESS);
    harness_expect("module sleep lasted its ticks",
                   (ULONG) (MODULE_SHARED[MODULE_OUT_SLEEP_TICKS] >= EXPECTED_SLEEP_TICKS), (ULONG) TX_TRUE);
}


ULONG  harness_module_pool_available(VOID)
{
TX_NAME_CONST CHAR *name;
ULONG       available;
ULONG       fragments;
TX_THREAD   *first_suspended;
ULONG       suspended_count;
TX_BYTE_POOL *next_pool;

    available = 0UL;
    (VOID) tx_byte_pool_info_get(&_txm_module_manager_byte_pool, &name, &available, &fragments,
                                 &first_suspended, &suspended_count, &next_pool);
    return(available);
}