{"id":8743,"url":"https://patchwork.libcamera.org/api/1.1/patches/8743/?format=json","web_url":"https://patchwork.libcamera.org/patch/8743/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200711054555.495244-1-paul.elder@ideasonboard.com>","date":"2020-07-11T05:45:54","name":"[libcamera-devel,v2,1/2] tests: v4l2_compat: Prettify failure output","commit_ref":"ce32ca491884c4755e3cae0c7a6453a1f4933da2","pull_url":null,"state":"accepted","archived":false,"hash":"e948dfc01e31e6e727523fdd9a4c42b8cdf7afec","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8743/mbox/","series":[{"id":1097,"url":"https://patchwork.libcamera.org/api/1.1/series/1097/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1097","date":"2020-07-11T05:45:54","name":"[libcamera-devel,v2,1/2] tests: v4l2_compat: Prettify failure output","version":2,"mbox":"https://patchwork.libcamera.org/series/1097/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8743/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8743/checks/","tags":{},"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 A4CB8BD790\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 11 Jul 2020 05:46:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3AABF6054D;\n\tSat, 11 Jul 2020 07:46:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B24CB6048D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 11 Jul 2020 07:46:08 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 174302FD;\n\tSat, 11 Jul 2020 07:46:06 +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=\"AN8zFADM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594446368;\n\tbh=IciX0hrfxfxJipLb+66/lAKIlKcQYWDX/b/91Ar6P+0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=AN8zFADMOtVWpYubDzxGd1RkEpv2/YZOzlUQIwQYD2Fph9B1RAyZ9JYb/SaOQeUG6\n\teznVqbNByJZ+om7Nt5DvN0fE4/2a05s6eIF83JKpuAVWuebYLrupbqSyW7B+/LStaG\n\tYQP5bCv7RUAIEM2YWsPBXxL+/BBRrqp/XOHcp2TI=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 11 Jul 2020 14:45:54 +0900","Message-Id":"<20200711054555.495244-1-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","MIME-Version":"1.0","Subject":"[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>","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>"},"content":"When a test is being run on a video device, there is output like so:\n\nTesting /dev/video0 with uvcvideo driver...\n\nand when it succeeds, \"success\" is appended:\n\nTesting /dev/video0 with uvcvideo driver... success\n\nOn failure, however, the output of v4l2-compliance is printed before\n\"failure\" is printed, resulting in the first line of the v4l2-compliance\noutput to be printed on the same line as the message:\n\nTesting /dev/video2 with uvcvideo driver... v4l2-compliance SHA: not available, 64 bits\n<v4l2-compliance output>\nfailure\n\nRefactor the code to make \"failure\" print before the output of the test,\nto prettify the output upon failure..\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges 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(-)","diff":"diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py\nindex 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\n","prefixes":["libcamera-devel","v2","1/2"]}