Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1833562imu; Wed, 12 Dec 2018 05:14:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/U4rGoQZTeaEnsBXmzyY4PseEgwlv+WO4pDtnhZKfWCkS8rmiLvTi3jXiQR850PsAdZkL0k X-Received: by 2002:a17:902:f091:: with SMTP id go17mr20301569plb.235.1544620482166; Wed, 12 Dec 2018 05:14:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544620482; cv=none; d=google.com; s=arc-20160816; b=y/9jbohY+SSpunDl2TMx6V/0Esro5GNNq5nnbqttMTAAfGqrjU12hKifEH0vw2Yasr qz/uqTv5XQWI5/yeYviZ2stA8q+xuRQYCr9IDCjPLbqgkKuPG6AdFaHLAmVFbH0lvwIm Q8dt2pKtUwcq5ePVWguFvx/cPcyHru0yeBDO71EOOaL/g523tU+r2ahfl2sMBPlyB+iu PLSx2PMgQX5/OiUzdFtIKeS90SU2sIy8N2Se2KTxLxEtA1PsvKjFBEegQWc+6EumF2w/ ld3ko943vz7Im2Tm3DkUrPE3egyAHzLjcpTxz3X74V97H9dqafIFIifWBGOwhzxt4yT/ 02kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qpZYTD9IxZqXqawa9zYWCHH0n0VHFjdJyXrqWGPFs0A=; b=Nkw9iA5QrYTgjxGHPsnObdrqBl7Qdp3nLKRsBwxFREmJnzwEzm9sKF4KmaOMutHB9x 7kFtQOeIUhj8LFhMS7nxY111paCKu41X80+9P6u6t0Dj9Pc2q53VYwDexjQBKU8O5cue fujzHOm7ncyvaB82HxHuj2JajzPDMCtUNzE1KvxAL4xZn6o/aRNMbnTo3SFCI3V/igoM 5ouOS+NTQOniv1lEUR8lLgHMPfL/rzqaUmzqquMLmNRJNKgps4KmiYLCVQzVnvdCWyxq Efl23rk6wH+KbU334L5kn+Hf8n1qM56pTUbZPT2dvrwTaIzo9LjqJN/OsBsgzb3bRvt0 2kLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RuLhWzL2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u195si13771255pgb.550.2018.12.12.05.14.27; Wed, 12 Dec 2018 05:14:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RuLhWzL2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727536AbeLLNMR (ORCPT + 99 others); Wed, 12 Dec 2018 08:12:17 -0500 Received: from mail-ed1-f51.google.com ([209.85.208.51]:43715 "EHLO mail-ed1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727290AbeLLNMP (ORCPT ); Wed, 12 Dec 2018 08:12:15 -0500 Received: by mail-ed1-f51.google.com with SMTP id f9so15493511eds.10 for ; Wed, 12 Dec 2018 05:12:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qpZYTD9IxZqXqawa9zYWCHH0n0VHFjdJyXrqWGPFs0A=; b=RuLhWzL2a2H9DbggwMJhHNVSY9/GFtMgrQ4BTk4nYUP9lPe28jtbHn97uRDMytCiS5 3WPf0mp4Tw4hsH7W5nZEyVF2X2PE/EvA1JetAlDzTMgGC7lxmm+3XZ/bkyAXUdxhrlpr InLJ07psc1lsqwZxlMdYwepMnrmkfSuRq9Fu7gNRpgHFdCK1sV1JNPcl2k5RPifc+eyg MAi5zQj7EJRpZmepn2+Bn85QOuLfsOH/X8Ww8q6SWTTFz2ltkjhRhb+ACpwC9njGrvX2 keTpf0x2p5ANMYCLRaUg8aUwoF6UxAR2mcZ1YL7vuXa9GfbFLRCFSOq2DS/lynQ+O5dM barg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qpZYTD9IxZqXqawa9zYWCHH0n0VHFjdJyXrqWGPFs0A=; b=Y5OV9Gxqixm+W+dY7GhhgkjRXZkluf2z91bMxalDvE97vYchf8Z0fGKa75lxEYiS2T yD9urXfR7yDB15N7Tdo+2VfY3fxKMLSveXEPrs/vjoZfqpIdjbb4GKxGAC396O6xiUNY RZ4MbJ0MMAE7q6+7641uRkiyQ9lE8sVc/jYo4j1OwnrIvh21145/PkBRukksQd4twlmb ZeNDnhPb9/c+SsRG8MPZG9/ZSwlx98wYtjdlDBOioeQq383/GZPEnUGFTwsmA4jc1Qlk ZQloPc9QhXpUNYXK6ErzYIq8lo92kUoYWhGu5oC510AQ5nq4z9EYVOgRiBABOJcLQ+A2 As5Q== X-Gm-Message-State: AA+aEWZ+SwpxJ2Q48gHUN1YXwtBfzJ52zrSj7o4BD1o1GII7wcczEle9 BPrkzsbkhVUO7+ljfiRengM= X-Received: by 2002:a50:8bc9:: with SMTP id n9mr19058607edn.41.1544620333511; Wed, 12 Dec 2018 05:12:13 -0800 (PST) Received: from localhost (pD9E51040.dip0.t-ipconnect.de. [217.229.16.64]) by smtp.gmail.com with ESMTPSA id x10sm4890980edb.58.2018.12.12.05.12.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Dec 2018 05:12:13 -0800 (PST) From: Thierry Reding To: Andrew Morton , Thomas Gleixner Cc: Jonathan Corbet , Joe Perches , Jeremy Cline , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] scripts: Add spdxcheck.py self test Date: Wed, 12 Dec 2018 14:12:10 +0100 Message-Id: <20181212131210.28024-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181212131210.28024-1-thierry.reding@gmail.com> References: <20181212131210.28024-1-thierry.reding@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thierry Reding Add a script that will run spdxcheck.py through a couple of self tests to simplify validation in the future. The tests are run for both Python 2 and Python 3 to make sure all changes to the script remain compatible across both versions. The script tests a regular text file (Makefile) for basic sanity checks and then runs it on a binary file (Documentation/logo.gif) to make sure it works in both cases. It also tests opening files passed on the command line as well as piped files read from standard input. Finally a run on the complete tree will be performed to catch any other potential issues. Signed-off-by: Thierry Reding --- scripts/spdxcheck-test.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 scripts/spdxcheck-test.sh diff --git a/scripts/spdxcheck-test.sh b/scripts/spdxcheck-test.sh new file mode 100755 index 000000000000..cfea6a0d1cc0 --- /dev/null +++ b/scripts/spdxcheck-test.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +for PYTHON in python2 python3; do + # run check on a text and a binary file + for FILE in Makefile Documentation/logo.gif; do + $PYTHON scripts/spdxcheck.py $FILE + $PYTHON scripts/spdxcheck.py - < $FILE + done + + # run check on complete tree to catch any other issues + $PYTHON scripts/spdxcheck.py > /dev/null +done -- 2.19.1