Received: by 2002:ab2:f03:0:b0:1ef:ffd0:ce49 with SMTP id i3csp51612lqf; Tue, 26 Mar 2024 14:05:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAfx+Uxc98jjzu5fx+Iu+i1KreRQaUuoZUQDm5uYadeBijNBTNLvP9hMjyOb5NHdSIVs9rwQ1/WCoRMdJIHT3g0Jv15MIjG9fi4ZjJaQ== X-Google-Smtp-Source: AGHT+IEsgi1ZbXCuYFUvJbbLhJpFy4INFu+EVvD3Jtmpy43D7gh3cKOW4L+LmjWItO3on8WeA14z X-Received: by 2002:a05:6512:3618:b0:513:a8fc:95d7 with SMTP id f24-20020a056512361800b00513a8fc95d7mr1840066lfs.38.1711487155885; Tue, 26 Mar 2024 14:05:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711487155; cv=pass; d=google.com; s=arc-20160816; b=Hoa7mK7uvigxI9FfZfxz9kz7cCJo6cPT2G0z5aaZqnvlGBU1GnADkpvgT9WOhXt7Er ku4RTLd34wkIzRxCPAx3FtYXbeZE+Q2nOmr2HtAguXh25koxkbPfVvVqymcG+19pNEbF Sbs6eJKaYStNv4GNc+ZBLHkrJ5Hu7W2b6M5JcXo1nAGkUm49I3JU15M2QhsDMtwBlpjf NkodnuEXHLAwCxFARtNfQV8Ddq5tbwqAeCDER7gStLd6UKzhUK7O6mOQtd1c1FfiNlPW 51lPejL+NWp8z+kEITvWLJLaLczeG6Vu2ip06H0NAZkOyZdJEurCz+8Y9CkKuG/ZQItq 66HA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=yGoOwtmMdt/+f2HpwpVRuxkbr+Dx6I+/q8ycSS5E9Jc=; fh=+eZft6L1MYRIeUMp3nOz7rtUIAunFEnTolWvxHzgPzY=; b=JiEYC2Hk2sEq2kFfXXgmujl3Zsok3RGLG2892WtMdb/oYswghMAZGzcrJBtuIoX/lz pgOV8CuakF+q55yZl/H2V6RxeB3e+hk+NjfHTIsBB4ra1KeCJ+VX8zxQQss+tQVSSZ7o 2yuXSPmCsKMQtOSqiCfle70MVCeK+AjyCjII4KX3CdhHgEWEIcgT1lNH6DgihhyI8Uyu ET0WfETCPWC+ucJSm228HBS0/JQyqiZilopOj/XAzuKaSWAEWTlZ3KdTNuIcUvzoHwit npDNYXALSDtvIxxBfdRSHz9wl5IS3BF375yFOhWX3ckBKhsiul+wQ+dc4Mz09B7hw5v7 qpsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=cLa+U+tW; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-119975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119975-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h6-20020a1709060f4600b00a43093c3e33si4046276ejj.995.2024.03.26.14.05.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 14:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=cLa+U+tW; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-119975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119975-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6EA581F821CB for ; Tue, 26 Mar 2024 21:05:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B6C913D523; Tue, 26 Mar 2024 21:05:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cLa+U+tW" Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (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 4D8F37353B for ; Tue, 26 Mar 2024 21:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711487151; cv=none; b=D/lIIM3C2aPIOS2MsSIadv6iyGJHKkbnz6UxDHGM5OHuS2+kulovDr1g3Cep+UXqY+ThkeK9T0BIfs7Z4qms+IXqZcP7E+V+jyaJuYbqCAo0B7mdu5FZKqnmQluTKSW1XB1xKmascBP2Q/0L/PuQJXmIe9Kc9HPR7ujXsxeOCyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711487151; c=relaxed/simple; bh=8/6VIqtn4FmmIolsIBNMglvOzS+Y8GYpiEzpcGwTcH4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=eYdIObcUGo89S9UMQNGQPJVHE9WzuCobG1TF0XVOIOJGove5TlnMVyx7Tm1PByUEjYaH4z/y3q3VrqE5mkh8cjXgrkYvYomnn9qQp/xOJiMdUwGtzIKOhNjewcbWw0GnO9QTi3h85da/XWSJ5tUbGXqEnONl7kUT+VfNnTmYyT0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cLa+U+tW; arc=none smtp.client-ip=209.85.166.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7cc5e664d52so66444139f.0 for ; Tue, 26 Mar 2024 14:05:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1711487148; x=1712091948; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=yGoOwtmMdt/+f2HpwpVRuxkbr+Dx6I+/q8ycSS5E9Jc=; b=cLa+U+tWOcwWg4UzddQg69ecqLCDZpW5OW9lSzYDqVNllMMERp9XLkQwv2TN7m2zKk v/hXed+0IgtrdlnIyqTeKbO4zidZOGjN/+xa9FUc1ns/ylWgjPJ1uLxEtWwmCOq4x60G tpi6rRefFG2bMDaUp/2KNNnUpzyZVYGDeksfw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711487148; x=1712091948; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yGoOwtmMdt/+f2HpwpVRuxkbr+Dx6I+/q8ycSS5E9Jc=; b=Wp4y//Gi9Cww8s3dt8Y570LLXIXnv6yR2cn0P0bwv91R5jHuyvE7Z9qPXidh5OYUKf OQoOUlOpPi9HcRKRsi34vPiSFFTXqXGkxAf6y5qSUlyV+gmgwYjD6CVTkCCPCEseShJm HZIzQD9cKf0II9IyQ/drCyajTGNXySTp0m2gwGMBTBJ0WVmHeLpiOqskV/tDRk2xZG/q lPtyeWaalqJAm538tmx6j0sb56fhjOBeYqYtzUmmJQYi+X/Z2j3QjrNG/b49ICH93yHi 1/DP7UMaaHiXaLnwi0vpEz2f+Cg8rS4evlwai/GON1K84fqZDs/2z2Yqxcmmtqo1Mhe5 kPfA== X-Forwarded-Encrypted: i=1; AJvYcCUYcYf/IK7Ucqi5WVMF6+DCPKB9WGkO16jrvnFIUoSkpcF8Hd8JJOTGAPeGaezTpKhAnatDULjNQeJHP3f9fvhZ/6E3d1INrYv1hb0k X-Gm-Message-State: AOJu0Yzoo62oHWNCtOgVUfKk2FHGCG5NY3DcNuIHlaKHr3SFXhcOapPw Dzfa/ifWYcUWcE4xqLB8y8sQFYpguBPAbVO9E4j0CaekZKktHOItRH3Y4HKIodw= X-Received: by 2002:a6b:5d16:0:b0:7d0:3f6b:6af9 with SMTP id r22-20020a6b5d16000000b007d03f6b6af9mr10144994iob.0.1711487148189; Tue, 26 Mar 2024 14:05:48 -0700 (PDT) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id y8-20020a029508000000b00476e3cabd48sm1081667jah.69.2024.03.26.14.05.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Mar 2024 14:05:47 -0700 (PDT) Message-ID: <387a04c3-356e-4248-9cd3-7aa1a617c221@linuxfoundation.org> Date: Tue, 26 Mar 2024 15:05:47 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 1/2] selftests/dmabuf-heap: conform test to TAP format output Content-Language: en-US To: Muhammad Usama Anjum , Shuah Khan , "T.J. Mercier" Cc: kernel@collabora.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <20240305060848.2478806-1-usama.anjum@collabora.com> From: Shuah Khan In-Reply-To: <20240305060848.2478806-1-usama.anjum@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/4/24 23:08, Muhammad Usama Anjum wrote: > Conform the layout, informational and status messages to TAP. No > functional change is intended other than the layout of output messages. > > Reviewed-by: T.J. Mercier > Signed-off-by: Muhammad Usama Anjum > --- > Changes since v4: > - close fds correctly with code changes added in v3 > > Chanages since v3: > - abort test-case instead of exiting if heap/mem allocation fails > - Correct test_alloc_zeroed() test case in case of failure > > Changes since v2: > - Minor improvements in test_alloc_zeroed() results > > Changes since v1: > - Update some more error handling code t would be nice to improve the error messages in addition to changing them over to TAP format. Please see below: > --- > .../selftests/dmabuf-heaps/dmabuf-heap.c | 246 +++++++----------- > 1 file changed, 101 insertions(+), 145 deletions(-) > > diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c > index 890a8236a8ba7..e7bd03e0af2ea 100644 > --- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c > +++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include "../kselftest.h" > > #define DEVPATH "/dev/dma_heap" > > @@ -90,14 +91,13 @@ static int dmabuf_heap_open(char *name) > char buf[256]; > > ret = snprintf(buf, 256, "%s/%s", DEVPATH, name); > - if (ret < 0) { > - printf("snprintf failed!\n"); > - return ret; > - } > + if (ret < 0) > + ksft_exit_fail_msg("snprintf failed!\n"); Why not include the return value in the message? > > fd = open(buf, O_RDWR); > if (fd < 0) > - printf("open %s failed!\n", buf); > + ksft_exit_fail_msg("open %s failed: %s\n", buf, strerror(errno)); > + > return fd; > } > > @@ -140,7 +140,7 @@ static int dmabuf_sync(int fd, int start_stop) > > #define ONE_MEG (1024 * 1024) > > -static int test_alloc_and_import(char *heap_name) > +static void test_alloc_and_import(char *heap_name) > { > int heap_fd = -1, dmabuf_fd = -1, importer_fd = -1; > uint32_t handle = 0; > @@ -148,27 +148,19 @@ static int test_alloc_and_import(char *heap_name) > int ret; > > heap_fd = dmabuf_heap_open(heap_name); > - if (heap_fd < 0) > - return -1; > > - printf(" Testing allocation and importing: "); > + ksft_print_msg("Testing allocation and importing:\n"); > ret = dmabuf_heap_alloc(heap_fd, ONE_MEG, 0, &dmabuf_fd); > if (ret) { > - printf("FAIL (Allocation Failed!)\n"); > - ret = -1; > - goto out; > + ksft_test_result_fail("FAIL (Allocation Failed!)\n"); Same here/ > + return; > } > + > /* mmap and write a simple pattern */ > - p = mmap(NULL, > - ONE_MEG, > - PROT_READ | PROT_WRITE, > - MAP_SHARED, > - dmabuf_fd, > - 0); > + p = mmap(NULL, ONE_MEG, PROT_READ | PROT_WRITE, MAP_SHARED, dmabuf_fd, 0); > if (p == MAP_FAILED) { > - printf("FAIL (mmap() failed)\n"); > - ret = -1; > - goto out; > + ksft_test_result_fail("FAIL (mmap() failed)\n"); Same here and the rest of the changes in this patch. thanks, -- Shuah