From 920030011efe373d92c69dc56338dc25c381609f Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Thu, 17 Jan 2019 13:38:45 -0500 Subject: [PATCH] gpu: nvgpu: unit: add new script for unit testing Add new script nvgpu_submit_unit.sh for starting the unit test framework in GVS. The new script will live in the same path as nvgpu_submit and can be started without a relative path. This allows for cases where nvgpu_submit is started from a different path. Change-Id: Iebc8e86bff943d4741c2fcaa5ec11e9f2c00bee7 Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/1997984 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/Makefile.tmk | 5 +++++ userspace/nvgpu_submit_unit.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 userspace/nvgpu_submit_unit.sh diff --git a/userspace/Makefile.tmk b/userspace/Makefile.tmk index e8939d3cd..5cb259972 100644 --- a/userspace/Makefile.tmk +++ b/userspace/Makefile.tmk @@ -48,10 +48,12 @@ NV_COMPONENT_CFLAGS += -D__NVGPU_POSIX__ _NV_TOOLCHAIN_CFLAGS += -rdynamic NV_UNIT_SH=unit.sh +NV_SUBMIT_UNIT_SH=nvgpu_submit_unit.sh NV_TESTLIST_PY=testlist.py NV_REQ_TESTS_JSON=required_tests.json NV_COMPONENT_SYSTEMIMAGE_DIR := $(NV_SYSTEMIMAGE_TEST_EXECUTABLE_DIR)/nvgpu_unit systemimage:: $(NV_COMPONENT_SYSTEMIMAGE_DIR) $(NV_COMPONENT_SYSTEMIMAGE_DIR)/$(NV_UNIT_SH) \ + $(NV_SYSTEMIMAGE_TEST_EXECUTABLE_DIR)/$(NV_SUBMIT_UNIT_SH) \ $(NV_COMPONENT_SYSTEMIMAGE_DIR)/$(NV_TESTLIST_PY) \ $(NV_COMPONENT_SYSTEMIMAGE_DIR)/$(NV_REQ_TESTS_JSON) @@ -62,6 +64,9 @@ $(NV_COMPONENT_SYSTEMIMAGE_DIR) : $(NV_SYSTEMIMAGE_TEST_EXECUTABLE_DIR) #copy the test script $(NV_COMPONENT_SYSTEMIMAGE_DIR)/$(NV_UNIT_SH) : $(NV_COMPONENT_DIR)/$(NV_UNIT_SH) $(NV_COMPONENT_SYSTEMIMAGE_DIR) $(CP) $< $@ +#the submit script goes in the parent directory +$(NV_SYSTEMIMAGE_TEST_EXECUTABLE_DIR)/$(NV_SUBMIT_UNIT_SH) : $(NV_COMPONENT_DIR)/$(NV_SUBMIT_UNIT_SH) $(NV_COMPONENT_SYSTEMIMAGE_DIR) + $(CP) $< $@ $(NV_COMPONENT_SYSTEMIMAGE_DIR)/$(NV_TESTLIST_PY) : $(NV_COMPONENT_DIR)/$(NV_TESTLIST_PY) $(NV_COMPONENT_SYSTEMIMAGE_DIR) $(CP) $< $@ $(NV_COMPONENT_SYSTEMIMAGE_DIR)/$(NV_REQ_TESTS_JSON) : $(NV_COMPONENT_DIR)/$(NV_REQ_TESTS_JSON) $(NV_COMPONENT_SYSTEMIMAGE_DIR) diff --git a/userspace/nvgpu_submit_unit.sh b/userspace/nvgpu_submit_unit.sh new file mode 100755 index 000000000..5ffda27ca --- /dev/null +++ b/userspace/nvgpu_submit_unit.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# 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. + +# +# Execute the unit test. Args to this script are passed on to the unit test +# core. This just serves to set the LD_LIBRARY_PATH environment variable such +# that unit tests are found and nvgpu-drv is found. +# + +this_script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" +pushd $this_script_dir/nvgpu_unit +./unit.sh +rc=$? +popd +exit $rc