Replace the existing Apache 2.0 boilerplate header with an SPDX tag throughout the zephyr code tree. This patch was generated via a script run over the master branch. Also updated doc/porting/application.rst that had a dependency on line numbers in a literal include. Manually updated subsys/logging/sys_log.c that had a malformed header in the original file. Also cleanup several cases that already had a SPDX tag and we either got a duplicate or missed updating. Jira: ZEP-1457 Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c Signed-off-by: David B. Kinder <david.b.kinder@intel.com> Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
57 lines
1.3 KiB
C
57 lines
1.3 KiB
C
/*
|
|
* Copyright (c) 2016 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @addtogroup t_msgq_api
|
|
* @{
|
|
* @defgroup t_msgq_fail test_msgq_fail
|
|
* @brief TestPurpose: verify zephyr msgq return code under negative tests
|
|
* @}
|
|
*/
|
|
|
|
|
|
#include "test_msgq.h"
|
|
|
|
static char __aligned(4) tbuffer[MSG_SIZE * MSGQ_LEN];
|
|
static uint32_t data[MSGQ_LEN] = { MSG0, MSG1 };
|
|
|
|
/*test cases*/
|
|
void test_msgq_put_fail(void *p1, void *p2, void *p3)
|
|
{
|
|
struct k_msgq msgq;
|
|
|
|
k_msgq_init(&msgq, tbuffer, MSG_SIZE, MSGQ_LEN);
|
|
|
|
int ret = k_msgq_put(&msgq, (void *)&data[0], K_NO_WAIT);
|
|
|
|
assert_false(ret, NULL);
|
|
ret = k_msgq_put(&msgq, (void *)&data[0], K_NO_WAIT);
|
|
assert_false(ret, NULL);
|
|
/**TESTPOINT: msgq put returns -ENOMSG*/
|
|
ret = k_msgq_put(&msgq, (void *)&data[1], K_NO_WAIT);
|
|
assert_equal(ret, -ENOMSG, NULL);
|
|
/**TESTPOINT: msgq put returns -EAGAIN*/
|
|
ret = k_msgq_put(&msgq, (void *)&data[0], TIMEOUT);
|
|
assert_equal(ret, -EAGAIN, NULL);
|
|
|
|
k_msgq_purge(&msgq);
|
|
}
|
|
|
|
void test_msgq_get_fail(void *p1, void *p2, void *p3)
|
|
{
|
|
struct k_msgq msgq;
|
|
uint32_t rx_data;
|
|
|
|
k_msgq_init(&msgq, tbuffer, MSG_SIZE, MSGQ_LEN);
|
|
/**TESTPOINT: msgq get returns -ENOMSG*/
|
|
int ret = k_msgq_get(&msgq, &rx_data, K_NO_WAIT);
|
|
|
|
assert_equal(ret, -ENOMSG, NULL);
|
|
/**TESTPOINT: msgq get returns -EAGAIN*/
|
|
ret = k_msgq_get(&msgq, &rx_data, TIMEOUT);
|
|
assert_equal(ret, -EAGAIN, NULL);
|
|
}
|