[{"id":11344,"web_url":"https://patchwork.libcamera.org/comment/11344/","msgid":"<20200711131553.GA5964@pendragon.ideasonboard.com>","date":"2020-07-11T13:15:53","subject":"Re: [libcamera-devel] [PATCH v2 1/2] tests: v4l2_compat: Prettify\n\tfailure output","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Sat, Jul 11, 2020 at 02:45:54PM +0900, Paul Elder wrote:\n> When a test is being run on a video device, there is output like so:\n> \n> Testing /dev/video0 with uvcvideo driver...\n> \n> and when it succeeds, \"success\" is appended:\n> \n> Testing /dev/video0 with uvcvideo driver... success\n> \n> On failure, however, the output of v4l2-compliance is printed before\n> \"failure\" is printed, resulting in the first line of the v4l2-compliance\n> output to be printed on the same line as the message:\n> \n> Testing /dev/video2 with uvcvideo driver... v4l2-compliance SHA: not available, 64 bits\n> <v4l2-compliance output>\n> failure\n> \n> Refactor the code to make \"failure\" print before the output of the test,\n> to prettify the output upon failure..\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> Changes in v2:\n> - refactor code instead of just moving the print failure statement\n> ---\n>  test/v4l2_compat/v4l2_compat_test.py | 22 ++++++++--------------\n>  1 file changed, 8 insertions(+), 14 deletions(-)\n> \n> diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py\n> index 99b3d5a..8aca222 100755\n> --- a/test/v4l2_compat/v4l2_compat_test.py\n> +++ b/test/v4l2_compat/v4l2_compat_test.py\n> @@ -54,32 +54,25 @@ def extract_result(result):\n>      return ret\n>  \n>  \n> -def print_output_arr(output_arr):\n> -    print('\\n'.join(output_arr))\n> -\n> -\n>  def test_v4l2_compliance(v4l2_compliance, v4l2_compat, device, base_driver):\n>      ret, output = run_with_stdout(v4l2_compliance, '-s', '-d', device, env={'LD_PRELOAD': v4l2_compat})\n>      if ret < 0:\n> -        print_output_arr(output)\n> -        print(f'Test for {device} terminated due to signal {signal.Signals(-ret).name}')\n> -        return TestFail\n> +        output.append(f'Test for {device} terminated due to signal {signal.Signals(-ret).name}')\n> +        return TestFail, output\n>  \n>      result = extract_result(output[-2])\n>      if result['failed'] == 0:\n> -        return TestPass\n> +        return TestPass, None\n>  \n>      # vimc will fail s_fmt because it only supports framesizes that are\n>      # multiples of 3\n>      if base_driver == 'vimc' and result['failed'] == 1:\n>          failures = grep('fail', output)\n>          if re.search('S_FMT cannot handle an invalid format', failures[0]) is None:\n> -            print_output_arr(output)\n> -            return TestFail\n> -        return TestPass\n> +            return TestFail, output\n> +        return TestPass, None\n>  \n> -    print_output_arr(output)\n> -    return TestFail\n> +    return TestFail, output\n>  \n>  \n>  def main(argv):\n> @@ -132,10 +125,11 @@ def main(argv):\n>              continue\n>  \n>          print(f'Testing {device} with {driver} driver... ', end='')\n> -        ret = test_v4l2_compliance(v4l2_compliance, v4l2_compat, device, driver)\n> +        ret, msg = test_v4l2_compliance(v4l2_compliance, v4l2_compat, device, driver)\n>          if ret == TestFail:\n>              failed.append(device)\n>              print('failed')\n> +            print('\\n'.join(msg))\n>          else:\n>              print('success')\n>          drivers_tested[driver] = True","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4C1C2BD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 11 Jul 2020 13:16:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B1FB46055F;\n\tSat, 11 Jul 2020 15:16:01 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C526460556\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 11 Jul 2020 15:16:00 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3AB222FD;\n\tSat, 11 Jul 2020 15:16:00 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"luMqDcQM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594473360;\n\tbh=6iq2OxNWOcZYecC9+sOVyMu2xKkogA0mQx+SgR2fFqE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=luMqDcQMm2/Ks15NBkpIq9TPuP7Y+DV0kne6tA/I8Ejv2F5r6vILAwwC3Q0+xIpHF\n\tKyLLuTnNn3yLGrlm1FzIXLfRXgeWeqv4lvwMkuzmqGQqYCNkZ3M55o7UjMQKOBAguL\n\t2tyrFDljkCMAYg2aVw2FCGu50qZNuSOJzmCseu+c=","Date":"Sat, 11 Jul 2020 16:15:53 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20200711131553.GA5964@pendragon.ideasonboard.com>","References":"<20200711054555.495244-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200711054555.495244-1-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/2] tests: v4l2_compat: Prettify\n\tfailure output","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]