From patchwork Tue Jun 21 12:34:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 9190455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 906BF6075E for ; Tue, 21 Jun 2016 12:30:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8146E280F4 for ; Tue, 21 Jun 2016 12:30:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75EE428161; Tue, 21 Jun 2016 12:30:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 568B8280F4 for ; Tue, 21 Jun 2016 12:30:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14CA56E6C6; Tue, 21 Jun 2016 12:30:45 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id A528E6E6C7 for ; Tue, 21 Jun 2016 12:30:42 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 21 Jun 2016 05:30:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,503,1459839600"; d="scan'208";a="832398032" Received: from mcvlad-wk.rb.intel.com ([10.237.105.57]) by orsmga003.jf.intel.com with ESMTP; 21 Jun 2016 05:30:41 -0700 From: Marius Vlad To: intel-gfx@lists.freedesktop.org Date: Tue, 21 Jun 2016 15:34:07 +0300 Message-Id: <1466512447-26513-1-git-send-email-marius.c.vlad@intel.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1466504631-8304-1-git-send-email-marius.c.vlad@intel.com> References: <1466504631-8304-1-git-send-email-marius.c.vlad@intel.com> Subject: [Intel-gfx] [PATCH i-g-t v2] tests/drm_lib.sh: Extract fake getopt options so it can sourced into tests that require it. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This should allow tests/vgem_reload_basic to pass check target and it doesn't depend of i915 being present. v2: Do not source drm_lib.sh, only fake getopt parsing option to again access to --list-subtests option (Chris) Signed-off-by: Marius Vlad CC: Chris Wilson Reviewed-by: Chris Wilson --- tests/drm_getopt.sh | 38 ++++++++++++++++++++++++++++++++++++++ tests/drm_lib.sh | 35 ++--------------------------------- tests/vgem_reload_basic | 3 +++ 3 files changed, 43 insertions(+), 33 deletions(-) create mode 100644 tests/drm_getopt.sh diff --git a/tests/drm_getopt.sh b/tests/drm_getopt.sh new file mode 100644 index 0000000..a94a759 --- /dev/null +++ b/tests/drm_getopt.sh @@ -0,0 +1,38 @@ +# This is required for check/distcheck target as it has to --list-subtests +# for each test. Source it if you add a new test in form of a (shell) script. + +# See tests/vgem_reload_basic + +IGT_EXIT_TIMEOUT=78 +IGT_EXIT_SKIP=77 +IGT_EXIT_SUCCESS=0 +IGT_EXIT_INVALID=79 +IGT_EXIT_FAILURE=99 + +# hacked-up long option parsing +for arg in $@ ; do + case $arg in + --list-subtests) + exit $IGT_EXIT_INVALID + ;; + --run-subtest) + exit $IGT_EXIT_INVALID + ;; + --debug) + IGT_LOG_LEVEL=debug + ;; + --help-description) + echo $IGT_TEST_DESCRIPTION + exit $IGT_EXIT_SUCCESS + ;; + --help) + echo "Usage: `basename $0` [OPTIONS]" + echo " --list-subtests" + echo " --run-subtest " + echo " --debug" + echo " --help-description" + echo " --help" + exit $IGT_EXIT_SUCCESS + ;; + esac +done diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh index 2ba146b..c32bc68 100755 --- a/tests/drm_lib.sh +++ b/tests/drm_lib.sh @@ -1,38 +1,7 @@ #!/bin/sh -IGT_EXIT_TIMEOUT=78 -IGT_EXIT_SKIP=77 -IGT_EXIT_SUCCESS=0 -IGT_EXIT_INVALID=79 -IGT_EXIT_FAILURE=99 - -# hacked-up long option parsing -for arg in $@ ; do - case $arg in - --list-subtests) - exit $IGT_EXIT_INVALID - ;; - --run-subtest) - exit $IGT_EXIT_INVALID - ;; - --debug) - IGT_LOG_LEVEL=debug - ;; - --help-description) - echo $IGT_TEST_DESCRIPTION - exit $IGT_EXIT_SUCCESS - ;; - --help) - echo "Usage: `basename $0` [OPTIONS]" - echo " --list-subtests" - echo " --run-subtest " - echo " --debug" - echo " --help-description" - echo " --help" - exit $IGT_EXIT_SUCCESS - ;; - esac -done +SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" +. $SOURCE_DIR/drm_getopt.sh skip() { echo "$@" diff --git a/tests/vgem_reload_basic b/tests/vgem_reload_basic index b150b2c..a42da70 100755 --- a/tests/vgem_reload_basic +++ b/tests/vgem_reload_basic @@ -5,6 +5,9 @@ # ... we've broken this way too often :( # +SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" +. $SOURCE_DIR/drm_getopt.sh + function unload() { /sbin/rmmod vgem # drm may be used by other devices (nouveau, radeon, udl, etc)