Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp114546lql; Fri, 12 Apr 2024 05:39:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVO02ndvj/Av/GPIQbYPTIshTHbLIB0O79i940qJ0MA8oAghHA4RDhJyb46aBxyrpbd2zvfRq5qUMl8qQ1gKuIO+Nxth/lArBfmV8fpYw== X-Google-Smtp-Source: AGHT+IEOUVPPcpJW8G5Oxp3/0ImvKGw8zB/8EdkYBG2DPnSV9RSC7h+hwTRTdfZ4mvZMmqORzYO8 X-Received: by 2002:a17:903:1d2:b0:1e5:9391:1d44 with SMTP id e18-20020a17090301d200b001e593911d44mr1981392plh.47.1712925578700; Fri, 12 Apr 2024 05:39:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712925578; cv=pass; d=google.com; s=arc-20160816; b=Sqlew6IE0EfGnnoAVSLr1D++BeAKuSlRdyvyhWISKU9oecOmqOUFKyx3WI4LMINNoN pzHIO2siylw60yUX7GD+m33i/ZNywl43k0LE01wPwVS6k1i14QOkIH1JXkFekIxXmYuz Ar3h534dX4NZvE14Y3k0JRVCPsmSK6We/RH6ndZG8rV/cVPSpNatI53/vE9w6vkg0r8I xes/1I9hKs5pZ27hbhwZIWgUaaUiUVRhFeACJBm5JZbPvnRePKp3JZi2uas74s9ArP38 tq5/Nj3cbCedhhyyGevUn9jx3CvJQC4tsP/HlBaP4ztRjMVuo9Rk4EnybUzGmsoJ8UDk bazw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=G73VCC5q7JEsOcm9nuCMvIK+kF0cB2PArLXaQyavNe0=; fh=GPwOwXDR5gomaXhADzJxhvqEghAiQmiLZGcuqWyHt2M=; b=XY2A13v5G2p16DxhLrDGH+UpUPDArphqPK7q4X2qiP6pAkbHL2nSM/dYcEedV+FRo6 ibN0GaOIYsBtRUeiBWYbriD2hbL+8Cq1WFEPmgVVhOFogQvJPCe8SpVwEVH88EwGK4ne k9/ZKwzh52hAZUvOX7Zvrb3ofbaAn5aotcYPIu66SDiIo5F94/VrvP1wp4LuWam6BRcF PCQClbXmXWKso9og8462bDIPZIGVzLfNWEjoBCOYMY6s1sIw2ZbzA3UDcxmb0ZqkqMnl Gjhy28IBI/E2NAhXpjRkexxcoxcQEd4s4StYiAZhziPnGpyJccEkp3cZBkZt/NBVlJd1 6qbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Do472uni; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-142662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j10-20020a170903024a00b001def0abd873si3365563plh.198.2024.04.12.05.39.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 05:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Do472uni; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-142662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 104ACB21670 for ; Fri, 12 Apr 2024 12:38:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E32B5A4D8; Fri, 12 Apr 2024 12:37:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Do472uni" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C694D205E2B for ; Fri, 12 Apr 2024 12:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712925437; cv=none; b=Zot1rW2auIJem9vsSkD1OBtyeQ7VociHDLDls7vavNji+YJY35fPojtiiZLbhRkCgeUbY08GBc8Wg/avwOc5GmOcQzrJssCx+wsFc5pvemK2HYxQ9JYkENaak+Hst5uuSwPpD0HinZcRObcNRv/apt9kT91+ZdE2Bh1lA/ZP5xY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712925437; c=relaxed/simple; bh=TOAT4TTAOWZXp1h7q54paBib/TPxqqPYt/m0hPrKDjM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=R7kWEQKFwjm9r5o56CoaPy9xM+zOxaiapAW1nUe+ZiHlEFEIIv/qsrsck5pA8jMbJVjWJ1Ic8jcUr+zjXMZMXAh5yIcAYPoW9IMwER8xsPHEAmKWcmZSpYWY9kH0uU0fme0nDVRZcVeoD/uMqQ2vUjJrJPng/mJZIdkChRtmKM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Do472uni; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712925434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G73VCC5q7JEsOcm9nuCMvIK+kF0cB2PArLXaQyavNe0=; b=Do472uniqkROiZYXJax8mdptbrz3rThguAzcst7eff90nr+5U15ZQufaeCdRvYzn4nKNG2 G3XFbC1MlCFe2qYrnYjSsWIkNMqWI/5Km6bUXNpLP1zILvOgomro7gVSUckIvlZO70dI5Z IQ6cicrmWltYGJqqezGCGpGjWzswe4M= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-HdPWaD0fNQeNnOeMpYxRCw-1; Fri, 12 Apr 2024 08:37:11 -0400 X-MC-Unique: HdPWaD0fNQeNnOeMpYxRCw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B505B802E4D; Fri, 12 Apr 2024 12:37:10 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.136]) by smtp.corp.redhat.com (Postfix) with SMTP id 73C72492BC7; Fri, 12 Apr 2024 12:37:07 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 12 Apr 2024 14:35:44 +0200 (CEST) Date: Fri, 12 Apr 2024 14:35:36 +0200 From: Oleg Nesterov To: Thomas Gleixner , Mark Brown Cc: John Stultz , Marco Elver , Peter Zijlstra , Ingo Molnar , "Eric W. Biederman" , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Dmitry Vyukov , kasan-dev@googlegroups.com, Edward Liaw , Carlos Llamas , Greg Kroah-Hartman Subject: [PATCH] selftests: fix build failure with NOLIBC Message-ID: <20240412123536.GA32444@redhat.com> References: <87sf02bgez.ffs@tglx> <87r0fmbe65.ffs@tglx> <87o7aqb6uw.ffs@tglx> <87frw2axv0.ffs@tglx> <20240404145408.GD7153@redhat.com> <87le5t9f14.ffs@tglx> <20240406150950.GA3060@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 As Mark explains ksft_min_kernel_version() can't be compiled with nolibc, it doesn't implement uname(). Fixes: 6d029c25b71f ("selftests/timers/posix_timers: Reimplement check_timer_distribution()") Reported-by: Mark Brown Closes: https://lore.kernel.org/all/f0523b3a-ea08-4615-b0fb-5b504a2d39df@sirena.org.uk/ Signed-off-by: Oleg Nesterov --- tools/testing/selftests/kselftest.h | 6 ++++++ tools/testing/selftests/timers/posix_timers.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 973b18e156b2..0d9ed3255f5e 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -392,6 +392,11 @@ static inline __printf(1, 2) int ksft_exit_skip(const char *msg, ...) static inline int ksft_min_kernel_version(unsigned int min_major, unsigned int min_minor) { +#ifdef NOLIBC + ksft_print_msg("NOLIBC: Can't check kernel version: " + "Function not implemented\n"); + return -1; +#else unsigned int major, minor; struct utsname info; @@ -399,6 +404,7 @@ static inline int ksft_min_kernel_version(unsigned int min_major, ksft_exit_fail_msg("Can't parse kernel version\n"); return major > min_major || (major == min_major && minor >= min_minor); +#endif } #endif /* __KSELFTEST_H */ diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index d86a0e00711e..878496d2a656 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -241,7 +241,7 @@ static int check_timer_distribution(void) if (!ctd_failed) ksft_test_result_pass("check signal distribution\n"); - else if (ksft_min_kernel_version(6, 3)) + else if (ksft_min_kernel_version(6, 3) > 0) ksft_test_result_fail("check signal distribution\n"); else ksft_test_result_skip("check signal distribution (old kernel)\n"); -- 2.25.1.362.g51ebf55