mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: compile out bsearch.c from safety build
- We are compiling “os/posix/bsearch.c” as part of safety-build, but we are not using bsearch.c file API from any safety file. JIRA NVGPU-6172 Change-Id: Id0ebf00287f7564e629c28190f90edd68288dd70 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2424541 (cherry picked from commit ce822b1c8766faf5642079f0d5dde347ac2c5087) Signed-off-by: srajum <srajum@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2447418 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
9b81c28dd3
commit
a03da4a077
@@ -1,6 +1,6 @@
|
|||||||
################################### tell Emacs this is a -*- makefile-gmake -*-
|
################################### tell Emacs this is a -*- makefile-gmake -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
# Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -64,7 +64,6 @@ NV_REPOSITORY_COMPONENTS += userspace/units/posix/queue
|
|||||||
NV_REPOSITORY_COMPONENTS += userspace/units/posix/utils
|
NV_REPOSITORY_COMPONENTS += userspace/units/posix/utils
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/posix/circ_buf
|
NV_REPOSITORY_COMPONENTS += userspace/units/posix/circ_buf
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/interface/bit-utils
|
NV_REPOSITORY_COMPONENTS += userspace/units/interface/bit-utils
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/interface/bsearch
|
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/interface/lock
|
NV_REPOSITORY_COMPONENTS += userspace/units/interface/lock
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/interface/nvgpu_gk20a
|
NV_REPOSITORY_COMPONENTS += userspace/units/interface/nvgpu_gk20a
|
||||||
NV_REPOSITORY_COMPONENTS += userspace/units/interface/atomic
|
NV_REPOSITORY_COMPONENTS += userspace/units/interface/atomic
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- mode: makefile -*-
|
# -*- mode: makefile -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
# Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -80,13 +80,16 @@ srcs += os/posix/bug.c \
|
|||||||
os/posix/cond.c \
|
os/posix/cond.c \
|
||||||
os/posix/lock.c \
|
os/posix/lock.c \
|
||||||
os/posix/thread.c \
|
os/posix/thread.c \
|
||||||
os/posix/bsearch.c \
|
|
||||||
os/posix/os_sched.c \
|
os/posix/os_sched.c \
|
||||||
os/posix/bitmap.c \
|
os/posix/bitmap.c \
|
||||||
os/posix/kmem.c \
|
os/posix/kmem.c \
|
||||||
os/posix/file_ops.c \
|
os/posix/file_ops.c \
|
||||||
os/posix/queue.c
|
os/posix/queue.c
|
||||||
|
|
||||||
|
ifeq ($(NV_BUILD_CONFIGURATION_IS_SAFETY),0)
|
||||||
|
srcs += os/posix/bsearch.c
|
||||||
|
endif
|
||||||
|
|
||||||
srcs += common/device.c \
|
srcs += common/device.c \
|
||||||
common/utils/enabled.c \
|
common/utils/enabled.c \
|
||||||
common/utils/rbtree.c \
|
common/utils/rbtree.c \
|
||||||
|
|||||||
@@ -271,7 +271,6 @@ nvgpu_big_free
|
|||||||
nvgpu_big_pages_possible
|
nvgpu_big_pages_possible
|
||||||
nvgpu_bitmap_clear
|
nvgpu_bitmap_clear
|
||||||
nvgpu_bitmap_set
|
nvgpu_bitmap_set
|
||||||
nvgpu_bsearch
|
|
||||||
nvgpu_bug_cb_longjmp
|
nvgpu_bug_cb_longjmp
|
||||||
nvgpu_bug_register_cb
|
nvgpu_bug_register_cb
|
||||||
nvgpu_bug_unregister_cb
|
nvgpu_bug_unregister_cb
|
||||||
|
|||||||
@@ -277,7 +277,6 @@ nvgpu_big_free
|
|||||||
nvgpu_big_pages_possible
|
nvgpu_big_pages_possible
|
||||||
nvgpu_bitmap_clear
|
nvgpu_bitmap_clear
|
||||||
nvgpu_bitmap_set
|
nvgpu_bitmap_set
|
||||||
nvgpu_bsearch
|
|
||||||
nvgpu_bug_cb_longjmp
|
nvgpu_bug_cb_longjmp
|
||||||
nvgpu_bug_register_cb
|
nvgpu_bug_register_cb
|
||||||
nvgpu_bug_unregister_cb
|
nvgpu_bug_unregister_cb
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- mode: makefile -*-
|
# -*- mode: makefile -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
|
# Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -65,7 +65,6 @@ UNITS := \
|
|||||||
$(UNIT_SRC)/priv_ring \
|
$(UNIT_SRC)/priv_ring \
|
||||||
$(UNIT_SRC)/init \
|
$(UNIT_SRC)/init \
|
||||||
$(UNIT_SRC)/interface/bit-utils \
|
$(UNIT_SRC)/interface/bit-utils \
|
||||||
$(UNIT_SRC)/interface/bsearch \
|
|
||||||
$(UNIT_SRC)/interface/lock \
|
$(UNIT_SRC)/interface/lock \
|
||||||
$(UNIT_SRC)/interface/nvgpu_gk20a \
|
$(UNIT_SRC)/interface/nvgpu_gk20a \
|
||||||
$(UNIT_SRC)/interface/atomic \
|
$(UNIT_SRC)/interface/atomic \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -32,7 +32,6 @@
|
|||||||
*
|
*
|
||||||
* - @ref SWUTS-enabled
|
* - @ref SWUTS-enabled
|
||||||
* - @ref SWUTS-interface-bit-utils
|
* - @ref SWUTS-interface-bit-utils
|
||||||
* - @ref SWUTS-interface-bsearch
|
|
||||||
* - @ref SWUTS-interface-lock
|
* - @ref SWUTS-interface-lock
|
||||||
* - @ref SWUTS-interface-nvgpu-gk20a
|
* - @ref SWUTS-interface-nvgpu-gk20a
|
||||||
* - @ref SWUTS-interface-rbtree
|
* - @ref SWUTS-interface-rbtree
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ INPUT += ../../../userspace/units/ce/nvgpu-ce.h
|
|||||||
INPUT += ../../../userspace/units/cg/nvgpu-cg.h
|
INPUT += ../../../userspace/units/cg/nvgpu-cg.h
|
||||||
INPUT += ../../../userspace/units/enabled/nvgpu-enabled.h
|
INPUT += ../../../userspace/units/enabled/nvgpu-enabled.h
|
||||||
INPUT += ../../../userspace/units/interface/bit-utils/bit-utils.h
|
INPUT += ../../../userspace/units/interface/bit-utils/bit-utils.h
|
||||||
INPUT += ../../../userspace/units/interface/bsearch/bsearch.h
|
|
||||||
INPUT += ../../../userspace/units/interface/lock/lock.h
|
INPUT += ../../../userspace/units/interface/lock/lock.h
|
||||||
INPUT += ../../../userspace/units/interface/nvgpu_gk20a/nvgpu_gk20a.h
|
INPUT += ../../../userspace/units/interface/nvgpu_gk20a/nvgpu_gk20a.h
|
||||||
INPUT += ../../../userspace/units/interface/rbtree/rbtree.h
|
INPUT += ../../../userspace/units/interface/rbtree/rbtree.h
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2020, NVIDIA CORPORATION. All Rights Reserved.
|
# Copyright (c) 2020-2021, NVIDIA CORPORATION. All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -288,9 +288,6 @@ test_poweron_branches.init_poweron_branches=2
|
|||||||
test_quiesce.init_quiesce=2
|
test_quiesce.init_quiesce=2
|
||||||
test_setup_env.init_setup_env=0
|
test_setup_env.init_setup_env=0
|
||||||
|
|
||||||
[interface_bsearch]
|
|
||||||
test_bsearch.test_bsearch=0
|
|
||||||
|
|
||||||
[interface_kref]
|
[interface_kref]
|
||||||
test_kref_get.kref_get=0
|
test_kref_get.kref_get=0
|
||||||
test_kref_get_unless.kref_get_unless=0
|
test_kref_get_unless.kref_get_unless=0
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
# Copyright (c) 2019, 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.
|
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
OBJS = bsearch.o
|
|
||||||
MODULE = bsearch
|
|
||||||
|
|
||||||
include ../../Makefile.units
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
################################### tell Emacs this is a -*- makefile-gmake -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019, 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.
|
|
||||||
#
|
|
||||||
# tmake for SW Mobile component makefile
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
NVGPU_UNIT_NAME=bsearch
|
|
||||||
|
|
||||||
include $(NV_COMPONENT_DIR)/../../Makefile.units.common.interface.tmk
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# indent-tabs-mode: t
|
|
||||||
# tab-width: 8
|
|
||||||
# End:
|
|
||||||
# vi: set tabstop=8 noexpandtab:
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
################################### tell Emacs this is a -*- makefile-gmake -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019, 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.
|
|
||||||
#
|
|
||||||
# tmake for SW Mobile component makefile
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
NVGPU_UNIT_NAME=bsearch
|
|
||||||
|
|
||||||
include $(NV_COMPONENT_DIR)/../../Makefile.units.common.tmk
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# indent-tabs-mode: t
|
|
||||||
# tab-width: 8
|
|
||||||
# End:
|
|
||||||
# vi: set tabstop=8 noexpandtab:
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unit/io.h>
|
|
||||||
#include <unit/unit.h>
|
|
||||||
|
|
||||||
#include <nvgpu/bsearch.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "bsearch.h"
|
|
||||||
|
|
||||||
u32 num_iterations = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Simple comparator function for ints.
|
|
||||||
* Returns 0 if values are equal, or the delta if not.
|
|
||||||
*/
|
|
||||||
static int int_compare(const void *a, const void *b)
|
|
||||||
{
|
|
||||||
num_iterations++;
|
|
||||||
return (*((const int *)a) - *((const int *)b));
|
|
||||||
}
|
|
||||||
|
|
||||||
int test_bsearch(struct unit_module *m, struct gk20a *g, void *args)
|
|
||||||
{
|
|
||||||
int sorted_table[TABLE_SIZE];
|
|
||||||
int i;
|
|
||||||
int key = SEARCH_FOR;
|
|
||||||
|
|
||||||
num_iterations = 0;
|
|
||||||
|
|
||||||
/* Create a sorted table by having consecutive, incrementing values */
|
|
||||||
for (i = 0; i < TABLE_SIZE; i++) {
|
|
||||||
sorted_table[i] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Run the binary search */
|
|
||||||
int *node_ptr = (int *) nvgpu_bsearch((void *)(&key),
|
|
||||||
(void *)&sorted_table, TABLE_SIZE, sizeof(int), int_compare);
|
|
||||||
|
|
||||||
if (node_ptr != NULL) {
|
|
||||||
if (*node_ptr == SEARCH_FOR) {
|
|
||||||
unit_info(m, "Found correct key after %d iterations\n",
|
|
||||||
num_iterations);
|
|
||||||
return UNIT_SUCCESS;
|
|
||||||
}
|
|
||||||
unit_return_fail(m, "Found incorrect value %d\n", *node_ptr);
|
|
||||||
}
|
|
||||||
unit_return_fail(m, "Key not found in array\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
struct unit_module_test interface_bsearch_tests[] = {
|
|
||||||
UNIT_TEST(test_bsearch, test_bsearch, NULL, 0),
|
|
||||||
};
|
|
||||||
|
|
||||||
UNIT_MODULE(interface_bsearch, interface_bsearch_tests, UNIT_PRIO_NVGPU_TEST);
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, 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_BSEARCH_H
|
|
||||||
#define UNIT_BSEARCH_H
|
|
||||||
|
|
||||||
struct gk20a;
|
|
||||||
struct unit_module;
|
|
||||||
|
|
||||||
/** @addtogroup SWUTS-interface-bsearch
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* Software Unit Test Specification for interface.bsearch
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The test will create a table of size TABLE_SIZE with ordered values from 0
|
|
||||||
* to TABLE_SIZE-1.
|
|
||||||
*/
|
|
||||||
#define TABLE_SIZE 1000
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The test will bsearch the SEARCH_FOR value inside the test table created
|
|
||||||
* with TABLE_SIZE. So obviously, the following condition must be met:
|
|
||||||
* 0 <= SEARCH_FOR < TABLE_SIZE-1
|
|
||||||
*/
|
|
||||||
#define SEARCH_FOR 727
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test specification for: test_bsearch
|
|
||||||
*
|
|
||||||
* Description: Simple test for bsearch. The goal here is code coverage, the
|
|
||||||
* underlying implementation of bsearch is provided by the stdlib.
|
|
||||||
*
|
|
||||||
* Test Type: Feature
|
|
||||||
*
|
|
||||||
* Input: None
|
|
||||||
*
|
|
||||||
* Steps:
|
|
||||||
* - Create a table of integers of size TABLE_SIZE.
|
|
||||||
* - Fill the table with incrementing values starting at 0, so that the table
|
|
||||||
* is sorted.
|
|
||||||
* - Run a binary search on the table by calling nvgpu_bsearch, looking for a
|
|
||||||
* known value (SEARCH_FOR) in the sorted table using integer comparisons.
|
|
||||||
* - Ensure that the correct value was found in the table.
|
|
||||||
*
|
|
||||||
* Output: Returns PASS if the steps above were executed successfully. FAIL
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
int test_bsearch(struct unit_module *m, struct gk20a *g, void *args);
|
|
||||||
|
|
||||||
/** }@ */
|
|
||||||
#endif /* UNIT_BSEARCH_H */
|
|
||||||
Reference in New Issue
Block a user