From patchwork Thu Dec 3 11:30:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 7759021 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5BC49BEEE1 for ; Thu, 3 Dec 2015 11:41:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4CD2B2054C for ; Thu, 3 Dec 2015 11:41:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1F3A4204D2 for ; Thu, 3 Dec 2015 11:41:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 85F2872193; Thu, 3 Dec 2015 03:41:47 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 42A5D72193 for ; Thu, 3 Dec 2015 03:41:46 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 03 Dec 2015 03:41:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,378,1444719600"; d="scan'208";a="699434889" Received: from otc-vmt1.isw.intel.com ([10.237.224.80]) by orsmga003.jf.intel.com with ESMTP; 03 Dec 2015 03:41:44 -0800 From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Thu, 3 Dec 2015 11:30:53 +0000 Message-Id: <1449142253-2178-1-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Subject: [Intel-gfx] [PATCH i-g-t] tests: add exit value constants for shell script tests 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Thomas Wood --- tests/check_drm_clients | 2 +- tests/debugfs_emon_crash | 2 +- tests/drm_lib.sh | 22 ++++++++++++++-------- tests/drv_debugfs_reader | 2 +- tests/drv_missed_irq_hang | 14 +++++++------- tests/drv_module_reload_basic | 8 ++++---- tests/kms_sysfs_edid_timing | 4 ++-- tests/sysfs_l3_parity | 6 +++--- tests/test_rte_check | 2 +- tests/tools_test | 2 +- 10 files changed, 35 insertions(+), 29 deletions(-) diff --git a/tests/check_drm_clients b/tests/check_drm_clients index eb12416..2a891b8 100755 --- a/tests/check_drm_clients +++ b/tests/check_drm_clients @@ -3,4 +3,4 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" . $SOURCE_DIR/drm_lib.sh -exit 0 +exit $IGT_EXIT_SUCCESS diff --git a/tests/debugfs_emon_crash b/tests/debugfs_emon_crash index 809bfab..1dbfcb2 100755 --- a/tests/debugfs_emon_crash +++ b/tests/debugfs_emon_crash @@ -13,4 +13,4 @@ done # If we got here, we haven't crashed -exit 0 +exit $IGT_EXIT_SUCCESS diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh index c50664c..d2c6420 100755 --- a/tests/drm_lib.sh +++ b/tests/drm_lib.sh @@ -1,20 +1,26 @@ #!/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 79 + exit $IGT_EXIT_INVALID ;; --run-subtest) - exit 79 + exit $IGT_EXIT_INVALID ;; --debug) IGT_LOG_LEVEL=debug ;; --help-description) echo $IGT_TEST_DESCRIPTION - exit 0 + exit $IGT_EXIT_SUCCESS ;; --help) echo "Usage: `basename $0` [OPTIONS]" @@ -23,18 +29,18 @@ for arg in $@ ; do echo " --debug" echo " --help-description" echo " --help" - exit 0 + exit $IGT_EXIT_SUCCESS ;; esac done die() { echo "$@" - exit 1 + exit $IGT_EXIT_FAILURE } do_or_die() { - $@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit -1) + $@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE) } if [ -d /debug/dri ] ; then @@ -63,7 +69,7 @@ if [ `cat $i915_dfs_path/clients | wc -l` -gt "2" ] ; then die "ERROR: other drm clients running" fi -whoami | grep -q root || ( echo ERROR: not running as root; exit 1 ) +whoami | grep -q root || ( echo ERROR: not running as root; exit $IGT_EXIT_FAILURE ) i915_sfs_path= if [ -d /sys/class/drm ] ; then @@ -76,7 +82,7 @@ fi function drmtest_skip_on_simulation() { - [ -n "$INTEL_SIMULATION" ] && exit 77 + [ -n "$INTEL_SIMULATION" ] && exit $IGT_EXIT_SKIP } drmtest_skip_on_simulation diff --git a/tests/drv_debugfs_reader b/tests/drv_debugfs_reader index 9e2845e..6ea4e64 100755 --- a/tests/drv_debugfs_reader +++ b/tests/drv_debugfs_reader @@ -6,4 +6,4 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" # read everything we can cat $i915_dfs_path/* > /dev/null 2>&1 -exit 0 +exit $IGT_EXIT_SUCCESS diff --git a/tests/drv_missed_irq_hang b/tests/drv_missed_irq_hang index 6e8cfc2..8083fe5 100755 --- a/tests/drv_missed_irq_hang +++ b/tests/drv_missed_irq_hang @@ -19,20 +19,20 @@ function blt_wait { function check_for_missed_irq { if test `cat i915_ring_missed_irq` = 0x00000000; then echo "missed interrupts undetected" - exit 1 + exit $IGT_EXIT_FAILURE fi } function check_for_hang { if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then echo "gpu hang reported" - exit 2 + exit $IGT_EXIT_FAILURE fi } if [ ! -f i915_ring_missed_irq ] ; then echo "kernel doesn't support interrupt masking" - exit 77 + exit $IGT_EXIT_SKIP fi # clear error state first @@ -43,7 +43,7 @@ echo 0xf > i915_ring_test_irq echo "Interrupts masked" if test `cat i915_ring_test_irq` != 0x0000000f; then echo "Failed to set interrupt mask" - exit 3 + exit $IGT_EXIT_FAILURE fi blt_wait @@ -57,7 +57,7 @@ echo 0 > i915_ring_test_irq echo "Interrupts unmasked" if test `cat i915_ring_test_irq` != 0x00000000; then echo "Failed to clear interrupt mask" - exit 3 + exit $IGT_EXIT_FAILURE fi blt_wait @@ -67,7 +67,7 @@ echo 0 > i915_ring_missed_irq echo "Cleared missed interrupts" if test `cat i915_ring_missed_irq` != 0x00000000; then echo "Failed to clear missed interrupts" - exit 3 + exit $IGT_EXIT_FAILURE fi -exit 0 +exit $IGT_EXIT_SUCCESS diff --git a/tests/drv_module_reload_basic b/tests/drv_module_reload_basic index ec1bae8..43c511b 100755 --- a/tests/drv_module_reload_basic +++ b/tests/drv_module_reload_basic @@ -33,7 +33,7 @@ rmmod drm &> /dev/null if lsmod | grep i915 &> /dev/null ; then echo WARNING: i915.ko still loaded! - exit 1 + exit $IGT_EXIT_FAILURE else echo module successfully unloaded fi @@ -48,13 +48,13 @@ if $SOURCE_DIR/gem_alive > /dev/null ; then echo "module successfully loaded again" else echo "failed to reload module successfully" - exit 2 + exit $IGT_EXIT_FAILURE fi # then try to run something if ! $SOURCE_DIR/gem_linear_blits --run-subtest basic > /dev/null ; then echo "failed to execute a simple batch after reload" - exit 3 + exit $IGT_EXIT_FAILURE fi -exit 0 +exit $IGT_EXIT_SUCCESS diff --git a/tests/kms_sysfs_edid_timing b/tests/kms_sysfs_edid_timing index ec704f6..46ea540 100755 --- a/tests/kms_sysfs_edid_timing +++ b/tests/kms_sysfs_edid_timing @@ -19,7 +19,7 @@ RES=$(((TIME2 - TIME1) / 1000000)) if [ $RES -gt 600 ]; then echo "Talking to outputs took ${RES}ms, something is wrong" - exit 1 + exit $IGT_EXIT_FAILURE fi -exit 0 +exit $IGT_EXIT_SUCCESS diff --git a/tests/sysfs_l3_parity b/tests/sysfs_l3_parity index 9bd1724..6f14b84 100755 --- a/tests/sysfs_l3_parity +++ b/tests/sysfs_l3_parity @@ -5,7 +5,7 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" if ! find /sys/class/drm/card*/ | grep l3_parity > /dev/null ; then echo "no l3_parity interface, skipping test" - exit 77 + exit $IGT_EXIT_SKIP fi $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e @@ -15,7 +15,7 @@ $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -d disabled=`$SOURCE_DIR/../tools/intel_l3_parity -l | grep -c 'Row 0, Bank 0, Subbank 0 is disabled'` if [ "$disabled" != "1" ] ; then echo "Fail" - exit 1 + exit $IGT_EXIT_FAILURE fi $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e @@ -23,5 +23,5 @@ $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e #Check that we can clear remaps if [ `$SOURCE_DIR/../tools/intel_l3_parity -l | wc -l` != 1 ] ; then echo "Fail 2" - exit 1 + exit $IGT_EXIT_FAILURE fi diff --git a/tests/test_rte_check b/tests/test_rte_check index eb12416..2a891b8 100755 --- a/tests/test_rte_check +++ b/tests/test_rte_check @@ -3,4 +3,4 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" . $SOURCE_DIR/drm_lib.sh -exit 0 +exit $IGT_EXIT_SUCCESS diff --git a/tests/tools_test b/tests/tools_test index a6178e1..0487827 100755 --- a/tests/tools_test +++ b/tests/tools_test @@ -12,5 +12,5 @@ do_or_die "intel_reg_dumper" # TODO: Add more tests -exit 0 +exit $IGT_EXIT_SUCCESS