From patchwork Fri Oct 21 11:01:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhangjian \(Bamvor\)" X-Patchwork-Id: 78633 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1234211qge; Fri, 21 Oct 2016 03:59:39 -0700 (PDT) X-Received: by 10.98.192.24 with SMTP id x24mr527698pff.118.1477047579547; Fri, 21 Oct 2016 03:59:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i17si2222396pgh.183.2016.10.21.03.59.39; Fri, 21 Oct 2016 03:59:39 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755022AbcJUK7f (ORCPT + 27 others); Fri, 21 Oct 2016 06:59:35 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:15134 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754737AbcJUK7d (ORCPT ); Fri, 21 Oct 2016 06:59:33 -0400 Received: from 172.24.1.36 (EHLO szxeml434-hub.china.huawei.com) ([172.24.1.36]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DTV07062; Fri, 21 Oct 2016 18:58:05 +0800 (CST) Received: from linux696.huawei.com (10.110.52.23) by szxeml434-hub.china.huawei.com (10.82.67.225) with Microsoft SMTP Server id 14.3.235.1; Fri, 21 Oct 2016 18:57:59 +0800 From: To: CC: , , , , Subject: [PATCH RFC 3/6] selftests: add default rules for c source file Date: Fri, 21 Oct 2016 19:01:31 +0800 Message-ID: <1477047694-24122-4-git-send-email-bamvor.zhangjian@huawei.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1477047694-24122-1-git-send-email-bamvor.zhangjian@huawei.com> References: <1477047694-24122-1-git-send-email-bamvor.zhangjian@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.110.52.23] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bamvor Jian Zhang There are difference rules for compiling c source file in different testcases. In order to enable KBUILD_OUTPUT support in later patch, this patch introduce the default rules in "tools/testing/selftest/lib.mk" and remove the existing rules in each testcase. Signed-off-by: Bamvor Jian Zhang --- tools/testing/selftests/exec/Makefile | 2 -- tools/testing/selftests/lib.mk | 3 +++ tools/testing/selftests/mount/Makefile | 3 --- tools/testing/selftests/net/Makefile | 2 -- tools/testing/selftests/size/Makefile | 4 +--- tools/testing/selftests/vm/Makefile | 3 +-- 6 files changed, 5 insertions(+), 12 deletions(-) -- 1.8.4.5 Acked-by: Michael Ellerman diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile index b3bf091..9eb1c3e 100644 --- a/tools/testing/selftests/exec/Makefile +++ b/tools/testing/selftests/exec/Makefile @@ -11,8 +11,6 @@ execveat.symlink: execveat execveat.denatured: execveat cp $< $@ chmod -x $@ -%: %.c - $(CC) $(CFLAGS) -o $@ $^ TEST_GEN_PROGS := execveat TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 8c0440d..9ccec4b 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -45,4 +45,7 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) clean: $(RM) -fr $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) +%: %.c + $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $^ + .PHONY: run_tests all clean install emit_tests diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile index e8fb15e..9093d7f 100644 --- a/tools/testing/selftests/mount/Makefile +++ b/tools/testing/selftests/mount/Makefile @@ -2,9 +2,6 @@ CFLAGS = -Wall \ -O2 -unprivileged-remount-test: unprivileged-remount-test.c - $(CC) $(CFLAGS) unprivileged-remount-test.c -o unprivileged-remount-test - TEST_GEN_PROGS := unprivileged-remount-test include ../lib.mk diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index c976425..d13620a 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -4,8 +4,6 @@ CFLAGS = -Wall -O2 -g CFLAGS += -I../../../../usr/include/ -%: %.c - $(CC) $(CFLAGS) -o $@ $^ TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh TEST_GEN_FILES := socket psock_fanout psock_tpacket reuseport_bpf reuseport_bpf_cpu reuseport_dualstack diff --git a/tools/testing/selftests/size/Makefile b/tools/testing/selftests/size/Makefile index c67f357..4685b3e 100644 --- a/tools/testing/selftests/size/Makefile +++ b/tools/testing/selftests/size/Makefile @@ -1,6 +1,4 @@ - -get_size: get_size.c - $(CC) -static -ffreestanding -nostartfiles -s $< -o $@ +CFLAGS := -static -ffreestanding -nostartfiles -s TEST_GEN_PROGS := get_size diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index 323383a..eb0aaff 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile @@ -1,6 +1,7 @@ # Makefile for vm selftests CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) +LDLIBS = -lrt TEST_GEN_FILES = compaction_test TEST_GEN_FILES += hugepage-mmap TEST_GEN_FILES += hugepage-shm @@ -12,8 +13,6 @@ TEST_GEN_FILES += transhuge-stress TEST_GEN_FILES += userfaultfd TEST_GEN_FILES += mlock-random-test -%: %.c - $(CC) $(CFLAGS) -o $@ $^ -lrt userfaultfd: userfaultfd.c ../../../../usr/include/linux/kernel.h $(CC) $(CFLAGS) -O2 -o $@ $< -lpthread