[{"id":3515,"web_url":"https://patchwork.libcamera.org/comment/3515/","msgid":"<20200118230738.GA1124294@oden.dyn.berto.se>","date":"2020-01-18T23:07:38","subject":"Re: [libcamera-devel] [PATCH] test: buffer_import: Propagate status\n\tcode from buffer allocation","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2020-01-18 23:26:19 +0200, Laurent Pinchart wrote:\n> The BufferSource::allocate() return value isn't propagated correctly,\n> resulting in a test failure when the test should be skipped due to a\n> missing vivid device. Fix it.\n> \n> While at it, return valid status codes from BufferSource::allocate() in\n> all error cases, with proper diagnostic messages.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  test/camera/buffer_import.cpp | 18 +++++++++++++-----\n>  1 file changed, 13 insertions(+), 5 deletions(-)\n> \n> diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp\n> index e7048335e031..16bfca9beeea 100644\n> --- a/test/camera/buffer_import.cpp\n> +++ b/test/camera/buffer_import.cpp\n> @@ -89,15 +89,23 @@ public:\n>  \t\tret = video_->getFormat(&format);\n>  \t\tif (ret) {\n>  \t\t\tstd::cout << \"Failed to get format on output device\" << std::endl;\n> -\t\t\treturn ret;\n> +\t\t\treturn TestFail;\n>  \t\t}\n>  \n>  \t\tformat.size = config.size;\n>  \t\tformat.fourcc = V4L2VideoDevice::toV4L2Fourcc(config.pixelFormat, false);\n> -\t\tif (video_->setFormat(&format))\n> +\t\tif (video_->setFormat(&format)) {\n> +\t\t\tstd::cout << \"Failed to set format on output device\" << std::endl;\n>  \t\t\treturn TestFail;\n> +\t\t}\n>  \n> -\t\treturn video_->exportBuffers(config.bufferCount, &buffers_);\n> +\t\tret = video_->exportBuffers(config.bufferCount, &buffers_);\n> +\t\tif (ret < 0) {\n> +\t\t\tstd::cout << \"Failed to export buffers\" << std::endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\treturn TestPass;\n>  \t}\n>  \n>  \tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers()\n> @@ -178,8 +186,8 @@ protected:\n>  \n>  \t\tBufferSource source;\n>  \t\tint ret = source.allocate(cfg);\n> -\t\tif (ret < 0)\n> -\t\t\treturn TestFail;\n> +\t\tif (ret != TestPass)\n> +\t\t\treturn ret;\n>  \n>  \t\tstd::vector<Request *> requests;\n>  \t\tfor (const std::unique_ptr<FrameBuffer> &buffer : source.buffers()) {\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 283596079E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 19 Jan 2020 00:07:41 +0100 (CET)","by mail-lf1-x142.google.com with SMTP id 203so21100490lfa.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 Jan 2020 15:07:41 -0800 (PST)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\tc8sm14101265lfm.65.2020.01.18.15.07.39\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 18 Jan 2020 15:07:39 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=D020hqv7ZXET+YHn4/5kS90lQ5B3irkoi6+YeNJB0tM=;\n\tb=r3DrHPK0ewmsH0sqwHk5CoBrm8pQlid6zeJQclCJxSTr+HlqjSsIsrtD34hMb/ddlz\n\tbho2sCexUzaqHGSLpvO04dKTfbUdYvv7BZU/YLBW53rjaQ3o4qUPVkhQupSXWglRqDF7\n\twzyt1IgOU4TfdvlGzTP+nbhook9ZkJUri87jAqqBrprrk4lIowYWjCSagfT1hrNhhXR4\n\tId2jGmOk4vgnrtnw3kanZLD14h3bTPcmXATnRmg98TeYvuyYEYMHprJNjU818pd7IA7K\n\t28qP24WdlPeuSlqgJOlMSOjSHrkFQiKGfiau08NuYjfBnE3BBYYcoulhI1FPELRyNHIV\n\tBsMQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=D020hqv7ZXET+YHn4/5kS90lQ5B3irkoi6+YeNJB0tM=;\n\tb=Df8QJmXJrXkBUyUrXGAFDCGiqj6AtavADG3YehKafFj5N6LDnHUbYY54VE5s0a04Ko\n\tRIkpW9omO8Ew6p9h/C9+7rp/+kDYSkHwNGJq6JLgmUuxrke5VFFcdBCPnOMrM21A8zar\n\tEwi+E2pz3T41rCI2wSGMoyArtZjWEamV3U56EeeKXsjmA9ZQSveDql4fNywDSC59H9A1\n\tIwjb+oufoxrAwE9IBhhC8ywshNm3fTw1KQO4MYCXFnw3R9Gd837RDw9wWnEySc0HPdIQ\n\tTVFjARBifUk3kARl8n3gEK9362QCV1wZ24cqHzylEQSp4jcfa1DZy/dqOxtyMUacc8uF\n\tms1w==","X-Gm-Message-State":"APjAAAX70DgS7jePt9qUD9DljHUXs7FOK72MVO02M7ItWtkWy6SUF0PH\n\t/iMzdms1CGGE8YwWxU81htoNsqwqles=","X-Google-Smtp-Source":"APXvYqyFiCuUnjjbS494MaQlKqjfdnu20D359kLSFlFICYPVrZW26aP3pxKIPHlzzrqlUM4OgprciQ==","X-Received":"by 2002:ac2:5605:: with SMTP id v5mr9052424lfd.136.1579388860317;\n\tSat, 18 Jan 2020 15:07:40 -0800 (PST)","Date":"Sun, 19 Jan 2020 00:07:38 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200118230738.GA1124294@oden.dyn.berto.se>","References":"<20200118212619.16174-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200118212619.16174-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] test: buffer_import: Propagate status\n\tcode from buffer allocation","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>","X-List-Received-Date":"Sat, 18 Jan 2020 23:07:41 -0000"}}]