Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932080AbdCBGaa (ORCPT ); Thu, 2 Mar 2017 01:30:30 -0500 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:46232 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751132AbdCBGaU (ORCPT ); Thu, 2 Mar 2017 01:30:20 -0500 From: Shuah Khan To: shuah@kernel.org, bamvor.zhangjian@huawei.com, mpe@ellerman.id.au, mingo@kernel.org Cc: Shuah Khan , tglx@linutronix.de, hpa@zytor.com, luto@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests: lib.mk Fix individual test builds Date: Wed, 1 Mar 2017 15:46:23 -0700 Message-Id: <20170301224623.16973-1-shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 44 In commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT"), added support to generate compile targets in a user specified directory. OUTPUT variable controls the location which is undefined when tests are built in the test directory or with "make -C tools/testing/selftests/x86". make -C tools/testing/selftests/x86/ make: Entering directory '/lkml/linux_4.11/tools/testing/selftests/x86' Makefile:44: warning: overriding recipe for target 'clean' ../lib.mk:51: warning: ignoring old recipe for target 'clean' gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall single_step_syscall.c -lrt -ldl /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied collect2: error: ld returned 1 exit status Makefile:50: recipe for target '/single_step_syscall_64' failed make: *** [/single_step_syscall_64] Error 1 make: Leaving directory '/lkml/linux_4.11/tools/testing/selftests/x86' Same failure with "cd tools/testing/selftests/x86/;make" run. Fix this with a change to lib.mk to define OUTPUT to be the pwd when MAKELEVEL is 0. This covers both cases mentioned above. Reported-by: Ingo Molnar Signed-off-by: Shuah Khan --- tools/testing/selftests/lib.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index ce96d80..775c589 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -2,6 +2,10 @@ # Makefile can operate with or without the kbuild infrastructure. CC := $(CROSS_COMPILE)gcc +ifeq (0,$(MAKELEVEL)) +OUTPUT := $(shell pwd) +endif + TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) -- 2.7.4