From patchwork Tue Feb 25 16:34:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 868126 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f56:0:b0:38f:210b:807b with SMTP id cm22csp389358wrb; Tue, 25 Feb 2025 08:37:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXE0K8SDWQDbK+Kci8ZxZJ+13PwzUjWddrV1u1sEfYOYPkB6GHNlLmoE7TfLmxMMTWSJVKxqw==@linaro.org X-Google-Smtp-Source: AGHT+IGqMw8KCIWFWF6yQO0DCkYpAYGzvVjBwrvub24gbGxXuGp4FlVAdDH2rETsT99+9BPX3nAG X-Received: by 2002:a05:6000:4021:b0:38d:d0ca:fbad with SMTP id ffacd0b85a97d-38f70799a67mr17255753f8f.14.1740501429485; Tue, 25 Feb 2025 08:37:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1740501429; cv=none; d=google.com; s=arc-20240605; b=eXrI3Bk33VO8kzw+5D0VkvaTvbchhtd0BxkttwTb55ruVfYx0Kw9R5RJ4Dhhxk+ohX oZ4Lb0i7syBb9uQZCiM5vJj0WbPC/b7CPHLgQTWoAlCwncXR6LcJC7GBJeypPXYhZNLj qaERcR1gkRv8nrJn9Dfu5DtUTwREInjhloaXVGE+IEpMC/wPJhUxtG21k+nd3yLGSBRE YaOhCTJnoYiEC5ROTUUzglw6o8TJaFpF/9+rLNwStHetkCIRUyhIeo/FM+kBvyuJijq9 oS1lpW9SbOAcMDNAFNxV3PXeblRz6miOc5El9jNlfzAMzrwJAF7l6ZugNMwOwnjgoizk VZCg== 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=TgqKz0JnkEMJXv2dl1r5sJ8K6KK0LVfIjcCRnaqavds=; fh=UXi5gUnwqAkJNiukY9dZPo8O1bj7wfbxhZ7gyd0YbGk=; b=NtHYaIvGl1tpVaQj7jz65Hg+Nvrt3u3WEjNWv4M4sY1cLcUC7nd1JtcchTAY8fcJbT boQbir970brLCg0MqCdbGYry4q3uDpxWkFkrv6rAb2To4uy0jbcvkrWpNsXzD0dBJLd8 sR4fDyhsEmQGjZs54aY4UTAAIS8KtI08zAM2PZArlp4+geoidGLhzqzQtOdwnUc4tbxM 3EZmEfN3UYbZsNd4wdZKBpd75Pt4jvfikooHvgzpVcMa9yRDWwHrWB8R2BEkS6LDmlsU LBNlh/0eQtY+ENVbUEyf8ft5SMrU5188CnKlLLkIYKT0CVBiblbb+dE5kq2XsNjd/X8r HxWg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yNFg9R6d; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id ffacd0b85a97d-390cd8e70ebsi1301710f8f.583.2025.02.25.08.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 08:37:09 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yNFg9R6d; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 8577381113; Tue, 25 Feb 2025 17:35:34 +0100 (CET) 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="yNFg9R6d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5B89D810F5; Tue, 25 Feb 2025 17:35:31 +0100 (CET) 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-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 1FCF080FED for ; Tue, 25 Feb 2025 17:35:29 +0100 (CET) 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-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43998deed24so55550485e9.2 for ; Tue, 25 Feb 2025 08:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740501328; x=1741106128; 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=TgqKz0JnkEMJXv2dl1r5sJ8K6KK0LVfIjcCRnaqavds=; b=yNFg9R6dvkTBzUlJS/VmE27ik17qunBPKGbFXqFOAGN2fwdp5vjzzRUW/mb+QyYdgP YU0eSfqVpFeHAxR4glHU/7kNI0leOVYrW+exvvlTfsN4eWEpDc52MmgntZY/oUzjO2aa BoRHKPII+jmM3d7qb6ZVWr2JqB/Ix3YfsvuwHAWhMD3nGLkN5ivHvPalSdTgDgLhiVN3 0Ji1QMoyA5ZFjzIn+FikkeRJpwNaUEMrePMuZ5sYBDOBXcvYb93ikd5GGJN2aorb7ttG r+TwAevUMYjLMleTcJRj1eTX1HwuPWY+oxxeqAczb4E6MmN9oWsusKP79f+Q0wFA6A5G WNhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740501328; x=1741106128; 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=TgqKz0JnkEMJXv2dl1r5sJ8K6KK0LVfIjcCRnaqavds=; b=aeoAuWOe1WUKzUT8s589qC6wQNese605afizc2PSoboHQfGRPBxU4XoZMDuyApUuiU AFpMdkw58YX71hSbdf/L2UQSJl959rGIF5YYxO7H50KYomI6yaPjkPf4bvRs2e9WYh8C utFq1VoO/41cKGuYiW9GqJe3FcG0Bmd+3q8rvy2lUq1QLKWHQwLXZuyEp7z+QsHYQi71 vNuJFeVDY8xqLHiiHTzfjyCIuOANw5iBnkxiF/z6RcKCPcdguscEb6E4rBmB4I4Us82N y0oErxfTco9JNI8u92JwqHDjum4JA51Xi3TInj2nGLwcSNX/hI1iXNvSyQjcWd2JNKbC t5Ag== X-Gm-Message-State: AOJu0YxmSVysqaueYaqu5EdAJ3E8PNEr0icZV0CjwNqSRcd+9sJxnz/c C7J+DKEQJJaL/cGuVNhh/niR3SEJmVxGmvmSno0aYTQ8dQ7/j1/enCndN7MkpHE1iPtpjRk11Lg HHyCSOw== X-Gm-Gg: ASbGncsFybhG2KAProLkAkWeYxT+w14YkeClTqkLnBlQ2Iwm7m5YCT8+QbYEZpMnwYf Q/VOr2r02Ci5Ws6TPz9US2gc6AA5GWtyXu+7TlBe6aEQ/CUXiRsPwB2/OxQs7mksCI/uzeaZw1X UKXYDW3GDGttWxOwXuhCm7XyrNmeA5NNVNo/7qeOmW7EGMhqeKNmKCQMktzj1hVvudz5V0qPj01 1TTXnHH0oYmTRgDKYiyQrQOa42Fhz3FGvaSsPZzGj2yfi5xzKZzom0SUlGil1etKkjAFg+7xUnd PON9nQa/rQqixjbB9KJv72LnouF3wquv/yg= X-Received: by 2002:a05:6000:1a85:b0:38d:ba81:b5c2 with SMTP id ffacd0b85a97d-38f70854e1amr14897628f8f.47.1740501328441; Tue, 25 Feb 2025 08:35:28 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b02ce735sm146356195e9.3.2025.02.25.08.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 08:35:28 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Jerome Forissier , Tom Rini , Simon Glass , Heinrich Schuchardt Subject: [PATCH v2 14/14] test: dm: add test for spawn and wait commands Date: Tue, 25 Feb 2025 17:34:40 +0100 Message-ID: <2f17fd7ec21b59218d5bf88f045c13db08f906ca.1740499185.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: 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 --- test/cmd/Makefile | 1 + test/cmd/spawn.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 test/cmd/spawn.c diff --git a/test/cmd/Makefile b/test/cmd/Makefile index d8a5e77402d..cf47f04851c 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..5e0770858c0 --- /dev/null +++ b/test/cmd/spawn.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Tests for spawn and wait commands + * + * Copyright 2025, Linaro Ltd. + */ + +#include +#include +#include +#include +#include + +static int dm_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; +} +DM_TEST(dm_test_cmd_spawn, UTF_CONSOLE);