mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: unit: add SWUTS for interface.list
This patch adds SWUTS for interface.list and moves the unit test files to the appropriate 'interface' folder. JIRA NVGPU-3510 Change-Id: I6d67d784fcf4d89ba4ee7cfe5f5d7a0e558d71a8 Signed-off-by: Nicolas Benech <nbenech@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2289225 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
8c01512e12
commit
da0fb30256
@@ -73,6 +73,7 @@ NV_REPOSITORY_COMPONENTS += userspace/units/interface/static_analysis
|
|||||||
NV_REPOSITORY_COMPONENTS += userspace/units/interface/string
|
NV_REPOSITORY_COMPONENTS += userspace/units/interface/string
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/interface/worker
|
NV_REPOSITORY_COMPONENTS += userspace/units/interface/worker
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/interface/kref
|
NV_REPOSITORY_COMPONENTS += userspace/units/interface/kref
|
||||||
|
NV_REPOSITORY_COMPONENTS += userspace/units/interface/list
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/bus
|
NV_REPOSITORY_COMPONENTS += userspace/units/bus
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/pramin
|
NV_REPOSITORY_COMPONENTS += userspace/units/pramin
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/priv_ring
|
NV_REPOSITORY_COMPONENTS += userspace/units/priv_ring
|
||||||
@@ -137,7 +138,6 @@ NV_REPOSITORY_COMPONENTS += userspace/units/fifo/tsg/gv11b
|
|||||||
NV_REPOSITORY_COMPONENTS += userspace/units/fifo/userd/gk20a
|
NV_REPOSITORY_COMPONENTS += userspace/units/fifo/userd/gk20a
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/fifo/usermode/gv11b
|
NV_REPOSITORY_COMPONENTS += userspace/units/fifo/usermode/gv11b
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/fuse
|
NV_REPOSITORY_COMPONENTS += userspace/units/fuse
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/list
|
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/ltc
|
NV_REPOSITORY_COMPONENTS += userspace/units/ltc
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/enabled
|
NV_REPOSITORY_COMPONENTS += userspace/units/enabled
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/falcon
|
NV_REPOSITORY_COMPONENTS += userspace/units/falcon
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ UNITS := \
|
|||||||
$(UNIT_SRC)/interface/string \
|
$(UNIT_SRC)/interface/string \
|
||||||
$(UNIT_SRC)/interface/worker \
|
$(UNIT_SRC)/interface/worker \
|
||||||
$(UNIT_SRC)/interface/kref \
|
$(UNIT_SRC)/interface/kref \
|
||||||
|
$(UNIT_SRC)/interface/list \
|
||||||
$(UNIT_SRC)/mc \
|
$(UNIT_SRC)/mc \
|
||||||
$(UNIT_SRC)/mm/nvgpu_sgt \
|
$(UNIT_SRC)/mm/nvgpu_sgt \
|
||||||
$(UNIT_SRC)/mm/allocators/buddy_allocator \
|
$(UNIT_SRC)/mm/allocators/buddy_allocator \
|
||||||
@@ -134,7 +135,6 @@ UNITS := \
|
|||||||
$(UNIT_SRC)/fifo/tsg/gv11b \
|
$(UNIT_SRC)/fifo/tsg/gv11b \
|
||||||
$(UNIT_SRC)/fifo/userd/gk20a \
|
$(UNIT_SRC)/fifo/userd/gk20a \
|
||||||
$(UNIT_SRC)/fifo/usermode/gv11b \
|
$(UNIT_SRC)/fifo/usermode/gv11b \
|
||||||
$(UNIT_SRC)/list \
|
|
||||||
$(UNIT_SRC)/ltc \
|
$(UNIT_SRC)/ltc \
|
||||||
$(UNIT_SRC)/enabled \
|
$(UNIT_SRC)/enabled \
|
||||||
$(UNIT_SRC)/falcon \
|
$(UNIT_SRC)/falcon \
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
* - @ref SWUTS-interface-string
|
* - @ref SWUTS-interface-string
|
||||||
* - @ref SWUTS-interface-worker
|
* - @ref SWUTS-interface-worker
|
||||||
* - @ref SWUTS-interface-kref
|
* - @ref SWUTS-interface-kref
|
||||||
|
* - @ref SWUTS-interface-list
|
||||||
* - @ref SWUTS-bus
|
* - @ref SWUTS-bus
|
||||||
* - @ref SWUTS-falcon
|
* - @ref SWUTS-falcon
|
||||||
* - @ref SWUTS-netlist
|
* - @ref SWUTS-netlist
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ INPUT += ../../../userspace/units/interface/static_analysis/static_analysis.h
|
|||||||
INPUT += ../../../userspace/units/interface/string/nvgpu-string.h
|
INPUT += ../../../userspace/units/interface/string/nvgpu-string.h
|
||||||
INPUT += ../../../userspace/units/interface/worker/worker.h
|
INPUT += ../../../userspace/units/interface/worker/worker.h
|
||||||
INPUT += ../../../userspace/units/interface/kref/kref.h
|
INPUT += ../../../userspace/units/interface/kref/kref.h
|
||||||
|
INPUT += ../../../userspace/units/interface/list/list.h
|
||||||
INPUT += ../../../userspace/units/bus/nvgpu-bus.h
|
INPUT += ../../../userspace/units/bus/nvgpu-bus.h
|
||||||
INPUT += ../../../userspace/units/falcon/falcon_tests/nvgpu-falcon.h
|
INPUT += ../../../userspace/units/falcon/falcon_tests/nvgpu-falcon.h
|
||||||
INPUT += ../../../userspace/units/netlist/nvgpu-netlist.h
|
INPUT += ../../../userspace/units/netlist/nvgpu-netlist.h
|
||||||
|
|||||||
@@ -1334,25 +1334,25 @@
|
|||||||
{
|
{
|
||||||
"test": "test_list_add",
|
"test": "test_list_add",
|
||||||
"case": "list_all_head",
|
"case": "list_all_head",
|
||||||
"unit": "list",
|
"unit": "interface_list",
|
||||||
"test_level": 0
|
"test_level": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"test": "test_list_add",
|
"test": "test_list_add",
|
||||||
"case": "list_all_tail",
|
"case": "list_all_tail",
|
||||||
"unit": "list",
|
"unit": "interface_list",
|
||||||
"test_level": 0
|
"test_level": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"test": "test_list_move",
|
"test": "test_list_move",
|
||||||
"case": "list_move",
|
"case": "list_move",
|
||||||
"unit": "list",
|
"unit": "interface_list",
|
||||||
"test_level": 0
|
"test_level": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"test": "test_list_replace",
|
"test": "test_list_replace",
|
||||||
"case": "list_replace",
|
"case": "list_replace",
|
||||||
"unit": "list",
|
"unit": "interface_list",
|
||||||
"test_level": 0
|
"test_level": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,4 +23,4 @@
|
|||||||
OBJS = list.o
|
OBJS = list.o
|
||||||
MODULE = list
|
MODULE = list
|
||||||
|
|
||||||
include ../Makefile.units
|
include ../../Makefile.units
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
NVGPU_UNIT_NAME=list
|
NVGPU_UNIT_NAME=list
|
||||||
|
|
||||||
include $(NV_COMPONENT_DIR)/../Makefile.units.common.interface.tmk
|
include $(NV_COMPONENT_DIR)/../../Makefile.units.common.interface.tmk
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# indent-tabs-mode: t
|
# indent-tabs-mode: t
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
NVGPU_UNIT_NAME=list
|
NVGPU_UNIT_NAME=list
|
||||||
|
|
||||||
include $(NV_COMPONENT_DIR)/../Makefile.units.common.tmk
|
include $(NV_COMPONENT_DIR)/../../Makefile.units.common.tmk
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# indent-tabs-mode: t
|
# indent-tabs-mode: t
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <unit/unit.h>
|
#include <unit/unit.h>
|
||||||
|
|
||||||
#include <nvgpu/list.h>
|
#include <nvgpu/list.h>
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
#define ELEMENTS 10
|
#define ELEMENTS 10
|
||||||
|
|
||||||
@@ -126,13 +127,8 @@ static int init_list_elements(struct unit_module *m,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Test case to verify that elements get added and stay in the right order.
|
int test_list_add(struct unit_module *m, struct gk20a *g, void *__args)
|
||||||
* __args is a boolean to indicate if adding to the head (false) or to the tail
|
|
||||||
* (true)
|
|
||||||
*/
|
|
||||||
static int test_list_add(struct unit_module *m, struct gk20a *g,
|
|
||||||
void *__args)
|
|
||||||
{
|
{
|
||||||
struct integer_list *pos;
|
struct integer_list *pos;
|
||||||
int i;
|
int i;
|
||||||
@@ -161,13 +157,7 @@ static int test_list_add(struct unit_module *m, struct gk20a *g,
|
|||||||
return UNIT_SUCCESS;
|
return UNIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
int test_list_move(struct unit_module *m, struct gk20a *g, void *__args)
|
||||||
* Test case to verify that elements get added and stay in the right order.
|
|
||||||
* __args is a boolean to indicate if adding to the head (false) or to the tail
|
|
||||||
* (true)
|
|
||||||
*/
|
|
||||||
static int test_list_move(struct unit_module *m, struct gk20a *g,
|
|
||||||
void *__args)
|
|
||||||
{
|
{
|
||||||
struct integer_list *pos;
|
struct integer_list *pos;
|
||||||
int i;
|
int i;
|
||||||
@@ -211,12 +201,7 @@ static int test_list_move(struct unit_module *m, struct gk20a *g,
|
|||||||
return UNIT_SUCCESS;
|
return UNIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
int test_list_replace(struct unit_module *m, struct gk20a *g, void *__args)
|
||||||
* Test case to test the replace operation by replacing the last node by a new
|
|
||||||
* one.
|
|
||||||
*/
|
|
||||||
static int test_list_replace(struct unit_module *m, struct gk20a *g,
|
|
||||||
void *__args)
|
|
||||||
{
|
{
|
||||||
struct integer_list *pos, *new_elem;
|
struct integer_list *pos, *new_elem;
|
||||||
struct nvgpu_list_node head;
|
struct nvgpu_list_node head;
|
||||||
@@ -256,4 +241,4 @@ struct unit_module_test list_tests[] = {
|
|||||||
UNIT_TEST(list_replace, test_list_replace, NULL, 0),
|
UNIT_TEST(list_replace, test_list_replace, NULL, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
UNIT_MODULE(list, list_tests, UNIT_PRIO_NVGPU_TEST);
|
UNIT_MODULE(interface_list, list_tests, UNIT_PRIO_NVGPU_TEST);
|
||||||
114
userspace/units/interface/list/list.h
Normal file
114
userspace/units/interface/list/list.h
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UNIT_LIST_H
|
||||||
|
#define UNIT_LIST_H
|
||||||
|
|
||||||
|
struct gk20a;
|
||||||
|
struct unit_module;
|
||||||
|
|
||||||
|
/** @addtogroup SWUTS-interface-list
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* Software Unit Test Specification for interface.list
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test specification for: test_list_add
|
||||||
|
*
|
||||||
|
* Description: Test case to verify that elements get added and stay in the
|
||||||
|
* right order.
|
||||||
|
*
|
||||||
|
* Test Type: Feature
|
||||||
|
*
|
||||||
|
* Targets: nvgpu_init_list_node, nvgpu_list_empty, nvgpu_list_add_tail,
|
||||||
|
* nvgpu_list_add, nvgpu_list_del
|
||||||
|
*
|
||||||
|
* Input: __args is a boolean to indicate if adding to the head (false) or to
|
||||||
|
* the tail (true)
|
||||||
|
*
|
||||||
|
* Steps:
|
||||||
|
* - Create a test list with a known number of elements of consecutive values.
|
||||||
|
* - For each element in the list, ensure it is consecutive with the previous
|
||||||
|
* one (ascending if adding to head, descending if adding to tail).
|
||||||
|
* - Delete all known elements from the list and ensure the resulting list
|
||||||
|
* is empty.
|
||||||
|
*
|
||||||
|
* Output: Returns PASS if the steps above were executed successfully. FAIL
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
int test_list_add(struct unit_module *m, struct gk20a *g, void *__args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test specification for: test_list_move
|
||||||
|
*
|
||||||
|
* Description: Test case to verify that elements get added and stay in the
|
||||||
|
* right order.
|
||||||
|
*
|
||||||
|
* Test Type: Feature
|
||||||
|
*
|
||||||
|
* Targets: nvgpu_init_list_node, nvgpu_list_empty, nvgpu_list_add_tail,
|
||||||
|
* nvgpu_list_add, nvgpu_list_move, nvgpu_list_del
|
||||||
|
*
|
||||||
|
* Input: None
|
||||||
|
*
|
||||||
|
* Steps:
|
||||||
|
* - Create a test list with a known number of elements of consecutive values.
|
||||||
|
* - Add an extra element to the tail so that the list is not ordered anymore.
|
||||||
|
* - Move the last element to the head.
|
||||||
|
* - Ensure the list is now ordered.
|
||||||
|
* - Delete all known elements from the list and ensure the resulting list
|
||||||
|
* is empty.
|
||||||
|
*
|
||||||
|
* Output: Returns PASS if the steps above were executed successfully. FAIL
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
int test_list_move(struct unit_module *m, struct gk20a *g, void *__args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test specification for: test_list_replace
|
||||||
|
*
|
||||||
|
* Description: Test case to test the replace operation by replacing the last
|
||||||
|
* node by a new one.
|
||||||
|
*
|
||||||
|
* Test Type: Feature
|
||||||
|
*
|
||||||
|
* Targets: nvgpu_init_list_node, nvgpu_list_empty, nvgpu_list_add_tail,
|
||||||
|
* nvgpu_list_add, nvgpu_list_replace_init, nvgpu_list_del
|
||||||
|
*
|
||||||
|
* Input: None
|
||||||
|
*
|
||||||
|
* Steps:
|
||||||
|
* - Create a test list with a known number of elements of consecutive values.
|
||||||
|
* - Create a new node.
|
||||||
|
* - Get the last element of the list and replace it by the new node.
|
||||||
|
* - Ensure the last element of the list is indeed the new node.
|
||||||
|
* - Delete all known elements from the list and ensure the resulting list
|
||||||
|
* is empty.
|
||||||
|
*
|
||||||
|
* Output: Returns PASS if the steps above were executed successfully. FAIL
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
int test_list_replace(struct unit_module *m, struct gk20a *g, void *__args);
|
||||||
|
|
||||||
|
/** }@ */
|
||||||
|
#endif /* UNIT_LIST_H */
|
||||||
Reference in New Issue
Block a user