From patchwork Tue Jan 27 11:17:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 5716471 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ABE319F2ED for ; Tue, 27 Jan 2015 11:17:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3A7420142 for ; Tue, 27 Jan 2015 11:17:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2F0732020E for ; Tue, 27 Jan 2015 11:17:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B2FDE6E524; Tue, 27 Jan 2015 03:17:10 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by gabe.freedesktop.org (Postfix) with ESMTP id A71226E523 for ; Tue, 27 Jan 2015 03:17:08 -0800 (PST) Received: by mail-wi0-f170.google.com with SMTP id em10so1624701wid.1 for ; Tue, 27 Jan 2015 03:17:08 -0800 (PST) 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; bh=V3MK2RDdXOa4L8rTL3jPskbwr21nKIOsH/YA0zrMY5g=; b=CkSchHHfQfANXm7RXyw7p8OtCcnKG0kBrlaZvFHOlGoVlsV9FTF1kmLjnjskqDlr5m Ok3v9rus5TP1UGLtadk3wnbd25kbPuY6zh3Phr59R0jL2GR7vLdTkxlAz/XOvSGlz+BE JJkJ1Rcj0AwVbMTvW7RnXwxdMSu5t2Mxazv1DuGYsaRDHIuY5Y3SVomqbm123kr0qNhD cOP1pxw+URxsxGirTJTqR3BUpZSO37YbtDkPaW/BJkPpIiaFgpWPDzU5OJ1piy1O3dZ0 AvX48X5XH7a++EY6sHg9Cj84JnY4XMe6AQsvXG+nmnrc3s/5knrzrAfWpMASe2Kl0o6x EzWA== X-Gm-Message-State: ALoCoQmpR7FjVUVGdgey6T2PJAUqgBRGuIOg7pSNd/V8lztCuOc52X1lrnm53pG+KDd+InLc9Yd1 X-Received: by 10.180.211.169 with SMTP id nd9mr6000835wic.4.1422357428032; Tue, 27 Jan 2015 03:17:08 -0800 (PST) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id x18sm1739020wia.12.2015.01.27.03.17.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Jan 2015 03:17:07 -0800 (PST) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Tue, 27 Jan 2015 11:17:02 +0000 Message-Id: <1422357422-4315-3-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422357422-4315-1-git-send-email-thomas.wood@intel.com> References: <1422357422-4315-1-git-send-email-thomas.wood@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 3/3] lib: validate subtest names 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 Subtest names should only contain '-', '_' and alphanumeric characters. Signed-off-by: Thomas Wood --- lib/igt_core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/igt_core.c b/lib/igt_core.c index bc588e2..d74f6f8 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -54,6 +54,7 @@ #include #include #include +#include #include "drmtest.h" #include "intel_chipset.h" @@ -693,10 +694,21 @@ void igt_simple_init_parse_opts(int argc, char **argv, */ bool __igt_run_subtest(const char *subtest_name) { + int i; + assert(!in_subtest); assert(!in_fixture); assert(test_with_subtests); + /* check the subtest name only contains a-z, A-Z, 0-9, '-' and '_' */ + for (i = 0; subtest_name[i] != '\0'; i++) + if (subtest_name[i] != '_' && subtest_name[i] != '-' + && !isalnum(subtest_name[i])) { + igt_critical("Invalid subtest name \"%s\".\n", + subtest_name); + igt_exit(); + } + if (list_subtests) { printf("%s\n", subtest_name); return false;