diff --git a/userspace/SWUTS.h b/userspace/SWUTS.h index 85c86970d..0c8477120 100644 --- a/userspace/SWUTS.h +++ b/userspace/SWUTS.h @@ -30,6 +30,7 @@ * The following pages cover the various unit test specifications needed * to test the NVGPU driver. * + * - @ref SWUTS-enabled * - @ref SWUTS-mm-vm * */ diff --git a/userspace/SWUTS.sources b/userspace/SWUTS.sources index 2b66abf1b..a49d3930b 100644 --- a/userspace/SWUTS.sources +++ b/userspace/SWUTS.sources @@ -1,3 +1,4 @@ INPUT += ../../../userspace/SWUTS.h +INPUT += ../../../userspace/units/enabled/nvgpu-enabled.h INPUT += ../../../userspace/units/mm/vm/vm.h diff --git a/userspace/units/enabled/nvgpu-enabled.h b/userspace/units/enabled/nvgpu-enabled.h new file mode 100644 index 000000000..c4b6d5704 --- /dev/null +++ b/userspace/units/enabled/nvgpu-enabled.h @@ -0,0 +1,113 @@ +/* + * 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. + */ + +struct gk20a; +struct unit_module; + +/** @addtogroup SWUTS-enabled + * @{ + * + * Software Unit Test Specification for enabled + */ + +/** + * Test specification for: test_nvgpu_init_enabled_flags + * + * Description: Initialize GPU enabled_flags + * + * Test Type: Feature based + * + * Input: None + * + * Steps: + * - GPU structure contains enabled_flags initialized at boot + * - Store already created enabled_flags pointer in a global variable + * - Initialize enabled_flags for this unit test + * - New created enabled_flags are set to false + * - Check if return value indicates success + * + * Output: Returns SUCCESS if the steps above were executed successfully. FAIL + * otherwise. + */ +int test_nvgpu_init_enabled_flags(struct unit_module *m, struct gk20a *g, + void *args); + +/** + * Test specification for: test_nvgpu_enabled_flags_false_check + * + * Description: Check if enabled_flags are set to false. + * + * Test Type: Feature based + * + * Input: test_nvgpu_init_enabled_flags + * + * Steps: + * - Check flag value + * - Iterate over each flag + * - Check if flag value is false + * + * Output: Returns SUCCESS if the steps above were executed successfully. FAIL + * otherwise. + */ +int test_nvgpu_enabled_flags_false_check(struct unit_module *m, + struct gk20a *g, void *args); + +/** + * Test specification for: test_nvgpu_set_enabled + * + * Description: Set and reset enabled_flags + * + * Test Type: Feature based + * + * Input: test_nvgpu_init_enabled_flags + * + * Steps: + * - Set and reset each flag + * - Iterate over a flag 'i' and set it to true + * - Check if flag 'i' value is true + * - Reset value of flag 'i' to false + * - Check if flag 'i' value is false + * + * Output: Returns SUCCESS if the steps above were executed successfully. FAIL + * otherwise. + */ +int test_nvgpu_set_enabled(struct unit_module *m, struct gk20a *g, void *args); + +/** + * Test specification for: test_nvgpu_free_enabled_flags + * + * Description: Free enabled_flags + * + * Test Type: Other (cleanup) + * + * Input: test_nvgpu_init_enabled_flags + * + * Steps: + * - Free enabled_flag memory + * - Free enabled_flags allocated for this unit test + * - Restore originally created enabled_flags pointer + * + * Output: Returns SUCCESS if the steps above were executed successfully. FAIL + * otherwise. + */ +int test_nvgpu_free_enabled_flags(struct unit_module *m, + struct gk20a *g, void *args);