From patchwork Tue Jan 7 16:51:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 855511 Delivered-To: patch@linaro.org Received: by 2002:adf:8b05:0:b0:385:e875:8a9e with SMTP id n5csp321416wra; Tue, 7 Jan 2025 09:01:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXY01Cxaewh0eHmlWpgtuibMunPiu2veWExvONbqh6/kKo1MCPl0IA+iwN7tJ7GpoSvEo6yDQ==@linaro.org X-Google-Smtp-Source: AGHT+IFIugx6PNX1s5owGsKe43kt9dZ7aLpVH1v9GhIUCZrHYIAF99sHU0raBotWYfFoRwQRuyYM X-Received: by 2002:a05:6122:1999:b0:517:4e40:6838 with SMTP id 71dfb90a1353d-51b75c65272mr44682713e0c.6.1736269309868; Tue, 07 Jan 2025 09:01:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736269309; cv=none; d=google.com; s=arc-20240605; b=MGToCKWSv0hVfbFY5hLB2xOAnjXSAog+CxX+7lYQABz+WNs0/NWic/5ORVmjQzNqQV Oy23W0W4nx2L3wHWARk5Hn6INlUgm1UsBeYrljxBERq/A4ib1qxElg4mip5dtEl3hnqu GpEOVu2MtUCWBn/QcEkgY37uZtQWFtMAoo1dMk48gGO4PP5VJOYKIdxzJmsWWVYiXP4L TERHYso0yrVxFRlfr2SCwQ9gN+JA1Wfw9eb47R8rowoVoEFbELvnDdYe8UZxs1LfynLc 7LXvsJl61ajrMXWCE5fx+Fvezagoh0LLxXPv38XnpcRF8XtOhuEcKERiS7lLhC2IQsOM drpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lmaBQafc1hcOcHjmvqmTitVigBgQH5FjwDw2a2hIcHI=; fh=gCrRMsBOO2s5UczjHW2I0Xj39iNRWP/OR2J6q01yAGs=; b=R60aCasrhMKd7yujaTm9QUBt+H8NxnSWZ1FyFmXFt8BmV23T817QQ+gnwwcwr50gTD 9RTB2rVEqHqDKJDhd67v0i5Es/5HigCHwg9nOgmT/m1pmFmet+7g6pLJw4wqxAlMKapl Fy6I3kWwRf+C/BM/p4KCgMPAc8OCo6Qu1U/aSEoFVZrPfwdXsn5UPZGzvSWFKQBZywl5 WP8o2WE2vFnhgh6aMbrrX+5jKFcHH8+gfHKcZPRAlya1L/j/5+lpxQKUGUGCXxu9eCae Hnt0C7wLc3ZkHcuAMc5YRsOmJur1MTPdI3DQ6UX41nT5vP8Il7+Sb0rfSxNIKXKndqvR K0tg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IhT5l918; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51b68a225ffsi12490004e0c.0.2025.01.07.09.01.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Jan 2025 09:01:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IhT5l918; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVCua-00031j-AA; Tue, 07 Jan 2025 11:58:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVCu5-0002DD-P5 for qemu-devel@nongnu.org; Tue, 07 Jan 2025 11:58:07 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVCtx-0006v7-Lc for qemu-devel@nongnu.org; Tue, 07 Jan 2025 11:58:04 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-385d7f19f20so6995487f8f.1 for ; Tue, 07 Jan 2025 08:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736269076; x=1736873876; darn=nongnu.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=lmaBQafc1hcOcHjmvqmTitVigBgQH5FjwDw2a2hIcHI=; b=IhT5l9186tYJYy5kkb0qVdJ1CwyZPpehWg4/3DmiDywqqsz6p2H35p1zsWfHRsKjkD 9dkQlAsAktw9FNEP/zoP04JBo178r12txvO9xxZ8t6q3oWOZbneX+LIsYURkKjUyJAVG vFK53ZMnfYElT5zkXB4/t2kSGhu/eEkJ6KMXyvYrOUo2mEXlVy67ji5H0tmgRgovhNlT QbiR+vhj3wOPpJ8cbon42pYlMPrycv+fiwpRLm1VeJDDBinMuMyJ7EASFewMMbGEqqL0 5ZPRja2pZFEPnxIjSiHgwbTJluBPn9CMEZ52fOB3JP6W/RTGxDYGCIJ0nbv3//+g240j KDrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736269076; x=1736873876; 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=lmaBQafc1hcOcHjmvqmTitVigBgQH5FjwDw2a2hIcHI=; b=h2zsrwB3uvX/uTQG9Olzz11kdDKusB3fKrzXAgK2uumP7tdjbcZPACYFmqCWkOUOvg ajohU9BHLs93cNDqG8yNVzOB7rnxuhxmS/mLNEBAwpdtp7EKLHHvIGWUzxgU9U4aC1wY Mg/aZ+CNK0d82wbHfXd2ZVt2pK1DVUU3eEtgem8G8mh7vuoAiXXySffjJ/JZq7y1ibta 5u9JHOiuh2asVCtZP1grJnVMLFPOkCRVEQKZIE44vjUH2H5TlmTkiJCi9bETFcUThCRy mf7Tg4yTab//y5kqNiUp+yH3XBci///oJep4XnFGR4DYggmR0ymIlOOBNxwesdLaxBKt z8Mg== X-Gm-Message-State: AOJu0YyadK8yKGw2jakB3clRWYxNSvXiHwRULtkkK4yoTxxaEK2MIqZQ EnZgRWFVzCBWvm+zhYrym9F2A6OOFo7kQCrSG1QB8ySgE56p0dvLZgGtPUrwaS0= X-Gm-Gg: ASbGncsrckCfSun3vCL+fQa9X+/IAvcQPjQmxUQwREpAWKIMkg+Q4HKAjymfzh4N2HA 56+AckVt3YFVSQY2xEHxtrACPFogfUTwLiVUNt52nTDK7k3ZES1HFChnPuHFCBVqV4lEKL3iMbS PSp+Bj9/O4N9nxOhWmkanyjkS6PMuZqmumcLP9rBOqEhiylIIS2h5nkbhNXIaCCxClhigTn5Sr+ WxmQ+eaNdrWUhPTQ7ujQ47Gug5JZVawjgURYSdbmDJjapvYZdzIswQ= X-Received: by 2002:a5d:47a9:0:b0:385:d7f9:f166 with SMTP id ffacd0b85a97d-38a221fa11cmr45355632f8f.17.1736269075813; Tue, 07 Jan 2025 08:57:55 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8a6ca5sm52045565f8f.86.2025.01.07.08.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 08:57:53 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BC88B5FD35; Tue, 7 Jan 2025 16:52:09 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Beraldo Leal , Ed Maste , Halil Pasic , qemu-ppc@nongnu.org, John Snow , Radoslaw Biernacki , Nicholas Piggin , Markus Armbruster , Leif Lindholm , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Bin Meng , Daniel Henrique Barboza , Marcel Apfelbaum , qemu-riscv@nongnu.org, Christian Borntraeger , Wainer dos Santos Moschetta , qemu-s390x@nongnu.org, Alistair Francis , Liu Zhiwei , Fabiano Rosas , Weiwei Li , Harsh Prateek Bora , qemu-arm@nongnu.org, Li-Wen Hsu , Palmer Dabbelt , Daniel Henrique Barboza , Richard Henderson , Cleber Rosa , Marcin Juszkiewicz , Peter Maydell , Laurent Vivier , Aurelien Jarno , Eric Farman , Pavel Dovgalyuk , Jiaxun Yang , Thomas Huth , Laurent Vivier , Joel Stanley , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= , Bernhard Beschow , "Michael S. Tsirkin" Subject: [PATCH v3 19/29] tests/functional: add zstd support to uncompress utility Date: Tue, 7 Jan 2025 16:51:57 +0000 Message-Id: <20250107165208.743958-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107165208.743958-1-alex.bennee@linaro.org> References: <20250107165208.743958-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than using the python library (which has a different API anyway) lets just call the binary. zstdtools is already in out qemu.yml so all test containers should have it around. Tests should still use @skipIfMissingCommands('zstd') to gracefully handle when only minimal dependencies have been installed. Signed-off-by: Alex Bennée --- tests/functional/qemu_test/uncompress.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/functional/qemu_test/uncompress.py b/tests/functional/qemu_test/uncompress.py index 6d02ded066..404eee1f83 100644 --- a/tests/functional/qemu_test/uncompress.py +++ b/tests/functional/qemu_test/uncompress.py @@ -12,6 +12,7 @@ import os import shutil from urllib.parse import urlparse +from subprocess import check_call, CalledProcessError from .asset import Asset @@ -38,6 +39,18 @@ def lzma_uncompress(xz_path, output_path): os.remove(output_path) raise +def zstd_uncompress(zstd_path, output_path): + if os.path.exists(output_path): + return + + try: + check_call(['zstd', "-f", "-d", zstd_path, + "-o", output_path]) + except CalledProcessError as e: + os.remove(output_path) + raise Exception( + f"Unable to decompress zstd file {zstd_path} with {e}") from e + ''' @params compressed: filename, Asset, or file-like object to uncompress @params uncompressed: filename to uncompress into @@ -59,6 +72,8 @@ def uncompress(compressed, uncompressed, format=None): lzma_uncompress(str(compressed), uncompressed) elif format == "gz": gzip_uncompress(str(compressed), uncompressed) + elif format == "zstd": + zstd_uncompress(str(compressed), uncompressed) else: raise Exception(f"Unknown compression format {format}") @@ -79,5 +94,7 @@ def guess_uncompress_format(compressed): return "xz" elif ext == ".gz": return "gz" + elif ext == ".zstd": + return "zstd" else: raise Exception(f"Unknown compression format for {compressed}")