Received: by 2002:ab2:23c8:0:b0:1f2:fdbc:cb93 with SMTP id a8csp233517lqe; Wed, 27 Mar 2024 04:25:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBlDN8qZS2LWraHLDWStj3y3pByzbuMmRsaUpGJ3qpu2K3DgQ+4X5sw0fHuT6fL6YoXFW5uD/YDWwlCIIw3+4NNdxIlmxlc9T8wpnEPw== X-Google-Smtp-Source: AGHT+IEC6pY+qlXsE28c4F/QfaalEBCc2wKKZD9GuCPG84eIDgq75QQIjKZU6ycXp/FzWHgrdrLN X-Received: by 2002:a19:2d14:0:b0:513:cdb9:bd61 with SMTP id k20-20020a192d14000000b00513cdb9bd61mr3005961lfj.12.1711538713220; Wed, 27 Mar 2024 04:25:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711538713; cv=pass; d=google.com; s=arc-20160816; b=jFRJuX5iBRMM5zON41TA0NRu/QnAxFTUPVLpHex/nv2wKlPoIoHM8GzTJYAbGD0Wed R8ATiItD636KUFayvGTpp2hfe9WRXrJX7/HOpp8p0riy7KChVsTiAG5j06biqUgGxNe9 4EVOgWF6QpF3TpbJ4O2lKr5KajIqrDc6KWjIXylPyHrJj3iyIHhDwGo/BDzh/NacJiGm 2XM2y9bOU/3+x6Xf+WA3xt36+5OVThRwazYKJyzxefKaDBplYHV6b1EC8KACP262ediq cmkNuMiDVCi/pylGvP4w52Thb3ot7qnksyr28qlFM8td9vUUnenzQRBHRd0h0v8txJbl MANA== 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:to :content-language:subject:cc:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=mXUh1nqgrsbG4gPCr6ishoOi0KEmgfNOK1CdYAiFd7Q=; fh=feelHixqI41Vc3y6nTTq9e/XXNSRrCiJgK+b5DQjca8=; b=sgh0Su7/gWbacJT+q3r3eeVWvUHzGMTNOFTAhWzD3/Z1NYCMjkYKbk+UPGsU7c/R6U LeyzemoUB3WiBzQAvVOG+tmbaZFWIR8iMAqceXjIuA1XAsBEmzzyJY9yaCUiF21/lKe6 o2rKZzrrNwZw41PfeWf2Yd8zRRth1Ynhvyw7sZPhwTLYW37Mv8RxFnUaeZsjn3tGD1BR 9gLDpTWjm3TbKN2/NNh17u/t9H401ih0VSDe30fcQtxlv6N+Mp18MIJAivAb5S6b0j7I 2oH+LqmIpc8BVbDfuI2VpuOQXXNmBcEWJ6damWHxFNESkSamUNgjaDH7DztO8cQMYEMv rMmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=QCr01ppK; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-120748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s15-20020a056402520f00b0056a2eb7f099si4716970edd.50.2024.03.27.04.25.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 04:25:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=QCr01ppK; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-120748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.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 am.mirrors.kernel.org (Postfix) with ESMTPS id E7DC81F25091 for ; Wed, 27 Mar 2024 11:25:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0006170CDC; Wed, 27 Mar 2024 11:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="QCr01ppK" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 813446E61C; Wed, 27 Mar 2024 11:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711538701; cv=none; b=BLKEKbbHpAYrGNhwB1kYUo8Mz+ZVIItnDBPewebD+O2zd7eOcHyADIekE/fWXs0LhFoQ/iX/6EaC5LHEdoDTx+K2kW1W6JKxUGBMNEgKvdAhN6u+pziFFnf012k4fLBB0bDrenqcCQruNP2mxEbxiwej9H498B10AUdPXW2J+4Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711538701; c=relaxed/simple; bh=h2u27KTeiE01TCjsx9AXusXC004jGvE5rQthtYa9ijg=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=O2Aagv56iW1xEgU95wc33FX8zypGP6IfmldRZMQ2GhZ8+UqtV4TFZwwI59E+UBPse6m5F48eq9ItQaqfyq6vDh0w/Yg7iHK5qdurg2NH5VyCsimlk0RyGKyY43L9Ar6slUiHaxaBiUFM38erIrqJT2WgvNpeFhYosiS+NU3fw50= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=QCr01ppK; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1711538697; bh=h2u27KTeiE01TCjsx9AXusXC004jGvE5rQthtYa9ijg=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=QCr01ppK1SB2QYzDRd2x3fZZTxilfWxtRZPhqdr5KcBzndBclTZjIXBOcMGmggZfb oHpMyWbcrSQnmGL7+8gf+aCGuKoUvgMwWHjIABjmI3bZOFhmt0zggN5lN5GS6OROPJ ApRna3LioVMj2/2aSyolAScvrhAXSWV91d52dD+oiECttaNnfAZA/RGIqJlU90ywax c4M4CJSsoO5PQQjP8ILx04embL7sjHZSmqxT0loyiK2+fmDOuKT/IUn3sT5jer1jU+ yXddWqScfwr1hcs89ZVOV5sBT68AxFDN31MdysqfyFJAT5nVAadK2TJBgYie8RTq9P HOQYejj+b4eug== Received: from [100.113.15.66] (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 3BB593780480; Wed, 27 Mar 2024 11:24:54 +0000 (UTC) Message-ID: <59a92e7f-321c-40e1-8e6e-1dcc0035cbed@collabora.com> Date: Wed, 27 Mar 2024 16:25:25 +0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: Muhammad Usama Anjum , kernel@collabora.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 1/2] selftests/dmabuf-heap: conform test to TAP format output Content-Language: en-US To: Shuah Khan , Shuah Khan , "T.J. Mercier" References: <20240305060848.2478806-1-usama.anjum@collabora.com> <387a04c3-356e-4248-9cd3-7aa1a617c221@linuxfoundation.org> From: Muhammad Usama Anjum In-Reply-To: <387a04c3-356e-4248-9cd3-7aa1a617c221@linuxfoundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Shuah, Thanks for reviewing. On 3/27/24 2:05 AM, Shuah Khan wrote: > 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: I'll update and send the this patch as v6. > >> --- >>   .../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 > -- BR, Muhammad Usama Anjum