From patchwork Fri Jun 7 16:32:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= X-Patchwork-Id: 1945173 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vwmvg1qQ8z20Q5 for ; Sat, 8 Jun 2024 02:32:47 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3C58842750; Fri, 7 Jun 2024 16:32:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id LWiYdJxsYEI1; Fri, 7 Jun 2024 16:32:42 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 345F042766 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 345F042766; Fri, 7 Jun 2024 16:32:41 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 2E8FC1BF47A for ; Fri, 7 Jun 2024 16:32:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 118A54270B for ; Fri, 7 Jun 2024 16:32:37 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8OQd8F-QZwoY for ; Fri, 7 Jun 2024 16:32:35 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::32c; helo=mail-wm1-x32c.google.com; envelope-from=raphael.melotte@essensium.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 64C3B4270A DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 64C3B4270A Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by smtp4.osuosl.org (Postfix) with ESMTPS id 64C3B4270A for ; Fri, 7 Jun 2024 16:32:35 +0000 (UTC) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42163fed884so12226185e9.1 for ; Fri, 07 Jun 2024 09:32:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717777953; x=1718382753; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KgPciTO8HDkbK0gGfreJ0D0fWee2HpBooNBbRqR8cRQ=; b=Q6j0R86lR5tafFzO4KKjaXqJn/F8KolWzzW/kK/exuqK/1NtshOamBfnMciju0IBW+ ksTJ53UST9TRekvKg66uAm1P6jafqJ0gw6euG+xhPvWB60yB6d3gZMBKu6xRrwkSJvlJ IFmMdrE+idG7vUk7ViAPI5fRx4G0nFboxJJDIs6HTVzA4oS1P+QVRBudfwyk4Lo6QJjB WD2HpD/ZsmyVkL6LyW/spc/7cg1KUn3Hh5moXUaPG4OIOhQNw2pAYQ4cMiGhCIgjxqQw QKtkjgvJvhdM5I+1xkxcV2Ohn9HrKwfZzH0UTcWtHuep3gTXL5AR4QpZ7lTBGHnLQYGH BlEA== X-Gm-Message-State: AOJu0YwIwqz0qMfYjjtr9g21JylAYS/AMxgyd6457fwQ98UB/oinVpbX HW79uuZdllgp7xzKQn/tUf7jG2SDRVRblEb2jCDDuDOXmeepxgG3+aia6dOOotfoXxoENWyAz4c NHeI= X-Google-Smtp-Source: AGHT+IEiF4zmOJZqlbqqNRbmV6J4KNeG8QyfYrP6AVqi4zwpYgBM4WZ2cKuRNPHFVQgl1YEWdUGVtg== X-Received: by 2002:a05:600c:1551:b0:421:4786:eb0c with SMTP id 5b1f17b1804b1-42164a44b35mr24892935e9.33.1717777953006; Fri, 07 Jun 2024 09:32:33 -0700 (PDT) Received: from junian.fritz.box (94.105.103.7.dyn.edpnet.net. [94.105.103.7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c2cd7e7sm55804205e9.46.2024.06.07.09.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 09:32:32 -0700 (PDT) To: buildroot@buildroot.org Date: Fri, 7 Jun 2024 18:32:03 +0200 Message-Id: <20240607163208.1445715-2-raphael.melotte@mind.be> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20240607163208.1445715-1-raphael.melotte@mind.be> References: <20240216211344.1807353-2-raphael.melotte@mind.be> <20240607163208.1445715-1-raphael.melotte@mind.be> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1717777953; x=1718382753; darn=buildroot.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KgPciTO8HDkbK0gGfreJ0D0fWee2HpBooNBbRqR8cRQ=; b=URowmKVTUmCVYJE04rUgYGh7lwbLPBrAalnuOgfHXMbm2n08r5vCKl1SzZ7kRwHylo 0RXlY8IeCQPFa3UK3tYEWM7wd9JsNbc1dFafha15b4842vEiMVI5yVtIr30O6i3iBL/h CxiFx4asCDAlv+aMVK47LgfZ8vva9ueAXvXzPcZbN/vYc9EbqMfa5oCBteZ7Tvybuhok jObsAYjiZuD5KBFWEFzLpne+qopR/14T3pm2UcqU075N9wHSHFRyymwVd69L4sAZ9ApT J8vbMwIaoNVFZQQGrcMjqvXbFgLJuvrqsdvAEIuhB6XGgtAezNhNOuciBVaj652DeU0l 7y8w== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=mind.be X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=mind.be header.i=@mind.be header.a=rsa-sha256 header.s=google header.b=URowmKVT Subject: [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Rapha=C3=ABl_M=C3=A9lotte_via_buildroot?= From: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Reply-To: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Cc: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" To give us a chance to catch runtime issues (such as missing dependencies) more easily, add a test that writes a sample PDF file, read it back and verify the text that was read. Like similar packages that lead to a big rootfs (e.g. python-botocore), this test requires a separate ext2 rootfs to avoid filling the default amount of RAM available entirely (which would cause missing files from the root filesystem and in turn, test failures). Signed-off-by: Raphaël Mélotte --- DEVELOPERS | 2 ++ .../tests/package/sample_python_pymupdf.py | 17 ++++++++++++ .../tests/package/test_python_pymupdf.py | 26 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 support/testing/tests/package/sample_python_pymupdf.py create mode 100644 support/testing/tests/package/test_python_pymupdf.py diff --git a/DEVELOPERS b/DEVELOPERS index 03aa7bfa74..e4c3920ce2 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -2667,9 +2667,11 @@ F: package/python-pymupdf/ F: package/python-rsa/ F: package/python-s3transfer/ F: support/testing/tests/package/sample_python_jmespath.py +F: support/testing/tests/package/sample_python_pymupdf.py F: support/testing/tests/package/sample_python_rsa.py F: support/testing/tests/package/sample_python_s3transfer.py F: support/testing/tests/package/test_python_jmespath.py +F: support/testing/tests/package/test_python_pymupdf.py F: support/testing/tests/package/test_python_rsa.py F: support/testing/tests/package/test_python_s3transfer.py diff --git a/support/testing/tests/package/sample_python_pymupdf.py b/support/testing/tests/package/sample_python_pymupdf.py new file mode 100644 index 0000000000..574bd27965 --- /dev/null +++ b/support/testing/tests/package/sample_python_pymupdf.py @@ -0,0 +1,17 @@ +import fitz + +# Write a test PDF file +outfile = "python-pymupdf.pdf" +sample_text = "This is a test page for python-pymupdf." +doc = fitz.open() +page = doc.new_page() +p = fitz.Point(50, 72) +page.insert_text(p, sample_text) +doc.save(outfile) + +# Read back the file +with fitz.open(outfile) as d: # open document + read_text = chr(12).join([page.get_text() for page in d]) + +print(read_text) +assert(read_text == sample_text + "\n") diff --git a/support/testing/tests/package/test_python_pymupdf.py b/support/testing/tests/package/test_python_pymupdf.py new file mode 100644 index 0000000000..5e9d5a6912 --- /dev/null +++ b/support/testing/tests/package/test_python_pymupdf.py @@ -0,0 +1,26 @@ +import os +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonPy3PyMuPDF(TestPythonPackageBase): + __test__ = True + config = TestPythonPackageBase.config + \ + """ + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_PYMUPDF=y + BR2_PACKAGE_XORG7=y + BR2_USE_WCHAR=y + BR2_INSTALL_LIBSTDCPP=y + BR2_TARGET_ROOTFS_EXT2=y + BR2_TARGET_ROOTFS_EXT2_SIZE="250M" + """ + sample_scripts = ["tests/package/sample_python_pymupdf.py"] + timeout = 30 + + def login(self): + ext2_file = os.path.join(self.builddir, "images", "rootfs.ext2") + self.emulator.boot(arch="armv5", + kernel="builtin", + options=["-drive", "file=%s,if=scsi,format=raw" % ext2_file], + kernel_cmdline=["rootwait", "root=/dev/sda"]) + self.emulator.login()