From patchwork Tue Oct 15 11:34:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez via B4 Relay X-Patchwork-Id: 13836230 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD5541EABC3 for ; Tue, 15 Oct 2024 11:35:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728992110; cv=none; b=qqabeFQOOGshg/D5r2BI7UsK9rYcIJ3n/oQJzWRMysmYr/R3NJi7v3FZ7l1NcnZhIzWiHR77bkbwWDImwPlwo7flA7IrRR8bsv6DHIwUFGizDjo/i5/k6zaPVzFPVri82FTiSPdYYi1PrEjbNOdO4nU9IA5YB80HGfd0xxbJ2eo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728992110; c=relaxed/simple; bh=G+PJPhJoQaCVMhqXPvh5JF1gEBeQkx2MxWn2IlLIzjw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hsRx+qcKv5foD+T9fnJE93+8tERwAqDsg1UXI5BNT7cRUjobnE9l/5pA2SIyP+RrezmTiqWbnfBrTsFTi3FoaBwYTcIhD59QZwhktqnx6qPrgEDAcPEPA95Q/ZDlZVQxc79nMfIWaFclSzuV5F9Qw6j08b8hCURrrL2htHf/LkQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NxzLtha+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NxzLtha+" Received: by smtp.kernel.org (Postfix) with ESMTPS id BD918C4CED1; Tue, 15 Oct 2024 11:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728992110; bh=G+PJPhJoQaCVMhqXPvh5JF1gEBeQkx2MxWn2IlLIzjw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=NxzLtha+scne0H/cCtCFMsbEiAA5lQx6buD9/KRrpPkM0HWm4KON2JWdjEpvyLYFQ l72NNAKLyTsruFxwhiQWn2fwcJ+whN6z7HFOsI/DETYPZo6EpeqkpAGh5IE8Wnwe3H 9T+jrzAoT0aCir6/5jBtdzN24ge0Z8rgL7s6SAVLNr4GNVuPgHFyppXHLRNO64fICd qhUhvt/7NyGeCB3QAhMN0Lv1tw9xq5Za5p2ji+9Xeh5+O/iNWsPkSN07Zev+jZI7cj FF7+DYBaX3n4IshP9sgCev5lFnb1mjdLV3U8KEWS1iiWgkuTcM5myM+xk77YKygVy8 BfDd6ihYxsV/Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B429DCFC293; Tue, 15 Oct 2024 11:35:10 +0000 (UTC) From: Daniel Gomez via B4 Relay Date: Tue, 15 Oct 2024 13:34:55 +0200 Subject: [PATCH 5/5] guestfs: bringup: add debug mode Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241015-bringup-guestfs-debug-v1-5-bd74c0c31412@samsung.com> References: <20241015-bringup-guestfs-debug-v1-0-bd74c0c31412@samsung.com> In-Reply-To: <20241015-bringup-guestfs-debug-v1-0-bd74c0c31412@samsung.com> To: kdevops@lists.linux.dev, Luis Chamberlain Cc: "Daniel Gomez (Samsung)" , Daniel Gomez X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728992109; l=2391; i=da.gomez@samsung.com; s=20240621; h=from:subject:message-id; bh=WZwxchjtEQrknS8F+lFGpB+NBAHq3BDvOI2VdkRBVAE=; b=QHvmE+dvCaP2yQ2MZqSYtuPGIbPIOPpoXOe2bB108A7dX5DDyrUjUFqFbw4IPppXY4VXuMSlU dA+vpOhliagBjpukH/nTtVDJRFjPureyN/SNXV/PURIvXZlmTWFHlou X-Developer-Key: i=da.gomez@samsung.com; a=ed25519; pk=BqYk31UHkmv0WZShES6pIZcdmPPGay5LbzifAdZ2Ia4= X-Endpoint-Received: by B4 Relay for da.gomez@samsung.com/20240621 with auth_id=175 X-Original-From: Daniel Gomez Reply-To: da.gomez@samsung.com From: Daniel Gomez To be able to run bringup_guestfs.sh script in bash debug mode: 1. disabled 2. set -x 3. set -euxo pipefile From set manual: -x Print commands and their arguments as they are executed. -e Exit immediately if a command exits with a non-zero status. -u Treat unset variables as an error when substituting. -o option-name Set the variable corresponding to option-name: pipefail the return value of a pipeline is the status of the last command to exit with a non-zero status, or zero if no command exited with a non-zero status Signed-off-by: Daniel Gomez --- kconfigs/Kconfig.guestfs | 21 +++++++++++++++++++++ scripts/bringup_guestfs.sh | 8 ++++++++ 2 files changed, 29 insertions(+) diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs index a804c8fce2fd48049bbd6a7954abff547e041a19..2ebd7987b66a0ebdf601eb30307e1296876957d3 100644 --- a/kconfigs/Kconfig.guestfs +++ b/kconfigs/Kconfig.guestfs @@ -203,4 +203,25 @@ config VIRT_BUILDER_OS_VERSION to get a list of operating systems and versions supported by guestfs. +choice + prompt "Guestfs bringup debug mode" + default GUESTFS_BRINGUP_DEBUG_DISABLED + +config GUESTFS_BRINGUP_DEBUG_DISABLED + bool "Disabled" + help + Disables bringup debug. + +config GUESTFS_BRINGUP_DEBUG_0 + bool "set -x" + help + Enables 'set -x' when running scripts/guestfs_bringup.sh. + +config GUESTFS_BRINGUP_DEBUG_1 + bool "set -euxo pipefile" + help + Enables 'set -euxo pipefile' when running scripts/guestfs_bringup.sh. + +endchoice + endif # GUESTFS diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh index 54d8d92dcf2ff5f1de2099cbff785866c9f1c27d..eb506b9c1b7b2105f443ce0b4194dcfa9fb5a476 100755 --- a/scripts/bringup_guestfs.sh +++ b/scripts/bringup_guestfs.sh @@ -5,6 +5,14 @@ source ${TOPDIR}/.config source ${TOPDIR}/scripts/lib.sh +if [[ "${CONFIG_GUESTFS_BRINGUP_DEBUG_0+x}" && ${CONFIG_GUESTFS_BRINGUP_DEBUG_0} == "y" ]]; then + set -x +fi + +if [[ "${CONFIG_GUESTFS_BRINGUP_DEBUG_1+x}" && ${CONFIG_GUESTFS_BRINGUP_DEBUG_1} == "y" ]]; then + set -euxo pipefail +fi + export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI # On systems using system sesion, ensure that we start the default