Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1qOlcL-0000ab-Pv for mharc-grub-devel@gnu.org; Wed, 26 Jul 2023 17:00:21 -0400 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 1qOlcK-0000aD-Dj for grub-devel@gnu.org; Wed, 26 Jul 2023 17:00:20 -0400 Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOlcI-0003zo-Ip for grub-devel@gnu.org; Wed, 26 Jul 2023 17:00:20 -0400 Received: by mail-vs1-xe35.google.com with SMTP id ada2fe7eead31-440b66adc81so118881137.1 for ; Wed, 26 Jul 2023 14:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20221208.gappssmtp.com; s=20221208; t=1690405217; x=1691010017; 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=gZ7PtCRe3ABVsRCZrVazSiCrnSQRZbmiIKswXf7if4s=; b=0m4Ik6U5Qg/KUBdzNw2wzT2XJQHxZil6D+IvyNOogH8sNF9aVXZ9+LeDnMDtLIxJ4q 7kfo0DpLw4QPCe7HG2Btk1wxvEgHUCmfv/nlgWu773RwyB97FtBHC748Iuxh0wBXkBiv N2vBSXEtlNyQbidRnj3jBJU472JuzZmbqo+4sC6OCt4TKLdx6EpG8tnwc7YN1c6C6CIC jGl7Z89vwt8qbtbXtfr1ZqfZF6qB8zFiYoc3S55KR/Lo8CoZxWwZka+S36VTgxZZ47J1 uxja0CahA3ExC7bLaV+ZhQmzOqGmPVloL8b/WGsxMTdsDIsvrRwPT+TiMwpU6gYaNUv+ co4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690405217; x=1691010017; 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=gZ7PtCRe3ABVsRCZrVazSiCrnSQRZbmiIKswXf7if4s=; b=IdYNWqlEjMQ4VdkBz0tdKWT39Vb8cVE1g5RAFwW8tVykH4oRjEhrFlFHLRwSx9F5wN +IyEY6pxtbqTNzVhubqKOspoUI2Ul5+zulcpxldDIFAMGfmqLIls3Kodtesn4CMKhny3 stprfHVtG2MaaxdOGBnlwSpxKQHfloVcQ96OkPpcIV8Evoj0YbyVEJwSAyHGpmsx3L9W jWHPISBuPmwl9lm6zGcbTIp/w2KSHvRKU7ubEN4KoAf/Uj9boDJwpasHaYa1aa3h/J4k Xl4v0LpQ8LVeiZzuw3N7c4RM4Q921OFxx1WMAdVE904XkPHxfw+qMW7tcTW8bVoPYqBU IQQg== X-Gm-Message-State: ABy/qLbfIZRlFgw/Qv8xVMFoDxOUqCpODzJUeSQls50nxrHjQ2pJ/HSE kwZ35/OnsCZW24V71b0cOrVeBmOGRI1FQ/2logA= X-Google-Smtp-Source: APBJJlHVeL5pN5oZLwTIhMwVOeMwhjsEiUi14okG+a0QRwurIGMK79ZgqXaDMNtN1vztGcHnRXD4mg== X-Received: by 2002:a05:6102:2e1:b0:443:9248:340f with SMTP id j1-20020a05610202e100b004439248340fmr349401vsj.7.1690405217246; Wed, 26 Jul 2023 14:00:17 -0700 (PDT) Received: from localhost.localdomain ([37.218.244.249]) by smtp.gmail.com with ESMTPSA id k16-20020a9f30d0000000b00786e3afb765sm14506uab.0.2023.07.26.14.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 14:00:16 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Peter Jones , Glenn Washburn Subject: [PATCH 3/4] tests: Add efienv_test for testing efi-export-env and efi-load-env Date: Wed, 26 Jul 2023 16:00:01 -0500 Message-Id: <3966eba4a32bf20e5413134653ef8f05c3c9f888.1690405064.git.development@efficientek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::e35; envelope-from=development@efficientek.com; helo=mail-vs1-xe35.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2023 21:00:20 -0000 Signed-off-by: Glenn Washburn --- Makefile.util.def | 6 +++++ tests/efienv_test.in | 57 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 tests/efienv_test.in diff --git a/Makefile.util.def b/Makefile.util.def index 1e9a13d3e348..a7cf53111221 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1172,6 +1172,12 @@ script = { common = tests/help_test.in; }; +script = { + testcase = nonnative; + name = efienv_test; + common = tests/efienv_test.in; +}; + script = { testcase = nonnative; name = grub_script_gettext; diff --git a/tests/efienv_test.in b/tests/efienv_test.in new file mode 100644 index 000000000000..8ae8c2893d53 --- /dev/null +++ b/tests/efienv_test.in @@ -0,0 +1,57 @@ +#! @BUILD_SHEBANG@ +# Copyright (C) 2023 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-efi) + ;; + # Skip Non-EFI platforms, as this test does not apply + *) + exit 77;; +esac + +test_script() { + cat <<'EOF' + efienv_test_var_val="#1 some \\$test value." + + if [ "$efienv_test_var" == "$efienv_test_var_val" ]; then + echo TEST PASSED + else + efienv_test_var="XXX${efienv_test_var_val}" + efi-export-env efienv_test_var + efienv_test_var=erased + efi-load-env + + if [ "$efienv_test_var" != "XXX${efienv_test_var_val}" ]; then + echo TEST FAILED + halt + fi + + efienv_test_var="${efienv_test_var_val}" + efi-export-env efienv_test_var + reboot + fi +EOF +} + +output=$(test_script | "${grubshell}" --modules="efienv,halt" | tail -n1) +if [ "$output" != "TEST PASSED" ]; then + exit 1 +fi -- 2.34.1