From patchwork Tue Aug 21 14:05:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 960363 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41vssY2zqSz9s4v for ; Wed, 22 Aug 2018 00:06:09 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 533A23E7703 for ; Tue, 21 Aug 2018 16:06:06 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) by picard.linux.it (Postfix) with ESMTP id B37AB3E6404 for ; Tue, 21 Aug 2018 16:05:59 +0200 (CEST) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 570321A00FF9 for ; Tue, 21 Aug 2018 16:05:59 +0200 (CEST) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BCE46AD04 for ; Tue, 21 Aug 2018 14:05:58 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Tue, 21 Aug 2018 16:05:47 +0200 Message-Id: <20180821140547.2509-3-pvorel@suse.cz> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180821140547.2509-1-pvorel@suse.cz> References: <20180821140547.2509-1-pvorel@suse.cz> X-Virus-Scanned: clamav-milter 0.99.2 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-3.smtp.seeweb.it Subject: [LTP] [RFC PATCH 2/2] make: Add test target X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Petr Vorel --- Makefile | 3 +++ lib/tests/Makefile | 3 +++ lib/tests/test.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100755 lib/tests/test.sh diff --git a/Makefile b/Makefile index b0368a472..f886ac350 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,9 @@ MAKE_TARGETS := $(addsuffix -all,$(filter-out lib,$(COMMON_TARGETS))) # overtaxed one, or one where -j => 1 was specified. all: $(addsuffix -all,$(COMMON_TARGETS)) Version +test: + cd lib/tests && make $@ + $(MAKE_TARGETS): lib-all .PHONY: include-all include-install diff --git a/lib/tests/Makefile b/lib/tests/Makefile index 73a0f1655..732fee2c4 100644 --- a/lib/tests/Makefile +++ b/lib/tests/Makefile @@ -7,4 +7,7 @@ LDLIBS += -lltp tst_cleanup_once: CFLAGS += -pthread +test: + ./test.sh $(MAKE_TARGETS) + include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/lib/tests/test.sh b/lib/tests/test.sh new file mode 100755 index 000000000..81d57a81b --- /dev/null +++ b/lib/tests/test.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2016-2018 Petr Vorel + +set -e + +for i in $@; do + echo "=== Testing '$i' ===" + case $i in + tst_checkpoint_wake_timeout|tst_record_childstatus) + if [ "$i" = "tst_record_childstatus" ]; then + echo "NOTE: expecting fail the test" + ./$i || [ $? -eq 1 ] + fi + ;; + tst_device) + if [ $(id -u) -ne 0 ]; then + echo "WARN: not root, skip the test" + else + ./$i + fi + ;; + *) + ./$i + ;; + esac + echo +done + +echo "END OF TESTING" + +# vim: set ft=sh ts=4 sts=4 sw=4 expandtab :