From patchwork Thu Oct 16 16:49:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 5092681 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 89B87C11AC for ; Thu, 16 Oct 2014 16:50:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADBE3201ED for ; Thu, 16 Oct 2014 16:50:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C113B201D3 for ; Thu, 16 Oct 2014 16:50:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4105B6E2BF; Thu, 16 Oct 2014 09:50:08 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by gabe.freedesktop.org (Postfix) with ESMTP id 22EC76E2C4 for ; Thu, 16 Oct 2014 09:50:06 -0700 (PDT) Received: by mail-wi0-f173.google.com with SMTP id fb4so2063664wid.6 for ; Thu, 16 Oct 2014 09:50:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=ILRASJzxQp4pShkIzf4p55+HateNEwD9oaZyocITAlk=; b=Xo0yIADQosf7lcw4li+nJ8vDB/JwJvTVaDbMf3sRjtZ/duB0P53n2iK1DNpApmbGIC bbpYpybJjQioOvtVBCyc+Hwcsj3Jd+cxUtj+Iij4yatcUakmk8wTsrb9PIO7KycyqDqR CvH9fyJRYd/OULBt6M0fvYZrKxdyvNbKt3SmCeQZPubOBa7vgNFNziChpujUIb+KFxA6 bL5thl+alChh4sFrUiXu2JwOAsBVZUECi0CxeKZrfVtI75IBpvsZalMygpandYJOuo8u XflFibAchg41tWzy1zjaZEoyoCvu6EwA86O/OhB0wv0cKY+l8pOu0LqnJBHjCxnyD13N Z2nQ== X-Gm-Message-State: ALoCoQkb16iq23I4+GEzIcto8dSYzQKnriyDnQn9sr4X3hDdjXL+YDCPtbbjpr3FapFo1Pk6WMWQ X-Received: by 10.194.62.238 with SMTP id b14mr3592456wjs.46.1413478206240; Thu, 16 Oct 2014 09:50:06 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id ic4sm2595840wid.19.2014.10.16.09.50.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Oct 2014 09:50:05 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Thu, 16 Oct 2014 17:49:53 +0100 Message-Id: <1413478193-7970-8-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1413478193-7970-1-git-send-email-thomas.wood@intel.com> References: <1413478193-7970-1-git-send-email-thomas.wood@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 7/7] tests: add a check for command line handling X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Check that command line handling works consistently across all tests. Signed-off-by: Thomas Wood --- tests/Makefile.sources | 6 +++++ tests/igt_command_line.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100755 tests/igt_command_line.sh diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 89596e6..88bb854 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -202,8 +202,13 @@ TESTS_testsuite = \ igt_simulation \ $(NULL) +TESTS_testsuite_scripts = \ + igt_command_line.sh \ + $(NULL) + TESTS = \ $(TESTS_testsuite) \ + $(TESTS_testsuite_scripts) \ $(NULL) # Test that exercise specific asserts in the test framework library and are @@ -229,6 +234,7 @@ scripts = \ ddx_intel_after_fbdev \ debugfs_wedged \ drm_lib.sh \ + igt_command_line.sh \ $(NULL) IMAGES = pass.png 1080p-left.png 1080p-right.png diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh new file mode 100755 index 0000000..075f1d5 --- /dev/null +++ b/tests/igt_command_line.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Copyright © 2014 Intel Corporation +# +# 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 (including the next +# paragraph) 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. + +# +# Check that command line handling works consistently across all tests +# + +for test in `cat single-tests.txt multi-tests.txt`; do + + if [ "$test" = "TESTLIST" -o "$test" = "END" ]; then + continue + fi + + # if the test is a script, it will be in $srcdir + if [ ! -x $test ]; then + if [ -x $srcdir/$test ]; then + test=$srcdir/$test + fi + fi + + echo "$test:" + + # check invalid option handling + echo " Checking invalid option handling..." + ./$test --invalid-option 2> /dev/null && exit 99 + + # check valid options succeed + echo " Checking valid option handling..." + ./$test --help > /dev/null || exit 99 + + # check --list-subtests works correctly + echo " Checking subtest enumeration..." + ./$test --list-subtests > /dev/null + if [ $? -ne 0 -a $? -ne 79 ]; then + exit 99 + fi + + # check invalid subtest handling + echo " Checking invalid subtest handling..." + ./$test --run-subtest invalid-subtest > /dev/null 2>&1 && exit 99 +done