tests: Remove broken net_buf unit tests
The net_buf unit tests were doing some pretty hacky stuff with defining a dummy _net_buf_pool_list variable to fulfil the linker magic that happens with a real build. Until now the code got lucky in that the simple net_buf_alloc() tests didn't depend on _net_buf_pool_list being valid, however with the coming redesign even net_buf_alloc will require proper setup of this. Since the unit tests were extremely minimal, and not testing anything beyond what tests/net/buf already tests, just remove them for now. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
1d131338bc
commit
bd989a79ba
|
@ -70,27 +70,6 @@ and are used to decide whether a test failed or passed by verifying whether an
|
|||
interaction with an object occurred, and if required, to assert the order of
|
||||
that interaction.
|
||||
|
||||
The :file:`samples/testing/unit` folder contains an example for testing
|
||||
the net-buf api of Zephyr.
|
||||
|
||||
CMakeLists.txt
|
||||
|
||||
.. literalinclude:: ../../../samples/testing/unit/CMakeLists.txt
|
||||
:language: CMake
|
||||
:linenos:
|
||||
|
||||
sample.yaml
|
||||
|
||||
.. literalinclude:: ../../../samples/testing/unit/sample.yaml
|
||||
:language: yaml
|
||||
:linenos:
|
||||
|
||||
main.c
|
||||
|
||||
.. literalinclude:: ../../../samples/testing/unit/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
|
||||
API reference
|
||||
*************
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
list(APPEND INCLUDE subsys)
|
||||
|
||||
include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake)
|
||||
project(none)
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <ztest.h>
|
||||
#include <net/buf.h>
|
||||
|
||||
struct net_buf_pool _net_buf_pool_list[1];
|
||||
|
||||
unsigned int irq_lock(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void irq_unlock(unsigned int key)
|
||||
{
|
||||
}
|
||||
|
||||
#include <net/buf.c>
|
||||
|
||||
void k_queue_init(struct k_queue *fifo) {}
|
||||
void k_queue_append_list(struct k_queue *fifo, void *head, void *tail) {}
|
||||
|
||||
int k_is_in_isr(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *k_queue_get(struct k_queue *fifo, s32_t timeout)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void k_queue_append(struct k_queue *fifo, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
void k_queue_prepend(struct k_queue *fifo, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
#define TEST_BUF_COUNT 1
|
||||
#define TEST_BUF_SIZE 74
|
||||
|
||||
NET_BUF_POOL_DEFINE(bufs_pool, TEST_BUF_COUNT, TEST_BUF_SIZE,
|
||||
sizeof(int), NULL);
|
||||
|
||||
static void test_get_single_buffer(void)
|
||||
{
|
||||
struct net_buf *buf;
|
||||
|
||||
buf = net_buf_alloc(&bufs_pool, K_NO_WAIT);
|
||||
|
||||
zassert_equal(buf->ref, 1, "Invalid refcount");
|
||||
zassert_equal(buf->len, 0, "Invalid length");
|
||||
zassert_equal(buf->flags, 0, "Invalid flags");
|
||||
zassert_equal_ptr(buf->frags, NULL, "Frags not NULL");
|
||||
}
|
||||
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(net_buf_test,
|
||||
ztest_unit_test(test_get_single_buffer)
|
||||
);
|
||||
|
||||
ztest_run_test_suite(net_buf_test);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
sample:
|
||||
description: TBD
|
||||
name: TBD
|
||||
tests:
|
||||
test:
|
||||
tags: buf
|
||||
type: unit
|
|
@ -1,5 +0,0 @@
|
|||
list(APPEND INCLUDE subsys)
|
||||
|
||||
include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake)
|
||||
project(none)
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <ztest.h>
|
||||
#include <net/buf.h>
|
||||
|
||||
struct net_buf_pool _net_buf_pool_list[1];
|
||||
|
||||
unsigned int irq_lock(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void irq_unlock(unsigned int key)
|
||||
{
|
||||
}
|
||||
|
||||
#include <net/buf.c>
|
||||
|
||||
void k_queue_init(struct k_queue *queue) {}
|
||||
void k_queue_append_list(struct k_queue *queue, void *head, void *tail) {}
|
||||
|
||||
int k_is_in_isr(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *k_queue_get(struct k_queue *queue, s32_t timeout)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void k_queue_append(struct k_queue *queue, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
void k_queue_prepend(struct k_queue *fifo, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
#define TEST_BUF_COUNT 1
|
||||
#define TEST_BUF_SIZE 74
|
||||
|
||||
NET_BUF_POOL_DEFINE(bufs_pool, TEST_BUF_COUNT, TEST_BUF_SIZE,
|
||||
sizeof(int), NULL);
|
||||
|
||||
static void test_get_single_buffer(void)
|
||||
{
|
||||
struct net_buf *buf;
|
||||
|
||||
buf = net_buf_alloc(&bufs_pool, K_NO_WAIT);
|
||||
|
||||
zassert_equal(buf->ref, 1, "Invalid refcount");
|
||||
zassert_equal(buf->len, 0, "Invalid length");
|
||||
zassert_equal(buf->flags, 0, "Invalid flags");
|
||||
zassert_equal_ptr(buf->frags, NULL, "Frags not NULL");
|
||||
}
|
||||
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(net_buf_test,
|
||||
ztest_unit_test(test_get_single_buffer)
|
||||
);
|
||||
|
||||
ztest_run_test_suite(net_buf_test);
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
tests:
|
||||
test:
|
||||
tags: buf
|
||||
timeout: 5
|
||||
type: unit
|
Loading…
Reference in a new issue