From patchwork Fri Apr 18 14:09:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 882321 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp831911wrs; Fri, 18 Apr 2025 07:13:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVrP/PII962Ua8d9PI1Fk2nO1FoYPzwLz/Iuo2kcV0mufZzMueG9ze0b8wxPFuHP/1uuVeCuw==@linaro.org X-Google-Smtp-Source: AGHT+IE/ZUh3RWK9UnO1iDaTw+8HfFWEjZeotGjoAzvMHFUYgYnkojFGIKlPIG33dDKEp40QVy8V X-Received: by 2002:a05:600c:1d18:b0:43c:f3e4:d6f6 with SMTP id 5b1f17b1804b1-4406ac27928mr29094175e9.31.1744985613179; Fri, 18 Apr 2025 07:13:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744985613; cv=none; d=google.com; s=arc-20240605; b=bult0agVZO3lj69puZKZ7rixoAIbRF1RCwY3XbKOws2ah1mGai7cS5xUZWVnU9D72c V98zcrbAgdRBISpt/nma4xKvugi3gVQx5q66boxQMdyMWOaGWEX4YE+KiekVhzFIjDOP QHVN+a9luAMnCC5iTyowUYkk43IMSR0BKS9WTsks9DTmkKIn76uMru2qlF2bPJA/bfI1 +yCES0g4yuFF+HNV2GdC76zrGzwFrn3U+RyFuq/36AOnrU9rbrihx9St5MGjaVvcnnJW C78ksjDaUo8lwRuKKAvYO7rx/3HeVWw7byYbfbMV21o1SMRp0LVI4B/70b3z29VLJjG6 6Zkw== 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=oV06jOcGhgL3zQiSdJCinxggWnUr0Aa60E9KHFCFYe8=; fh=tm5rISUntxEK2e1cV5c7CmpkxEU0okRirSrF7/b/Bco=; b=a8/XTHEwXFAQzzF4VqnjQ2GWMkbJN4dC5a+YPXPKYn7ulp+gVDbqDMYraLuWQQeNHG SD2VCQoiCr8xLu5b4nd0MKs+B05uR4Y+9q/Tt4cupJoKF7n6dHicuifcptyaftpPL0D2 mFQDV3UNjBEGdiGV1P1LFqqi7mL/PJXKNTsfEhZR3+wCX1w0lR8Swkw3Fvqt8kvyKbz+ DCCRNuwQusZA4tTKiORCX1XluB97bI5O65wRUnbQeCBEXW5Z+n0Rf3WyhFt9XfgJCEP6 gOFNltEntJFSgsQ/GFHKgHdgPJYfoRq9dUq8aq/GQBuIbIqaRv5i6VAnE6woOceXqPHU taTg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SIlE5Qgs; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ffacd0b85a97d-39efa42c671si1238395f8f.175.2025.04.18.07.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Apr 2025 07:13:33 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SIlE5Qgs; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8EF6A83348; Fri, 18 Apr 2025 16:11:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SIlE5Qgs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCD268327A; Fri, 18 Apr 2025 16:11:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0249A83290 for ; Fri, 18 Apr 2025 16:11:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-39c31e4c3e5so1296075f8f.0 for ; Fri, 18 Apr 2025 07:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744985505; x=1745590305; darn=lists.denx.de; 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=oV06jOcGhgL3zQiSdJCinxggWnUr0Aa60E9KHFCFYe8=; b=SIlE5Qgs3ximLOVY/U1d1xZMFOQOIYgqYKDPwtiDr/5iYt4n9p3Le+mxGhugtlckKN pe2sl17JG0XgHKyowe0OYvXVwWd7MsBigkyCzV5jcHWAT9u5Qo+cENk1UszHCnXs31Vq WRLDVgdWBFqGduVA/pc+50cicEDbFUQp4I3ol1Cko+/5gF4U4zps1V5MCiUIF3jfGpBv SLm8PxpsaKjqurI02fXQCRv1Q80HWOHZJZ/KmlsVcErmXTVmRZqU/jO8DadmlDV/gu8q WV7u2TtY4WIltewnDZP/n0HHruICGKjuQNYPevLzJ99UvSbIddwyZTpR1OI8+oOq7OJM fVPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744985505; x=1745590305; 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=oV06jOcGhgL3zQiSdJCinxggWnUr0Aa60E9KHFCFYe8=; b=ehU5NxToiad1OtV2BGUVdIzbuckyxIGkGVoP7CYSodLNl6b5GVdZcXiv/TnNeY0nuQ EgwGEeRJp41FmPeF3Bn+ABW5CkRBUuJdhn44YUC9qO1jH6qYbuETS8iub3GpsqsObLxu wQiHQ84jqhOerUFiPXAAxyk1eBzDvoEhYXQe/g5k4EmdOeNwThovn+kKoMRNpV6u0jlw O/W+yd4B5o5XnNj8NNYMS2y9kQxz2U0fwiqMGd4Oapidce+mP/BJpdC04k9gEG5zZcgr ebS2lKYSYILEjtd/awWvJwObIAGBbv01s1fbMasVLNYKyV0TYTBVE+nu/fUtIpoAmNnl /BpQ== X-Gm-Message-State: AOJu0YzRaGYqnp6Ko1MuGpYoxM/sGIFzdlfnVctKHvS19tDAlF1DRbsG pqlYOC3yk/qiWfwNNenE5aKkT3FDT47uQC6DpzfxjYV/6nfb7WZLortro8q1K1kVLIPN6M45+Uc kLMO0+Q== X-Gm-Gg: ASbGncvk+H14m72uagxtRWIWy1l8i55sGov32nCqDMyfo0JxWXGzLdeWjCPBQ//gv1Q Y/PDe9TXO3uTNEZGx6V41WzgwILSTXc2imfqk6gMGQVznT7bVe0LfrmlOYvijqCOBSWyx873BPD xWmz1z6PfvxmeHGRPQ3l+5sl7jYsn/C88tStyBsIZDTLRvyZcrMO8lt8TKVk3yOF5cGkeVPujgM i55rH3ijFdtlOAgE0CPlfSaTOpXp+ZeYY1YFuIP56GRMwUNJVCP6XEE+sRbWtTqhrt2bcLCdGwe PvR2UarlAeXy5TvtLQ7FWlvbpP4hnX5bUFQby+KL8Uc3eXNZng== X-Received: by 2002:a05:6000:2281:b0:39c:1257:c7a3 with SMTP id ffacd0b85a97d-39efbb23ac3mr2319711f8f.59.1744985505265; Fri, 18 Apr 2025 07:11:45 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:1526:5ffd:d63c:cc85]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4406d5bbcc3sm23734385e9.19.2025.04.18.07.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Apr 2025 07:11:44 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Tom Rini Subject: [PATCH v6 15/17] test: cmd: add test for spawn and wait commands Date: Fri, 18 Apr 2025 16:09:43 +0200 Message-ID: <20250418141114.2056981-16-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250418141114.2056981-1-jerome.forissier@linaro.org> References: <20250418141114.2056981-1-jerome.forissier@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Test the spawn and wait commands. Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas --- (no changes since v1) test/cmd/Makefile | 1 + test/cmd/spawn.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/cmd/spawn.c diff --git a/test/cmd/Makefile b/test/cmd/Makefile index 8596c5ad753..595e4cfcada 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -39,3 +39,4 @@ obj-$(CONFIG_CMD_WGET) += wget.o endif obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o endif +obj-$(CONFIG_CMD_SPAWN) += spawn.o diff --git a/test/cmd/spawn.c b/test/cmd/spawn.c new file mode 100644 index 00000000000..8f48f5ee25c --- /dev/null +++ b/test/cmd/spawn.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Tests for spawn and wait commands + * + * Copyright 2025, Linaro Ltd. + */ + +#include +#include +#include +#include + +static int test_cmd_spawn(struct unit_test_state *uts) +{ + ut_assertok(run_command("wait; spawn sleep 2; setenv j ${job_id}; " + "spawn setenv spawned true; " + "setenv jj ${job_id}; wait; " + "echo ${j} ${jj} ${spawned}", 0)); + console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + ut_asserteq_ptr(uts->actual_str, + strstr(uts->actual_str, "1 2 true")); + + ut_assertok(run_command("spawn true; wait; setenv t $?; spawn false; " + "wait; setenv f $?; wait; echo $t $f $?", 0)); + console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + ut_asserteq_ptr(uts->actual_str, + strstr(uts->actual_str, "0 1 0")); + ut_assert_console_end(); + + return 0; +} +CMD_TEST(test_cmd_spawn, UTF_CONSOLE);