From patchwork Tue May 7 21:38:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 13657836 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A293314B94D for ; Tue, 7 May 2024 21:44:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715118299; cv=none; b=TK4mHaD4RN0ndmHrIleyGy0z8jVCPzp4C1KsrKKHvPN5o7zV1o9XCTqAidhmHL9+hd2ZwQmVfqkWiScEnUNrwK7mqMz+1+LQ/aLmyqCyLnPpml9WVImp9lSK2+SK8Apk2hi3hmQ+b4hlC37VByx3DoqZBSeVoKMCezDdO6LNCfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715118299; c=relaxed/simple; bh=uNS5SgTdf5Lqki4ZbkJSsqctuLHtwyYyPdiI8DfFaoc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qSGnym9TrfInM00w9bRHVfUhhEH+6Rac+2fX5owHvh1gCo1c+hr/zpf9VoVF0K2iRcLadZv/5wMi7HRvLSYEMYdMEik3bcgk6IAF6CmMyXJc9YhkLbPJR+HCPgUO/kFiapBTY/R1qtc6g4HRPxatw9gXRf4D+nZLnsIGwomaZxY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=b25Je7L2; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="b25Je7L2" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-620308b3684so63920507b3.3 for ; Tue, 07 May 2024 14:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715118296; x=1715723096; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FLG6gbZomB6DmPXjYL98l5fNcPQGk+fw1rCWyau0VTc=; b=b25Je7L2Quzfv3n/I6HkRWZWcA/958eViIpE7eBFiZOQIEdBVFejtYX6J7JOcIj8GQ W32hZpavJhwVOJcxeSFosJx/Ov0MC7KMyzdIV7Ahu3E1dPNZRHIfxOmzzxb2qX4yDXSf g6TzlrTztE7gJwArtUsIdKTACHu5VfSQQ0A6u+D+1SiRNKf08pufhYA0sXNA3/qXedNM TFtW2e+lLCtgIhQMT9C7oWxlGCFN8tpQdWpvapchtmLGdk4HJgZkIzZiWlmAapXiFahC MEP3eSgvRLnClvgynwYzfsSPzqg6hs7iP4WWY4O7v7a+RgETr2XXajQ9RUjo6NWc/nzY 72AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715118296; x=1715723096; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FLG6gbZomB6DmPXjYL98l5fNcPQGk+fw1rCWyau0VTc=; b=SDCgztVyhtTs9XdbnrQ73Lqt6245szhVJyVNhrdyblWJu60RdK4DwYPFI6+C4YxFHM 29cStyiJ7oMm1qedjh0yzOBEOF/fBZC+Qy2sSb0SPbEa1VUvz+F07JVIfbmWjNp5Rsxe g+DZvzFa3IfKcP1rUrzaTUkA24HEPj5TLMr6xLHza//4aniszv0YeP2CKHRXQ7ObmzWj jbHbrlQKu90Rk6mRJ0marb0DIYBxcrtWkIxZzuBdhAgNj3YHbQAattyNthg1StomtJ/B ZWX98pNoHV06k7axESgr4R+Myo+LqzMRqOCwNxYH0X4nb7p1pDyDY2jAcszHKnE6Gu02 Oj/g== X-Forwarded-Encrypted: i=1; AJvYcCXu079ubO5LB7z8i7tGTRSJ5+akxy/A+2NGqFgb/N6HrAxF+ZKzI/Q9HpCguqlvGZ3AkreXXVHM31iB9MCje1XSwL5e X-Gm-Message-State: AOJu0YycWroFLTYfQq5WgaM8bQGGv7bU9ZdOcKiKv7LX8nRi+fPIr7S4 qvPyTtIiaZriVOhidMgaQxE9nxMCL0XHk1rZTBrgMGN6+MKHhOq3euLvo4bCuAQuEEso0QShTyz m8A== X-Google-Smtp-Source: AGHT+IFDRufPRd20hhB8IsmwhuIIZ1gDaiY3aRkAgAGU63hP6Y69UhIvyGPjEABNQz9R7M3kyPQJ53ZX+tk= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a81:a189:0:b0:61d:4701:5e65 with SMTP id 00721157ae682-62085c5c5fbmr2405797b3.2.1715118295730; Tue, 07 May 2024 14:44:55 -0700 (PDT) Date: Tue, 7 May 2024 21:38:26 +0000 In-Reply-To: <20240507214254.2787305-1-edliaw@google.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240507214254.2787305-1-edliaw@google.com> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog Message-ID: <20240507214254.2787305-2-edliaw@google.com> Subject: [PATCH v2 1/5] selftests: Compile kselftest headers with -D_GNU_SOURCE From: Edward Liaw To: shuah@kernel.org, Mark Brown , Jaroslav Kysela , Takashi Iwai , Catalin Marinas , Will Deacon , Nhat Pham , Johannes Weiner , Christian Brauner , Eric Biederman , Kees Cook , OGAWA Hirofumi , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , " =?utf-8?q?Andr=C3=A9_Almeida?= " , Jiri Kosina , Benjamin Tissoires , Jason Gunthorpe , Kevin Tian , Andy Lutomirski , Will Drewry , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Paolo Bonzini , Sean Christopherson , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , " =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= " , Paul Moore , James Morris , "Serge E. Hallyn" , Andrew Morton , Seth Forshee , Bongsu Jeon , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Steffen Klassert , Herbert Xu , " =?utf-8?q?Andreas_F=C3=A4rber?= " , Manivannan Sadhasivam , Matthieu Baerts , Mat Martineau , Geliang Tang , Willem de Bruijn , Fenghua Yu , Reinette Chatre , Mathieu Desnoyers , "Paul E. McKenney" , Boqun Feng , Alexandre Belloni , Jarkko Sakkinen , Dave Hansen , Muhammad Usama Anjum , Edward Liaw Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-input@vger.kernel.org, iommu@lists.linux.dev, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, linux-actions@lists.infradead.org, mptcp@lists.linux.dev, linux-rtc@vger.kernel.org, linux-sgx@vger.kernel.org, bpf@vger.kernel.org, kernel test robot Add the -D_GNU_SOURCE flag to KHDR_INCLUDES so that it is defined in a central location. 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced asprintf into kselftest_harness.h, which is a GNU extension and needs _GNU_SOURCE to either be defined prior to including headers or with the -D_GNU_SOURCE flag passed to the compiler. Fixes: 809216233555 ("selftests/harness: remove use of LINE_MAX") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202404301040.3bea5782-oliver.sang@intel.com Signed-off-by: Edward Liaw Reviewed-by: Muhammad Usama Anjum Reviewed-by: Mark Brown Reviewed-by: John Hubbard --- tools/testing/selftests/Makefile | 4 ++-- tools/testing/selftests/kselftest_harness.h | 2 +- tools/testing/selftests/lib.mk | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index e1504833654d..ed012a7f0786 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -161,11 +161,11 @@ ifneq ($(KBUILD_OUTPUT),) # $(realpath ...) resolves symlinks abs_objtree := $(realpath $(abs_objtree)) BUILD := $(abs_objtree)/kselftest - KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include + KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_objtree}/usr/include else BUILD := $(CURDIR) abs_srctree := $(shell cd $(top_srcdir) && pwd) - KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include + KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_srctree}/usr/include DEFAULT_INSTALL_HDR_PATH := 1 endif diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index d98702b6955d..b2a1b6343896 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -51,7 +51,7 @@ #define __KSELFTEST_HARNESS_H #ifndef _GNU_SOURCE -#define _GNU_SOURCE +static_assert(0, "kselftest harness requires _GNU_SOURCE to be defined"); #endif #include #include diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index da2cade3bab0..2503dc732b4d 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -45,7 +45,7 @@ selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST)))) top_srcdir = $(selfdir)/../../.. ifeq ($(KHDR_INCLUDES),) -KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include +KHDR_INCLUDES := -D_GNU_SOURCE -isystem $(top_srcdir)/usr/include endif # The following are built by lib.mk common compile rules.