From patchwork Tue Aug 21 14:05:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 960362 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 41vssV1lBwz9s5b for ; Wed, 22 Aug 2018 00:06:05 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D73D33E7637 for ; Tue, 21 Aug 2018 16:06:02 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id 9D7933E63C7 for ; Tue, 21 Aug 2018 16:05:58 +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-6.smtp.seeweb.it (Postfix) with ESMTPS id D6CA914000BA for ; Tue, 21 Aug 2018 16:05:57 +0200 (CEST) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 85EFCAD04 for ; Tue, 21 Aug 2018 14:05:57 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Tue, 21 Aug 2018 16:05:46 +0200 Message-Id: <20180821140547.2509-2-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-6.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-6.smtp.seeweb.it Subject: [LTP] [RFC PATCH 1/2] tests: Remove tst_safe_macros.c 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" It's broken and outdated (doesn't really test safe macros features). Signed-off-by: Petr Vorel --- lib/tests/tst_safe_macros.c | 40 ------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 lib/tests/tst_safe_macros.c diff --git a/lib/tests/tst_safe_macros.c b/lib/tests/tst_safe_macros.c deleted file mode 100644 index b5809f40d..000000000 --- a/lib/tests/tst_safe_macros.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "test.h" -#include "safe_macros.h" - -char *TCID = "test_safe_macros"; -int TST_TOTAL = 1; - -int fd = -1; - -void cleanup(void) -{ - SAFE_CLOSE(NULL, fd); - SAFE_UNLINK(NULL, __FILE__ "~"); - tst_resm(TINFO, "got here"); -} - -int main(int argc LTP_ATTRIBUTE_UNUSED, char **argv) -{ - char buf[10]; - int fds[2]; - - buf[9] = '\0'; - - if (system("cp " __FILE__ " " __FILE__ "~")) { - fprintf(stderr, "error: could not cp file\n"); - return 1; - } - printf("%s\n", SAFE_BASENAME(NULL, *argv)); - printf("%s\n", SAFE_DIRNAME(NULL, *argv)); - fd = SAFE_OPEN(cleanup, __FILE__ "~", O_RDWR); - SAFE_READ(cleanup, 0, fd, buf, 9); - printf("buf: %s\n", buf); - SAFE_READ(cleanup, 1, fd, buf, 9); - printf("buf: %s\n", buf); - SAFE_WRITE(cleanup, 0, -1, buf, 9); - SAFE_WRITE(NULL, 0, fd, buf, 9); - SAFE_WRITE(NULL, 1, fd, buf, 9); - SAFE_PIPE(NULL, fds); - - return 0; -} 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 :