[{"id":4850,"web_url":"https://patchwork.libcamera.org/comment/4850/","msgid":"<20200519134438.GG470768@oden.dyn.berto.se>","date":"2020-05-19T13:44:38","subject":"Re: [libcamera-devel] [PATCH 2/3] test: file-descriptor: Add \"fd\n\tmove\" constructor test","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-05-18 19:48:03 +0300, Laurent Pinchart wrote:\n> Add a test for the newly added \"fd move\" constructor.\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/file-descriptor.cpp | 42 ++++++++++++++++++++++++++++++++++++----\n>  1 file changed, 38 insertions(+), 4 deletions(-)\n> \n> diff --git a/test/file-descriptor.cpp b/test/file-descriptor.cpp\n> index 7477a843531c..aa3c896fb937 100644\n> --- a/test/file-descriptor.cpp\n> +++ b/test/file-descriptor.cpp\n> @@ -56,16 +56,19 @@ protected:\n>  \t\tdelete desc1_;\n>  \t\tdesc1_ = nullptr;\n>  \n> -\t\t/* Test creating FileDescriptor from numerical file descriptor. */\n> +\t\t/*\n> +\t\t * Test creating FileDescriptor by copying numerical file\n> +\t\t * descriptor.\n> +\t\t */\n>  \t\tdesc1_ = new FileDescriptor(fd_);\n>  \t\tif (desc1_->fd() == fd_) {\n> -\t\t\tstd::cout << \"Failed fd numerical check (int constructor)\"\n> +\t\t\tstd::cout << \"Failed fd numerical check (lvalue ref constructor)\"\n>  \t\t\t\t  << std::endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\n>  \n>  \t\tif (!isValidFd(fd_) || !isValidFd(desc1_->fd())) {\n> -\t\t\tstd::cout << \"Failed fd validity after construction (int constructor)\"\n> +\t\t\tstd::cout << \"Failed fd validity after construction (lvalue ref constructor)\"\n>  \t\t\t\t  << std::endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\n> @@ -76,7 +79,38 @@ protected:\n>  \t\tdesc1_ = nullptr;\n>  \n>  \t\tif (!isValidFd(fd_) || isValidFd(fd)) {\n> -\t\t\tstd::cout << \"Failed fd validity after destruction (int constructor)\"\n> +\t\t\tstd::cout << \"Failed fd validity after destruction (lvalue ref constructor)\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\t/*\n> +\t\t * Test creating FileDescriptor by taking ownership of\n> +\t\t * numerical file descriptor.\n> +\t\t */\n> +\t\tint dupFd = dup(fd_);\n> +\t\tint dupFdCopy = dupFd;\n> +\n> +\t\tdesc1_ = new FileDescriptor(std::move(dupFd));\n> +\t\tif (desc1_->fd() != dupFdCopy) {\n> +\t\t\tstd::cout << \"Failed fd numerical check (rvalue ref constructor)\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (dupFd != -1 || !isValidFd(fd_) || !isValidFd(desc1_->fd())) {\n> +\t\t\tstd::cout << \"Failed fd validity after construction (rvalue ref constructor)\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tfd = desc1_->fd();\n> +\n> +\t\tdelete desc1_;\n> +\t\tdesc1_ = nullptr;\n> +\n> +\t\tif (!isValidFd(fd_) || isValidFd(fd)) {\n> +\t\t\tstd::cout << \"Failed fd validity after destruction (rvalue ref constructor)\"\n>  \t\t\t\t  << std::endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\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-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E223A603D9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 May 2020 15:44:39 +0200 (CEST)","by mail-lj1-x241.google.com with SMTP id q2so1588589ljm.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 May 2020 06:44:39 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tc69sm6646516lfg.23.2020.05.19.06.44.38\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 19 May 2020 06:44:38 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com header.b=\"SILgCJUW\"; \n\tdkim-atps=neutral","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=9WYxO3uomYT0Bb96WePgL3cPaEaDyjjwxm+JPsHIXy8=;\n\tb=SILgCJUWp/zuT7CEQqLthTy1bH/uhS9zkg/ZPWkFY8ZhkG3YgR1ir5LFK4X7TX+l8Z\n\tbwI1npcx6hPAjImQPNmOd0NYIPKW6QsQ2vK871tRR38OYbFiwLRq6hmcNVMnIpahCSRu\n\tlddpDIj1MF2eNzpedARf4MWCa+xq9HRuR+M0u1PXL2uE06HHcYaBS/rb4IdPrycraTtw\n\tktgPTNmvmt8rDYzTrL/lotiFky5aDHPDrtAnn/hYJCD0StiW6Joj8lJj99/LQtVluGLs\n\tG4Xdm5G/khm8sKgygmnYQHVUoFqsln2uQLkWO/wALkjxR3jcE00OSovhll/8ubU0n+fZ\n\tL7kw==","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=9WYxO3uomYT0Bb96WePgL3cPaEaDyjjwxm+JPsHIXy8=;\n\tb=CksJ0kMNyn5jneNvYiGjfdy/Gu/r73RZgbGT0B+cQKDDuTfYpOJh4WC22zroD7NzCn\n\t6LybsCuFnbgjcgSeDowXRwUh9pCVPPVqd7ZWVUwN/T5bGRBJiCGaMoBg7xqUKhaGDm5q\n\tXuFGok8MiBMTkiCdsBGpiW8bETh6znByzZwfnRsPLVjvjtXkqcqY3v+NRL9zA1Fliewk\n\th7Jb6wSV+TKDRhYkr1XE+InIXqlt/E+7BoCMLMizCcbnWQY5m+j7Co7x/xOy122x04th\n\t++jz0bGUXOSN8YQtoYpXokOPjYV2fETTA4HGdnZQE4LxqCBtClKiEZJdLt6TE1u5cqaG\n\tKUSA==","X-Gm-Message-State":"AOAM530qkUbjfdo3qqL0CrgunQlMfQVfsA4F1TEjSTvbwxuPAh0Xoihh\n\tXj4EHlKvlM5MvS2zJIWFqPkvXw==","X-Google-Smtp-Source":"ABdhPJxEX+PJrw6BDl3xOz2ApW1tyjso2dlxlL50WmtyQw6vdt2Gt737Wgg6nsyCoOMLJmB3szxAug==","X-Received":"by 2002:a05:651c:239:: with SMTP id\n\tz25mr12794734ljn.148.1589895879312; \n\tTue, 19 May 2020 06:44:39 -0700 (PDT)","Date":"Tue, 19 May 2020 15:44:38 +0200","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":"<20200519134438.GG470768@oden.dyn.berto.se>","References":"<20200518164804.10088-1-laurent.pinchart@ideasonboard.com>\n\t<20200518164804.10088-2-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":"<20200518164804.10088-2-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] test: file-descriptor: Add \"fd\n\tmove\" constructor test","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":"Tue, 19 May 2020 13:44:40 -0000"}}]