{"id":8747,"url":"https://patchwork.libcamera.org/api/patches/8747/?format=json","web_url":"https://patchwork.libcamera.org/patch/8747/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20200712144419.21457-3-laurent.pinchart@ideasonboard.com>","date":"2020-07-12T14:44:18","name":"[libcamera-devel,3/4] test: file: Add file creation test","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e9448e2c380d759451a8caafff9b22487b4f5b29","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8747/mbox/","series":[{"id":1098,"url":"https://patchwork.libcamera.org/api/series/1098/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1098","date":"2020-07-12T14:44:16","name":"[libcamera-devel,1/4] libcamera: file: Add read/write support","version":1,"mbox":"https://patchwork.libcamera.org/series/1098/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8747/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8747/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 59602BD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 12 Jul 2020 14:44:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 473BB605A7;\n\tSun, 12 Jul 2020 16:44:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2589660553\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Jul 2020 16:44:46 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BA357DC4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Jul 2020 16:44:45 +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=\"nsovdzhi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594565085;\n\tbh=uxCB+MLhJuSW1VvUkO6kR84shuC0hnMrYGFKLYY23eg=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=nsovdzhiUtXtx+llrtJZ8zhjBQXSTpAquOFWy6lLgxLNBnAgcNkwDCu2eYZ53Fo4x\n\tXNIRCuk8A6CSQMD1nTrSfao3Bc4gamoWbgmULSNrbwDkY6xGssGoMrwMLiK2qRhaBr\n\tU4W7OC66p5clkH+9+7pfPPkRXxqEw1ghgj0IdgF8=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun, 12 Jul 2020 17:44:18 +0300","Message-Id":"<20200712144419.21457-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200712144419.21457-1-laurent.pinchart@ideasonboard.com>","References":"<20200712144419.21457-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 3/4] test: file: Add file creation 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>","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":"Add a test to verify file creation with File::open(). The test is\nexpected to fail as the File::open() implementation is not correct.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/file.cpp | 28 ++++++++++++++++++++++++++--\n 1 file changed, 26 insertions(+), 2 deletions(-)","diff":"diff --git a/test/file.cpp b/test/file.cpp\nindex 7688a9dc224a..f458f355ccad 100644\n--- a/test/file.cpp\n+++ b/test/file.cpp\n@@ -31,6 +31,7 @@ protected:\n \t\t\treturn TestFail;\n \n \t\tclose(fd);\n+\t\tunlink(fileName_.c_str());\n \n \t\treturn TestPass;\n \t}\n@@ -191,14 +192,37 @@ protected:\n \n \t\tfile.close();\n \n+\t\t/* Test file creation. */\n+\t\tfile.setFileName(fileName_);\n+\n+\t\tif (file.exists()) {\n+\t\t\tcerr << \"Temporary file already exists\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (file.open(File::ReadOnly)) {\n+\t\t\tcerr << \"Read-only open succeeded on nonexistent file\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (!file.open(File::WriteOnly)) {\n+\t\t\tcerr << \"Write-only open failed on nonexistent file\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (!file.exists()) {\n+\t\t\tcerr << \"Write-only open failed to create file\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tfile.close();\n+\n \t\t/* Test read and write. */\n \t\tstd::array<uint8_t, 256> buffer = { 0 };\n \n \t\tstrncpy(reinterpret_cast<char *>(buffer.data()), \"libcamera\",\n \t\t\tbuffer.size());\n \n-\t\tfile.setFileName(fileName_);\n-\n \t\tif (file.read(buffer) >= 0) {\n \t\t\tcerr << \"Read succeeded on closed file\" << endl;\n \t\t\treturn TestFail;\n","prefixes":["libcamera-devel","3/4"]}