1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef OSAL_TEST_CASE_CMD_H 10 #define OSAL_TEST_CASE_CMD_H 11 12 #include "hdf_base.h" 13 #include "osal_test_case_def.h" 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif /* __cplusplus */ 18 19 #define BITS_PER_INT 32 20 21 #define OSAL_TEST_CASE_CNT (OSAL_TEST_MAX / BITS_PER_INT + 1) 22 23 extern uint32_t g_osalTestCases[OSAL_TEST_CASE_CNT]; 24 extern bool g_testEndFlag; 25 26 #define OSAL_TEST_CASE_SET(cmd) (g_osalTestCases[(cmd) / BITS_PER_INT] |= ((uint32_t)1 << ((cmd) % BITS_PER_INT))) 27 #define OSAL_TEST_CASE_CHECK(cmd) (g_osalTestCases[(cmd) / BITS_PER_INT] & ((uint32_t)1 << ((cmd) % BITS_PER_INT))) 28 29 #define UT_TEST_CHECK_RET(val, cmd) do { \ 30 if ((val) && (g_testEndFlag == false)) { \ 31 HDF_LOGE("[OSAL_UT_TEST] %s %d %d OSA_UT_TEST_FAIL ", __func__, __LINE__, cmd); \ 32 OSAL_TEST_CASE_SET((cmd)); \ 33 } \ 34 } while (0) 35 36 #ifdef __cplusplus 37 } 38 #endif /* __cplusplus */ 39 40 #endif /* OSAL_TEST_CASE_CMD_H */ 41