From patchwork Fri May 31 13:45:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 800698 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1739A158D94 for ; Fri, 31 May 2024 13:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163147; cv=none; b=pGj0yyhBu3OgWs7rjhTAyRJLLjFwVri8tMMvZ+GmF1KMr9tJr6BW1Oo2bp0ce/PX/LVksR40DM/OTZB/jqrfsPlcjYJ8h262zOYDfD/SSn3sgrXGU/X4Gxkb3XDbybG0Sxj21UNhQRnJSAZQTlGHmYgpdRrDzpZ6CFRa4TefUHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163147; c=relaxed/simple; bh=T3mqbJsEL2DHaXLq5FgSvXP7ajoZr3K0KqddgUtsdoo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gaVvK51kemRSboZfZYXGXtTmmnhcvx3yAR7ukj5BNRDedGHxRWizfgCijiihnYGXHMds9A8mgRBwIIre8jEDnzAQKXBeoP3tfrX4A9lVLGA/ZG6iMVR+kPxXRQbo4prcSCf7NsbwQmQHE3K69F1uc442N/crJo2boRb2cCabbks= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IBBg9ybt; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IBBg9ybt" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-702342c60dfso1165844b3a.2 for ; Fri, 31 May 2024 06:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717163145; x=1717767945; darn=vger.kernel.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=jJuZo+l1lk09vQCMGRvmseDxU4hqCIXkMglT3iTZgcE=; b=IBBg9ybtI6ofiOF8PLL3cgwZSauSS3hQpsMBkdyM551fFg60JICH1mqpkvAtVK4O3q y709gxf9lEecFZaQKrwDFDab8Df3Pzpt6JiCl49HqzuoHPbUpc77oAg3gsd7scCocILQ j16cY4suKTbMD1uk/z/bLcvunHFs1rpcXoDZwENyh1UweqPI0UkfAsrYYerZybAbrs7E UoJ5Ou+8YakGeAAFf54/AATGARrors4xEERHi15n/Dx3Ac3EVaZlo9AxKlXTbhab85Fa UfDgRvoDfP26LqAvKnnkc37bmCUUuewXkTAEqezlYWAzOEkO/j/ydwuRIxzvF22sD1f0 Rskw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717163145; x=1717767945; 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=jJuZo+l1lk09vQCMGRvmseDxU4hqCIXkMglT3iTZgcE=; b=DReiRvEI+zHZNckFcqwO0R26lk4e26n2HKahy0kV8Um89YbY0v2//175A1eWlo1uh/ Up9YG2J++SYndc+cFkmayXgyNSF7afAy8IqJuc4A9VeEmO4yq8DuaGsXdkqRCefDwrki +hwVfOegcDuTMUrgbYnyb74fuiTBpsbrSlVsE5y6LR9XJKKyGJmxDYEfrOEPdUF6z499 i/+UZCdhm0+35f9R/sz4+Pvo5q9/EvRICinwHisZl/pod7XurIchATE/l7yrW5TsMhdt iKBbvOlOlnf4f6LfG0uNO0/Ufvx4G8DDG4XahbOKypU4F56wZlriHt/GQuv1Yt47H1Tc Kb4Q== X-Gm-Message-State: AOJu0YzzrfD0gjuDHptc1/PFl+Z8NxojiHw/U3mIDJnCyx6t6TeuNn2I xQ+TB0mW6nr5WGUQ3kgC96XAX5HQ4qXWCEcxCtLQzZwbab/UOEIzrD+zmw== X-Google-Smtp-Source: AGHT+IGXx5BXNWh6SjDbp6FIvQlsKUjFjuxv/mmGSxrBvTjinsofnV6CBg13ydMLTMlpz1TmYAFU3A== X-Received: by 2002:a05:6a00:1c94:b0:6f3:854c:dee0 with SMTP id d2e1a72fcca58-7024788e9c1mr1765307b3a.21.1717163145247; Fri, 31 May 2024 06:45:45 -0700 (PDT) Received: from rigel.home.arpa (110-175-132-92.tpgi.com.au. [110.175.132.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423c7bf0sm1389825b3a.42.2024.05.31.06.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:45:44 -0700 (PDT) From: Kent Gibson To: linux-gpio@vger.kernel.org, brgl@bgdev.pl Cc: Kent Gibson Subject: [libgpiod][PATCH 1/8] tools: tests: don't mix string and array Date: Fri, 31 May 2024 21:45:05 +0800 Message-Id: <20240531134512.443850-2-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com> References: <20240531134512.443850-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix shellcheck SC2145[1] - argument mixes string and array. Separate the command from the array of arguments to avoid mixing. Signed-off-by: Kent Gibson [1] https://www.shellcheck.net/wiki/SC2145 --- tools/gpio-tools-test.bash | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash index 521556c..34ea744 100755 --- a/tools/gpio-tools-test.bash +++ b/tools/gpio-tools-test.bash @@ -174,18 +174,24 @@ gpiosim_cleanup() { run_tool() { # Executables to test are expected to be in the same directory as the # testing script. - output=$(timeout 10s $SOURCE_DIR/"$@" 2>&1) + cmd=$1 + shift + output=$(timeout 10s "$SOURCE_DIR/$cmd" "$@" 2>&1) status=$? } dut_run() { - coproc timeout 10s $SOURCE_DIR/"$@" 2>&1 + cmd=$1 + shift + coproc timeout 10s "$SOURCE_DIR/$cmd" "$@" 2>&1 DUT_PID=$COPROC_PID read -t1 -n1 -u ${COPROC[0]} DUT_FIRST_CHAR } dut_run_redirect() { - coproc timeout 10s $SOURCE_DIR/"$@" > $SHUNIT_TMPDIR/$DUT_OUTPUT 2>&1 + cmd=$1 + shift + coproc timeout 10s "$SOURCE_DIR/$cmd" "$@" > "$SHUNIT_TMPDIR/$DUT_OUTPUT" 2>&1 DUT_PID=$COPROC_PID # give the process time to spin up # FIXME - find a better solution From patchwork Fri May 31 13:45:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 801143 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E732E7440B for ; Fri, 31 May 2024 13:45:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163157; cv=none; b=q9n2h51akrO64TmRV4Iz6pPYy1cFfNEaQx7ZcW2WTbeXmoucjIZ6FHFtUzBNriBdeNuBFjNkQ6twRQdOJeevkHcOFHWu3za7VCoJ+HNyVoZu/fabX1n3TeTFiswu1CSo+gM1MnfqfKoeD6uavCU8qIvXneMGzrb5DBZK6NbtE+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163157; c=relaxed/simple; bh=NGfG57z/OQC1Ci0PhSg3RgSmTPhNEZQtYwxKsaiT/jw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cuJVEdNn1F+N0RaJgRrJZKZBzhSgqTpAN4RBGjl6WEFxaS7dt+2kpmbns3cQvDE8OCnsLe7HPEh+h7afeM2hYKQxht5uDYvnDfTURPSBcBUD+wvJGv9lJrHW5e8Wy+bQ2cE40ds/BgF4Z4BkXY4NZxWZRGpar2OvcIIWh/sfnRA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JmGaiY2J; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JmGaiY2J" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-70234843a67so1592203b3a.1 for ; Fri, 31 May 2024 06:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717163155; x=1717767955; darn=vger.kernel.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=fmU4EjHVCF4lsbIw7+P55SIWxIwS7BZv9Nx9m9Mjglk=; b=JmGaiY2J0HSg3Efqzl34YZGS6ltPv7c6wlQ/gZ9v4poDAhFR6RfQbLL2um91/56+WW uxF4iw/BeT5Yx9X++P/lMYj2XgaIIDSIrNWVEhKkthaRRcyy5VJbCRFu4rSu0n3+qKST +byFTtgLdr+zGZQwiih0zQvG9q7+N0PTu/kc2JdE7WtYkPtzLDgHx/c/pc/n9F++3Jza RHEuPmxQUVMCCN8TuV/bu+7GyrZE3xD6KZrlWTNt2ilj3nK7a96OrN6HgpWIbHOYtMgJ C+GBqnRISiUGU41lF2m4IgwVAbzofASo2ziqy7V0cPtyCRKwnlyfARFsPpELiOHN+v/l nlaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717163155; x=1717767955; 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=fmU4EjHVCF4lsbIw7+P55SIWxIwS7BZv9Nx9m9Mjglk=; b=rRsDfMJyKgmO5NnJy4AzbJr7vkSL4CHay3FHZwSBuU18+n9BjdLLd5OPKgdBbSTWoH BtxlCpKh5Hd+53ZS37tdRxC/KHfVEIYoBdtZd7L/OlzgbNs80Gb94m6Wez65XXHEnceh 3yKymBaDZBwzrNCc/HdSA1CZSJclikm1z/Brp1CNTKfPd8TkSfhcFr01794Rq2vgghxg CiEnJcVvL5jScZJjr86Q7pdh44310JTF8nOlB6wHbjn8cfbc8LCwKyhgz6taGsZ/U7EI iNeZxiXYPGZFSuCWa6l5sBSwlqsw83U/tQZxWFT9REdHDP1DBX1rf/y/eUzS5VDriO1H EKrA== X-Gm-Message-State: AOJu0Yzbak1FsZfQjyzCH0vz3rR2gcpVcUl3saDhIT8p3XQLtBYG8774 s1PiJmVdJlYjt5CuhJRA5oIfw/PhMH/wjd0xG+9gQ9b1isgvkr1qBFxg+Q== X-Google-Smtp-Source: AGHT+IGR0I2ZkSxfw3OkJP1qnM1a10D9WOh76Kcj7xwh1PdWPNVuCBHbaKBqWOBHuh50plUF1WNalQ== X-Received: by 2002:a05:6a00:27a1:b0:6fe:23eb:6cb6 with SMTP id d2e1a72fcca58-702478c70cfmr2059223b3a.25.1717163154789; Fri, 31 May 2024 06:45:54 -0700 (PDT) Received: from rigel.home.arpa (110-175-132-92.tpgi.com.au. [110.175.132.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423c7bf0sm1389825b3a.42.2024.05.31.06.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:45:54 -0700 (PDT) From: Kent Gibson To: linux-gpio@vger.kernel.org, brgl@bgdev.pl Cc: Kent Gibson Subject: [libgpiod][PATCH 2/8] tools: tests: don't declare and assign separately Date: Fri, 31 May 2024 21:45:06 +0800 Message-Id: <20240531134512.443850-3-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com> References: <20240531134512.443850-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix shellcheck SC2155[1] - declare and assign separately to avoid masking return values. Signed-off-by: Kent Gibson [1] https://www.shellcheck.net/wiki/SC2155 --- tools/gpio-tools-test.bash | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash index 34ea744..6bbb06c 100755 --- a/tools/gpio-tools-test.bash +++ b/tools/gpio-tools-test.bash @@ -49,7 +49,8 @@ output_is() { num_lines_is() { [ "$1" -eq "0" ] || [ -z "$output" ] && return 0 - local NUM_LINES=$(echo "$output" | wc -l) + local NUM_LINES + NUM_LINES=$(echo "$output" | wc -l) assertEquals " number of lines:" "$1" "$NUM_LINES" } @@ -73,16 +74,18 @@ gpiosim_chip() { for ARG in "$@" do - local KEY=$(echo $ARG | cut -d"=" -f1) - local VAL=$(echo $ARG | cut -d"=" -f2) + local KEY VAL + KEY=$(echo "$ARG" | cut -d"=" -f1) + VAL=$(echo "$ARG" | cut -d"=" -f2) if [ "$KEY" = "num_lines" ] then echo $VAL > $BANKPATH/num_lines elif [ "$KEY" = "line_name" ] then - local OFFSET=$(echo $VAL | cut -d":" -f1) - local LINENAME=$(echo $VAL | cut -d":" -f2) + local OFFSET LINENAME + OFFSET=$(echo "$VAL" | cut -d":" -f1) + LINENAME=$(echo "$VAL" | cut -d":" -f2) local LINEPATH=$BANKPATH/line$OFFSET mkdir -p $LINEPATH @@ -92,10 +95,11 @@ gpiosim_chip() { echo 1 > $DEVPATH/live - local chip_name=$(<$BANKPATH/chip_name) - GPIOSIM_CHIP_NAME[$1]=$chip_name - GPIOSIM_CHIP_PATH[$1]="/dev/$chip_name" - GPIOSIM_DEV_NAME[$1]=$(<$DEVPATH/dev_name) + local CHIP_NAME + CHIP_NAME=$(<"$BANKPATH/chip_name") + GPIOSIM_CHIP_NAME[$1]=$CHIP_NAME + GPIOSIM_CHIP_PATH[$1]="/dev/$CHIP_NAME" + GPIOSIM_DEV_NAME[$1]=$(<"$DEVPATH/dev_name") } gpiosim_chip_number() { @@ -3044,14 +3048,16 @@ die() { # Must be done after we sources shunit2 as we need SHUNIT_VERSION to be set. oneTimeSetUp() { test "$SHUNIT_VERSION" = "$MIN_SHUNIT_VERSION" && return 0 - local FIRST=$(printf "$SHUNIT_VERSION\n$MIN_SHUNIT_VERSION\n" | sort -Vr | head -1) + local FIRST + FIRST=$(printf "$SHUNIT_VERSION\n$MIN_SHUNIT_VERSION\n" | sort -Vr | head -1) test "$FIRST" = "$MIN_SHUNIT_VERSION" && \ die "minimum shunit version required is $MIN_SHUNIT_VERSION (current version is $SHUNIT_VERSION" } check_kernel() { local REQUIRED=$1 - local CURRENT=$(uname -r) + local CURRENT + CURRENT=$(uname -r) SORTED=$(printf "$REQUIRED\n$CURRENT" | sort -V | head -n 1) From patchwork Fri May 31 13:45:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 800697 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05BB0158D94 for ; Fri, 31 May 2024 13:46:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163167; cv=none; b=JmDy77teK1wqdn+jJP4t6Voc0saqzAP8wLVGIAkYelplqEc22MQxkjnVorFB+//EkBtVibOaPvZGH1V3iNzSLrVZrzV1jbuvax7ijaUwszvV9KFyYWnZl/ECVBFk7Dzhj6RhII2PUrFIAQKiwIL8k66KwszxZ0bzn5yZC0lQTYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163167; c=relaxed/simple; bh=WKoAOV3M7PYHhaqpaN+WB9VQGR+1EoeNAx1Xh8K0VNw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aZ+91S3W0qPD/M9RAXfJjS/lkIbOgQ2Lfn0krIF17na0G6Umx4q6oRHDNQi4UGCYVkX24SvEomrDKa+AP04yV/0GFjMZqPqb8Vra5N6pFAJrqNzKlvfKhxF9akj56T9vaRgOkVaDNlaXcFz2G6JatAwE5iJZhtAA6Is8oOPrtW0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TY5/DVqE; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TY5/DVqE" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-6bce380ebc2so1751149a12.0 for ; Fri, 31 May 2024 06:46:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717163165; x=1717767965; darn=vger.kernel.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=iUsW6gce8JKpIVixxeRmB2OvvfmVKzURUafhLHRlJp4=; b=TY5/DVqEr50xyD4sRm35lC8gOsr9IuBI/BQTZKRi91No10JSPipvQRErBQoU2/V09q mWlbghDzOLzxZ28inCQMtLhKBxO5YY2Q4fNBhRmDS8D7Sl8jZs/UVoqXwzmL6xaVR8JI tE/veXoWkyGO9OUGid7lTwY+uy5rQKeHEJ3y99ibGwXsl6+WHCy/rh6pnmCfkxttzjK8 4v0JqnsW0JIgywv8UUSmchGAmgYf1K2B5mMkc+FIQa/aL7RiEitw1H+nC4gqZx87yu7s R5/aj3FHCHDxPNN6lVV5ryfgGkBErAFuwPwrpqG13WYO9jrtXTKeTrBqTy96YOVr906j 4VLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717163165; x=1717767965; 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=iUsW6gce8JKpIVixxeRmB2OvvfmVKzURUafhLHRlJp4=; b=h6HuhTs7OHuvcFNif5a7CVPBDQ9RCE1ZDFoOru+XZ9R9hun/oOlp7cQGz59CuwPJRM wS3GFJDqmYlddpBjG820VUscHt3DqCYW7dQMkCkaQiyy9gqJVajTGVgCkD5+JsOIWrih u3V4MO74+dVRTNTfjSc8RVUZ97KK2BBZGayEKqemcxOP7NboZovooBDtWHaDXEBMM8xB d4Yeb1IKeNXMybma2KZUfTNa8fD2ABFLjO5UehHZBgix7vQDFAH9N5bn46ekjlyv6lXr mvRhQop5GdIdWddG5tGj9ZYIxtRnwXtvZWfFK5wz9WfV90MU8/vZZ9eRe/51WRLGF1Yo w2Cg== X-Gm-Message-State: AOJu0YynBX9hU+sGSvhmnDBJdp4xQu9X3ViuWwNNJvWKZ4RZr1SCN0ca RsmafQjJq6iH+x9MyhvyUKjiJL9FygdbmkWU6CwSljEWlwGgSVSUj2z3+w== X-Google-Smtp-Source: AGHT+IG+Q6TfLaXUbL6AtHEwIndzTbEErJqs7aWjoeRBoVpe76jyp8vbK+b1zSEUbQsMFBNyRGvnAA== X-Received: by 2002:a05:6a21:6da1:b0:1af:d0bc:d149 with SMTP id adf61e73a8af0-1b26f0e60d1mr2578018637.6.1717163165109; Fri, 31 May 2024 06:46:05 -0700 (PDT) Received: from rigel.home.arpa (110-175-132-92.tpgi.com.au. [110.175.132.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423c7bf0sm1389825b3a.42.2024.05.31.06.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:46:04 -0700 (PDT) From: Kent Gibson To: linux-gpio@vger.kernel.org, brgl@bgdev.pl Cc: Kent Gibson Subject: [libgpiod][PATCH 3/8] tools: tests: fix unused variables Date: Fri, 31 May 2024 21:45:07 +0800 Message-Id: <20240531134512.443850-4-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com> References: <20240531134512.443850-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix shellckeck SC2034[1] - foo appears unused. Prefix intentionally unused variables with "_" and remove variables not actually used. Signed-off-by: Kent Gibson [1] https://www.shellcheck.net/wiki/SC2034 --- tools/gpio-tools-test.bash | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash index 6bbb06c..b065296 100755 --- a/tools/gpio-tools-test.bash +++ b/tools/gpio-tools-test.bash @@ -146,7 +146,7 @@ gpiosim_wait_value() { local CHIPNAME=${GPIOSIM_CHIP_NAME[$1]} local PORT=$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value - for i in {1..30}; do + for _i in {1..30}; do [ "$(<$PORT)" = "$EXPECTED" ] && return sleep 0.01 done @@ -159,7 +159,6 @@ gpiosim_cleanup() { local NAME=${GPIOSIM_APP_NAME}-$$-$CHIP local DEVPATH=$GPIOSIM_CONFIGFS/$NAME - local BANKPATH=$DEVPATH/bank0 echo 0 > $DEVPATH/live find "$DEVPATH" -type d -name hog -exec rmdir '{}' '+' @@ -229,13 +228,13 @@ dut_readable() { } dut_flush() { - local JUNK + local _JUNK lines=() output= unset DUT_FIRST_CHAR - while read -t 0 -u ${COPROC[0]} JUNK + while read -t 0 -u "${COPROC[0]}" _JUNK do - read -t 0.1 -u ${COPROC[0]} JUNK || true + read -t 0.1 -u "${COPROC[0]}" _JUNK || true done } From patchwork Fri May 31 13:45:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 801142 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97D0615B574 for ; Fri, 31 May 2024 13:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163176; cv=none; b=FHbP7X38GqPHtMqMxcJJOxDYXik3ywDT03l/CC5TGKK6bypjNVCTIfG6+LFeTTj9fMboy0HE2D1Y7elh8JFJyg/suHaH29CjC+R2Y/qMn4dI6q/8iKt8jgFVW+/H/3HedSR2vO+YyPz0LuYdbZYcR2K3Ay5QQmpV7bfScGck7Ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163176; c=relaxed/simple; bh=/+VKyMqIOrhJnMcMdOELthAXPJAImQVP4GZzuywDFXQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j/wCeTr8VTRxtQgsKpYWuttY9RLfhANdXfmon2H77rSi9hFIYo9J/PNfg1lIPXk1Ko4FkbrMPfdBnIFiXL/k2XjGDS2bK9o4Ex28ik+Q6BZJmkaNmk4ZkwScsKGU9jq7rtLlBvf5fm5Jjniv4+GuQ92EfzDmtiENR6sIXZW4um0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WHuh8QA9; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WHuh8QA9" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7024e7e55f7so333478b3a.2 for ; Fri, 31 May 2024 06:46:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717163175; x=1717767975; darn=vger.kernel.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=5cDT+9KL6OTD9Q+Muf87UzyaX3xPLn/xrLDM03cnzMs=; b=WHuh8QA9rYOM/bkaXETQRrj1kHPnlPTxxQWzEQqxrH6NGn3DUhv+AQ7Gu+iOaIKSxX /7cb9blkrUwdEpoVBn0MjxmafInq4IxBiyI6lAmLRjQPuktCd+7YLY+JZzefow4tAmjo +R0TmrePbcYQMegzv+jP/oTmK/hYoUQ+fdtH0p6P/5URfibEz1o5+XUhXaATI3vpG3Wc RjKq+BQN/vV5jwYwQukc4TQcy5xfQAwcyBdXdRjV6JISj27vGetLwvIUCXNKv6kJkeMI hn7y83KNIllg7lVW3OPDDAmfguKv7AuNfkObqbgEX0BXPPpJS3Pc1WZgW6cb3BCndPnX tyCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717163175; x=1717767975; 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=5cDT+9KL6OTD9Q+Muf87UzyaX3xPLn/xrLDM03cnzMs=; b=b39ZgDDb3PLXQjSdIi+hIHnAUIF9z316MTp6G6Ri7s9vgP7J2v9uIR1oaZj68eDZj4 UquqbgiTkbToGJWWyNx05AOL24UosaC0GTTf4k4DTSfo8VH+CA8QJULPxrsrnD1PLhXy Ny/QxWe2Z2FtjxW1lD0UJQnuS4cjlgTh62iCON8urB65b5aNAtWlApZMgDLy4U6c/QsF 5dJcJrSU4lcLVklWKjBtnKxAdei0n5Zfvg4di/FCoqk9MnO4za/uAEKw9sVxzRqvLwX6 57ZidRGxudnQk0HwjfhMojgIC3WKZ11c6GYJQPOuvlkT1+hnJ/ZWnYClpthw8nnK+oEZ AljA== X-Gm-Message-State: AOJu0Yz3QYaampa9/WVHvDqm3quWuur6kXiLqWLxxrWE+ka9g5oIe+/+ 4U/tKRBxLCRa0uSS0CtIxntZQOZotFUp/EkVDSZYzov9kZiAzOJqgXCmpA== X-Google-Smtp-Source: AGHT+IEWCGWzMDXa0eTH6ZsfdKk6kPa4jHoowLc8365GGUe2hGgvkYQAOBfUB6L0ahUOnU/d+jJWyQ== X-Received: by 2002:a05:6a20:d42f:b0:1af:adbf:2a16 with SMTP id adf61e73a8af0-1b26f2cc972mr1634801637.43.1717163174717; Fri, 31 May 2024 06:46:14 -0700 (PDT) Received: from rigel.home.arpa (110-175-132-92.tpgi.com.au. [110.175.132.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423c7bf0sm1389825b3a.42.2024.05.31.06.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:46:14 -0700 (PDT) From: Kent Gibson To: linux-gpio@vger.kernel.org, brgl@bgdev.pl Cc: Kent Gibson Subject: [libgpiod][PATCH 4/8] tools: tests: use read -r to avoid mangling backslashes Date: Fri, 31 May 2024 21:45:08 +0800 Message-Id: <20240531134512.443850-5-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com> References: <20240531134512.443850-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix shellcheck SC2162[1] - read without -r will mangle backslashes. Signed-off-by: Kent Gibson [1] https://www.shellcheck.net/wiki/SC2162 --- tools/gpio-tools-test.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash index b065296..efe558b 100755 --- a/tools/gpio-tools-test.bash +++ b/tools/gpio-tools-test.bash @@ -188,7 +188,7 @@ dut_run() { shift coproc timeout 10s "$SOURCE_DIR/$cmd" "$@" 2>&1 DUT_PID=$COPROC_PID - read -t1 -n1 -u ${COPROC[0]} DUT_FIRST_CHAR + read -r -t1 -n1 -u "${COPROC[0]}" DUT_FIRST_CHAR } dut_run_redirect() { @@ -211,7 +211,7 @@ dut_read_redirect() { dut_read() { local LINE lines=() - while read -t 0.2 -u ${COPROC[0]} LINE + while read -r -t 0.2 -u "${COPROC[0]}" LINE do if [ -n "$DUT_FIRST_CHAR" ] then @@ -234,7 +234,7 @@ dut_flush() { unset DUT_FIRST_CHAR while read -t 0 -u "${COPROC[0]}" _JUNK do - read -t 0.1 -u "${COPROC[0]}" _JUNK || true + read -r -t 0.1 -u "${COPROC[0]}" _JUNK || true done } @@ -242,7 +242,7 @@ dut_flush() { dut_regex_match() { PATTERN=$1 - read -t 0.2 -u ${COPROC[0]} LINE || (echo Timeout && false) + read -r -t 0.2 -u "${COPROC[0]}" LINE || (echo Timeout && false) if [ -n "$DUT_FIRST_CHAR" ] then LINE=${DUT_FIRST_CHAR}${LINE} From patchwork Fri May 31 13:45:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 800696 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5975158D94 for ; Fri, 31 May 2024 13:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163188; cv=none; b=XlRbPAAbICFHhJ3SfHSv1pv0p7FCpTvQm646Q1LDO2LAw4Hqih35kGrhE7zmX1FLVG9itsOnpd94oVeeUkFcYJeHuC6VD/B6hZRrsgFByT21lDEVTDCrnkBoroZAvX4aMSIyCqEzvb7oK50tKdkAtHnBAyYlGZf8aQPF1Yv4Q/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163188; c=relaxed/simple; bh=iQI12VGrrQ7bidskxCr3tmWla+bQCId1T7T84nkrhPI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PrPosuheE0qTMdDKi9G64YNLwHlkOsvatLYIm0aNTSAuLx7pVo+qAvhFXSweUmwozOYJcPsAUWTay3F9UNKyloufgmyv/pfvPJXYdHh6RODXLt6VRpLaAf4tVUr5cJ+ycgrqMR2FPFpqJrCg404JSDrq39PB42dSX3UnrJVzFds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cPwnP8Kz; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cPwnP8Kz" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-7024ac84ae4so490408b3a.2 for ; Fri, 31 May 2024 06:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717163185; x=1717767985; darn=vger.kernel.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=hWcjVYMFQW3YUmLSfWMWMDe71MWRA7Shwzl5K0jFh0Y=; b=cPwnP8KzYxi1XqMsv+fZLX6sOas/b4xerLkrWfMHEQBZNacASEzHscOtnch33nbD9e aOpLUNlx07yw7GKMQBJxCt09wNREkyEXQRSSgn04AaMb9CzjJXgohA468/oVwpTVLqIv lenfM2Wm3+c+KKkHSlfEZZoVdv0ma0w6TtMqV2v3nUGIPzLF+IxoYTx3aCkAGjON7B6p JwNas6T8y9jhp8y3Xgiahxrkep1jgjExDaqFrEKJDAeJ4fDIDKg3XLn1sZZMKAszbp99 UPjp/lQD2QncPcFp62FmQvYQPdxF/TE/41KnRNWchMCtdaCgoc5tRZ/5ma97KMBGCrLh hZSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717163185; x=1717767985; 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=hWcjVYMFQW3YUmLSfWMWMDe71MWRA7Shwzl5K0jFh0Y=; b=XPCSQ11/Tw4mp89gnwGPA65S9/NW86clom5pyAnZqpMoJSsa8uTM5f5Zg8xGZnrMIs BFEikgdYUhu7uUttx9mWsb1E9owcM2ftsbkJ0Pgkrk49U+8tlPqEL5t40Oawkwd/BiVD 9F/upSselchFf6GZLMXZSQgbJFBHydYMH2bqQTqjoF/knXVrMYtO9sG2u2St6kEcaFb6 Uqc34JKJJILpi4R3Hh9l8PD2TrNWobTKq5wKdrk2f5IolJa2Aj86P59T4mopbYQsIwXc O6Zp+JgmiUuBfXFUHZgmCXDRWU39mbiJjLFEA4TGhBRm8yRiTst1Xhp7qlbpmyPd18I1 s+yQ== X-Gm-Message-State: AOJu0Ywc+zpTdfUxCwhfI/lI+1AWbveGqt+67Z6ZdHUhK3/Z0QpAAaIW 3a6eUB5eigc48duG8409wnWAOwr+qj3od4Cv0kKWr+MIkH6ZFLr6oZDZqw== X-Google-Smtp-Source: AGHT+IGBMXekJ5DNCiOZv4vevo+tEeOmbwFQgRYCfMNC1v6li1UMu2yzjcu4NOd48dLr2sii0v7VRw== X-Received: by 2002:a05:6a20:7495:b0:1b2:565a:4b2d with SMTP id adf61e73a8af0-1b26f25de26mr2307553637.38.1717163185022; Fri, 31 May 2024 06:46:25 -0700 (PDT) Received: from rigel.home.arpa (110-175-132-92.tpgi.com.au. [110.175.132.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423c7bf0sm1389825b3a.42.2024.05.31.06.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:46:24 -0700 (PDT) From: Kent Gibson To: linux-gpio@vger.kernel.org, brgl@bgdev.pl Cc: Kent Gibson Subject: [libgpiod][PATCH 5/8] tools: tests: don't use variables in printf format string Date: Fri, 31 May 2024 21:45:09 +0800 Message-Id: <20240531134512.443850-6-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com> References: <20240531134512.443850-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix shellcheck SC2059[1] - don't use variables in the printf format string. Signed-off-by: Kent Gibson [1] https://www.shellcheck.net/wiki/SC2059 --- tools/gpio-tools-test.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash index efe558b..d9930f1 100755 --- a/tools/gpio-tools-test.bash +++ b/tools/gpio-tools-test.bash @@ -3048,7 +3048,7 @@ die() { oneTimeSetUp() { test "$SHUNIT_VERSION" = "$MIN_SHUNIT_VERSION" && return 0 local FIRST - FIRST=$(printf "$SHUNIT_VERSION\n$MIN_SHUNIT_VERSION\n" | sort -Vr | head -1) + FIRST=$(printf "%s\n%s\n" "$SHUNIT_VERSION" "$MIN_SHUNIT_VERSION" | sort -Vr | head -1) test "$FIRST" = "$MIN_SHUNIT_VERSION" && \ die "minimum shunit version required is $MIN_SHUNIT_VERSION (current version is $SHUNIT_VERSION" } @@ -3058,7 +3058,7 @@ check_kernel() { local CURRENT CURRENT=$(uname -r) - SORTED=$(printf "$REQUIRED\n$CURRENT" | sort -V | head -n 1) + SORTED=$(printf "%s\n%s" "$REQUIRED" "$CURRENT" | sort -V | head -n 1) if [ "$SORTED" != "$REQUIRED" ] then From patchwork Fri May 31 13:45:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 801141 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2EF2159568 for ; Fri, 31 May 2024 13:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163197; cv=none; b=JQzM0PJ892ejby8joyiyXnCpIkRZU3EQAQ16ZUeA4bU30ZmuxwHlwP3YOINzwR1bB2UhMXKQd1VyXOEO5woEoVZKVSdTAomSChxfxEx4L21gr18fL+Ve4jpZIbSjidHJYTS4fuqWeVEk1fjg80bK8v91hoFdGyJbm9q9uJ/AGMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163197; c=relaxed/simple; bh=NBybXA3GPGcTsruVKqkCPXEx9amWzl4H+PcxLDgEpOg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l4vSLtN3DKcu6r/XQZSNXoJCb0EiGRSCIutjTePeevQktVlDFsJruh1NUiDZVvJ+G9SCYcuPblwT7kfUt8y73bnWfOYIXIAXhcpjgOTUKtPsHKkxt1FC2zJ1vt9jHfqwcrkDqKKBbEm8gOqapC5Zczs6kq3xlRAADGN5rblFAw8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Qy9Q/CIt; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qy9Q/CIt" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-7022e0cd0aeso1948259b3a.0 for ; Fri, 31 May 2024 06:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717163196; x=1717767996; darn=vger.kernel.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=NuWd89i6TAstntq44G+EqiFFc/8djIoOeImzcuc1tI0=; b=Qy9Q/CItjAhD3wD5vwncMDPykpFGxEG5IhMKYJdStL1kTT57bcWkUBrAOiLzi0LrX/ o2hMdHi2z7Nr5tzTSrSZmZcGWxF6ddwuF2TDaoOrQq8j7cXtRYkeAqJz5v+4ZNKG5WKX RDgPHcwQU2QFThT/oVH+NGOANp0uQ6uNU8XPt4r+ZjvYHAzXO52R4J+wMLzRoa0PJp56 mlWB9nXnHT/4imOPbIm5W7F0EY7b7Vjuik83ARzH0nWIYxuTXtjUGZZs5mBsm2p3gRn1 KPdDwpu62OS41Vb0XtGaY0ChoTMkuEs/WEMbASBT0iRowCdF+eJ3igS2MUTmWB2OACIw 0B7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717163196; x=1717767996; 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=NuWd89i6TAstntq44G+EqiFFc/8djIoOeImzcuc1tI0=; b=kU3ohn2OJ1z/eOZkPkRZTClZFx4MUeobFvfHjQ1eJEY1JMOTQILi3PjLBXGlWntBrJ Vn5Yv8wHtdN6nfSC/og2XjUj8VlHFqBAzBB8DRo0cLqlMgCTc6zbCxDHB51xI3Ip1LCn 7+xRGI4KKRkneiiO8QT0I6d/nt0wzF6K3xRs4LH3u+tfbuxce826WSNFMnJtqThay++w Wv5jr4v3KfRX0b9WZMeUkxFll49wCTXxi3wjs6iKpxw/AR1xuVGUozwEhU5aSA4o6mUx vitOdXd5id/VFIyl8ZBfgHI5CY3sGtcaKvHNI0uIP0R8EEshOy1lvD3cmQf7cHqCxl86 8xWw== X-Gm-Message-State: AOJu0Yyz+AWvCUP8imGaSCPT5536ewaY7xZJeMEVFB0zg0foPbztg4LW PdOdq5BVMLPpLxl6E5FHTpyZ6Pnsa10AdID7sxQmY+q++rKhoxy/DyvgNQ== X-Google-Smtp-Source: AGHT+IHjXUKhmisuBWcCQ21+THhc7dWgfg7BnuKi6FVbXh2/cLtlg5MxNO2kfUX4yvUcn1hX1Q28mw== X-Received: by 2002:a05:6a00:22cd:b0:6e5:43b5:953b with SMTP id d2e1a72fcca58-7024780448bmr2146017b3a.14.1717163195742; Fri, 31 May 2024 06:46:35 -0700 (PDT) Received: from rigel.home.arpa (110-175-132-92.tpgi.com.au. [110.175.132.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423c7bf0sm1389825b3a.42.2024.05.31.06.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:46:35 -0700 (PDT) From: Kent Gibson To: linux-gpio@vger.kernel.org, brgl@bgdev.pl Cc: Kent Gibson Subject: [libgpiod][PATCH 6/8] tools: tests: check exit code directly Date: Fri, 31 May 2024 21:45:10 +0800 Message-Id: <20240531134512.443850-7-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com> References: <20240531134512.443850-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix shellcheck SC2181[1] - check exit code directly. Signed-off-by: Kent Gibson [1] https://www.shellcheck.net/wiki/SC2181 --- tools/gpio-tools-test.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash index d9930f1..83b05ec 100755 --- a/tools/gpio-tools-test.bash +++ b/tools/gpio-tools-test.bash @@ -3069,8 +3069,7 @@ check_kernel() { check_prog() { local PROG=$1 - which "$PROG" > /dev/null - if [ "$?" -ne "0" ] + if ! which "$PROG" > /dev/null then die "$PROG not found - needed to run the tests" fi From patchwork Fri May 31 13:45:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 800695 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62943158DD7 for ; Fri, 31 May 2024 13:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163207; cv=none; b=mclZuAvfIGq3of24MstNRBLAdmd3Hi4H0GOwnO5OJKvlxk1YTUFDIlPGBuiQ4XEZoBVsftdTGSKpmzu+TqbYvrQhpCOaMO47dAC/yO/FBEAaSdEE7TvYLCnzNXSJSA55hA8dQ4DqTQfJGX2VAPlO5ocfp8w5mY/YAZMbLKySwRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163207; c=relaxed/simple; bh=3NSFlM50L4A3RxVIELWOIuBlocMdJAFv/6xGAHutO+Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SoAkoKmGlGDVJbD1rYgz6X2XBksTGXHIbB5bPMGIdooei3TgVsnOpdzAnBi/orDj1V7uU/1irziFpbNSUm0qeQxcr4iBf1ouTi8X+gZxAMyrH0+89eigSrDJ9flrULQzqnyah9CJgXsHwlD8wlRbFFVab1JCApERwN4TVDwSHpI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=alnIWfwu; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="alnIWfwu" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-7022e0cd0aeso1948446b3a.0 for ; Fri, 31 May 2024 06:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717163205; x=1717768005; darn=vger.kernel.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=DErrST+C3yVnqrJU+UI475MP73jBv5E3rTTr51hfLbs=; b=alnIWfwu3dKI6pYrSM+4xhKx2rGgn4N0th1qKYZGRsGS4j9nDkv2Sd9rolKn4b8x97 PTE2XjGjh2aTWPKyhX0e6qxZyk7erUfxwK8iPpkPk7bN2imnwgQCpkjCtwyVYOr/UyMN 60CB1hzUkqb88kd0olI65fsb3d83eeRcR702rsupc6kCEc2cJrfmJRdMpNLNnFgiqSe5 znA/8n19ClsHOn5ueos0YlNK4eyYoc+D++7+32RjCrr5VTnX/aNZSmoDNxlmylpPoZe+ Sy66D73BbwbwVMD9nD+fT8nq+70wbU6WhKWru0nc0OOwx+A+bZ/A9yQWHcQmz1Nmkahg Et0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717163205; x=1717768005; 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=DErrST+C3yVnqrJU+UI475MP73jBv5E3rTTr51hfLbs=; b=fhcFrl5BkSg5ThdSigg3+nXHotPWfpSH7/NF9LjkV1ADWde/3dinBWEmWb7cLhisbs MH5QDSdz2cemS9Ndln3ciJe+gJrKgkiDE+qlMlvv53NMrkppdSrkcicA2/OMW6bwi8lv yhR1j6VfkeyVO4UoJl/yOVNiiH8DzWSrMd+h+LXfD1oR7QE0E81prykGH4IUmgQy1/0r GQOfC8vQ/YfH7SzhGIEyCfyQ/rySnsKDdnJelrqYv37nOhoLrEbpHugmjCxO06IIeFyT uB//VxxAjiv18XEhoxD8hLZzEx8I+Rm0sWhTfch/0fZo0oBenI73hIoObUDR21O8udJD BQ/A== X-Gm-Message-State: AOJu0YypG2iOntXx4Eq/iveYuYDwEnZeQ4yUQYh5Er14+9H5YVb6soaW t6WiKXu1FGnmT5VdVE0C7osRlE6I4Vmmwirf3+qZDz8SCxbsMBg5Ipxvlg== X-Google-Smtp-Source: AGHT+IHi164pJEPKH+xuDVW9dPTDFemJoDkktCr0xYujxatiUYkXMRtL6lvbCWglGuA4qT6BHp8Fcw== X-Received: by 2002:a05:6a20:3ca3:b0:1b0:3698:3d4 with SMTP id adf61e73a8af0-1b26f205940mr2242063637.28.1717163205324; Fri, 31 May 2024 06:46:45 -0700 (PDT) Received: from rigel.home.arpa (110-175-132-92.tpgi.com.au. [110.175.132.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423c7bf0sm1389825b3a.42.2024.05.31.06.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:46:45 -0700 (PDT) From: Kent Gibson To: linux-gpio@vger.kernel.org, brgl@bgdev.pl Cc: Kent Gibson Subject: [libgpiod][PATCH 7/8] tools: tests: shellcheck don't follow sourced file Date: Fri, 31 May 2024 21:45:11 +0800 Message-Id: <20240531134512.443850-8-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com> References: <20240531134512.443850-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix shellcheck SC1091 - not following. Use a directive to prevent shellcheck complaining about sourcing shunit2, which we don't care to check. Signed-off-by: Kent Gibson [1] https://www.shellcheck.net/wiki/SC1091 --- tools/gpio-tools-test.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash index 83b05ec..4551dc2 100755 --- a/tools/gpio-tools-test.bash +++ b/tools/gpio-tools-test.bash @@ -3087,4 +3087,5 @@ modprobe gpio-sim || die "unable to load the gpio-sim module" mountpoint /sys/kernel/config/ > /dev/null 2> /dev/null || \ die "configfs not mounted at /sys/kernel/config/" +# shellcheck source=/dev/null . shunit2 From patchwork Fri May 31 13:45:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 801140 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7E80158DD3 for ; Fri, 31 May 2024 13:46:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163220; cv=none; b=UAaX4LkctjEOqVJodjGEUXkWpKqw8ws2EZObk2R0MoVDOwIse0oITxKUUAEDg2yRuaEyXlw/B5HmHj6LRtT8B6ZLgAseAdFVZxJYMn2XAqoSho8OXRdrTpUg4Y5d3rX/A3NyNvtB7XrGBoO/4c5veGaOcZZb5uRcknMYeFOBvL0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717163220; c=relaxed/simple; bh=wBtzdqpTTozPEPEnw/wgsAFt9qLH1ilX5rgey+D3SA0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CF2gM3gsO4plqbwt+4q21XGlquQFrrzN5FAICA3lyqyQCWuE7ubAS5uyhCofi6D4PqJy7q4KfAXycYny7qRrzyOBgsRfRYw1lzHGg/IFHM1LEN8pyrAEdGhLDlVH5KWDZIpuyW+yXF9dqP3gkBSyskmfPqYHoG02SIfqvpHPeD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MFXG/UbD; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MFXG/UbD" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7023df18408so1150095b3a.2 for ; Fri, 31 May 2024 06:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717163217; x=1717768017; darn=vger.kernel.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=YtK+bUtW9uIGb0Hnd0PPnRpVdm3589um/xCQGtmI/k4=; b=MFXG/UbDV7C1YkRsfttjH32waO7VNmG0KiSrY8PBDQBPqnWLVjDDRhj/07lqD0ux8D HKbCOOj6XBRNRbZ57rL5Dp+fqAbE/xBCjeRsd0uMzE/pyQSbJam0tVu82UpPZRNNZTLg GZmx2+SbdzgvE/7k0RdDPNSprVqD0EwBFhjoQzNb6ivyesXepdufBvaDSLXbaVXU2Tgd vXULxBqM9sf4iyyG3e2pdlt8PFlBMdc34G0cwpQNRnYPhzfWZdQt7gwiX0lwSzigDHAh 2A+eIrQKzXXW09MjTUZ69ZHek/4CJCX18PohIEqhqwwgBfKWRWJ78l03dIbKznrMloO5 W1kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717163217; x=1717768017; 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=YtK+bUtW9uIGb0Hnd0PPnRpVdm3589um/xCQGtmI/k4=; b=bDLTjLaTLFcW8XtU19KK/lNfdVl5ss4KL9QYGN7nwVshx4eei7VWciBoAIYyGTQxW5 lyVw4qm8Yj6qiF5qbjHPfYYuMjUhefcD7rDcvftqoacZZhDMtoKJC1MP3yr8Eahc4JFB D7DGc0bPh68aEzQb3WObeUNtY9PDamgcCgikagkU16VH+XAjmjpvei9E530FQQhOLCk0 Mr/9LnQalZ2BgfKC6qMWHdpD1q6lzy6REbjQzzVuV0age2/sCkKFfNJDZNcK8m0f08Q8 46yiGNnClFGGOz5aNcIPJLMiAPIAV4SGv4wQzpmlcyF7RuRhHbCwvHOZHTOU7h4ZaVPx SeUg== X-Gm-Message-State: AOJu0YyycDrXb0Czi2BnTzIiKv4D1rPbCa5bR5GwJf7ozOaA8csuC8LY f7K20uw28lFusNyy+bE+1rGhwE89nIRwCn2ywBPrs9dhLIxcquXEOFZZzg== X-Google-Smtp-Source: AGHT+IEw2oAQYFqLIOMFD4e1rrWgvv+/Agr/5ZkKYIMy12iDbL2SObccVPKn9zde4gCDZhEFmy7Zfw== X-Received: by 2002:a05:6a21:6d91:b0:1af:d647:3108 with SMTP id adf61e73a8af0-1b26f0f01f9mr2183889637.2.1717163216249; Fri, 31 May 2024 06:46:56 -0700 (PDT) Received: from rigel.home.arpa (110-175-132-92.tpgi.com.au. [110.175.132.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423c7bf0sm1389825b3a.42.2024.05.31.06.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:46:55 -0700 (PDT) From: Kent Gibson To: linux-gpio@vger.kernel.org, brgl@bgdev.pl Cc: Kent Gibson Subject: [libgpiod][PATCH 8/8] tools: tests: avoid splitting and globbing Date: Fri, 31 May 2024 21:45:12 +0800 Message-Id: <20240531134512.443850-9-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531134512.443850-1-warthog618@gmail.com> References: <20240531134512.443850-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix shellcheck SC2046[1], SC2068[2], SC2068[3] and SC2206[4], all of which are related to avoiding word splitting and globbing. Signed-off-by: Kent Gibson [1]https://www.shellcheck.net/wiki/SC2046 [2]https://www.shellcheck.net/wiki/SC2068 [3]https://www.shellcheck.net/wiki/SC2086 [4]https://www.shellcheck.net/wiki/SC2206 --- tools/gpio-tools-test.bash | 398 ++++++++++++++++++------------------- 1 file changed, 198 insertions(+), 200 deletions(-) diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash index 4551dc2..3b93388 100755 --- a/tools/gpio-tools-test.bash +++ b/tools/gpio-tools-test.bash @@ -14,7 +14,7 @@ DUT_OUTPUT=gpio-tools-test-output # once it exits as the COPROC_PID will be cleared. DUT_PID="" -SOURCE_DIR="$(dirname ${BASH_SOURCE[0]})" +SOURCE_DIR=$(dirname "${BASH_SOURCE[0]}") # mappings from local name to system chip name, path, dev name declare -A GPIOSIM_CHIP_NAME @@ -70,7 +70,7 @@ gpiosim_chip() { local DEVPATH=$GPIOSIM_CONFIGFS/$NAME local BANKPATH=$DEVPATH/bank0 - mkdir -p $BANKPATH + mkdir -p "$BANKPATH" for ARG in "$@" do @@ -80,7 +80,7 @@ gpiosim_chip() { if [ "$KEY" = "num_lines" ] then - echo $VAL > $BANKPATH/num_lines + echo "$VAL" > "$BANKPATH/num_lines" elif [ "$KEY" = "line_name" ] then local OFFSET LINENAME @@ -88,12 +88,12 @@ gpiosim_chip() { LINENAME=$(echo "$VAL" | cut -d":" -f2) local LINEPATH=$BANKPATH/line$OFFSET - mkdir -p $LINEPATH - echo $LINENAME > $LINEPATH/name + mkdir -p "$LINEPATH" + echo "$LINENAME" > "$LINEPATH/name" fi done - echo 1 > $DEVPATH/live + echo 1 > "$DEVPATH/live" local CHIP_NAME CHIP_NAME=$(<"$BANKPATH/chip_name") @@ -104,12 +104,12 @@ gpiosim_chip() { gpiosim_chip_number() { local NAME=${GPIOSIM_CHIP_NAME[$1]} - echo ${NAME#"gpiochip"} + echo "${NAME#gpiochip}" } gpiosim_chip_symlink() { GPIOSIM_CHIP_LINK="$2/${GPIOSIM_APP_NAME}-$$-lnk" - ln -s ${GPIOSIM_CHIP_PATH[$1]} "$GPIOSIM_CHIP_LINK" + ln -s "${GPIOSIM_CHIP_PATH[$1]}" "$GPIOSIM_CHIP_LINK" } gpiosim_chip_symlink_cleanup() { @@ -126,7 +126,7 @@ gpiosim_set_pull() { local DEVNAME=${GPIOSIM_DEV_NAME[$1]} local CHIPNAME=${GPIOSIM_CHIP_NAME[$1]} - echo $PULL > $GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/pull + echo "$PULL" > "$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/pull" } gpiosim_check_value() { @@ -135,7 +135,7 @@ gpiosim_check_value() { local DEVNAME=${GPIOSIM_DEV_NAME[$1]} local CHIPNAME=${GPIOSIM_CHIP_NAME[$1]} - VAL=$(<$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value) + VAL=$(<"$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value") [ "$VAL" = "$EXPECTED" ] } @@ -147,20 +147,20 @@ gpiosim_wait_value() { local PORT=$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value for _i in {1..30}; do - [ "$(<$PORT)" = "$EXPECTED" ] && return + [ "$(<"$PORT")" = "$EXPECTED" ] && return sleep 0.01 done return 1 } gpiosim_cleanup() { - for CHIP in ${!GPIOSIM_CHIP_NAME[@]} + for CHIP in "${!GPIOSIM_CHIP_NAME[@]}" do local NAME=${GPIOSIM_APP_NAME}-$$-$CHIP local DEVPATH=$GPIOSIM_CONFIGFS/$NAME - echo 0 > $DEVPATH/live + echo 0 > "$DEVPATH/live" find "$DEVPATH" -type d -name hog -exec rmdir '{}' '+' find "$DEVPATH" -type d -name "line*" -exec rmdir '{}' '+' find "$DEVPATH" -type d -name "bank*" -exec rmdir '{}' '+' @@ -202,9 +202,9 @@ dut_run_redirect() { } dut_read_redirect() { - output=$(<$SHUNIT_TMPDIR/$DUT_OUTPUT) + output=$(<"$SHUNIT_TMPDIR/$DUT_OUTPUT") local ORIG_IFS="$IFS" - IFS=$'\n' lines=($output) + IFS=$'\n' mapfile -t lines <<< "$output" IFS="$ORIG_IFS" } @@ -220,11 +220,11 @@ dut_read() { fi lines+=("$LINE") done - output="${lines[@]}" + output="${lines[*]}" } dut_readable() { - read -t 0 -u ${COPROC[0]} LINE + read -t 0 -u "${COPROC[0]}" LINE } dut_flush() { @@ -253,17 +253,15 @@ dut_regex_match() { } dut_write() { - echo "$@" >&${COPROC[1]} + echo "$@" >&"${COPROC[1]}" } dut_kill() { - SIGNUM=$1 - - kill $SIGNUM $DUT_PID + kill "$@" "$DUT_PID" } dut_wait() { - wait $DUT_PID + wait "$DUT_PID" export status=$? unset DUT_PID } @@ -271,10 +269,10 @@ dut_wait() { dut_cleanup() { if [ -n "$DUT_PID" ] then - kill -SIGTERM $DUT_PID 2> /dev/null - wait $DUT_PID || false + kill -SIGTERM "$DUT_PID" 2> /dev/null + wait "$DUT_PID" || false fi - rm -f $SHUNIT_TMPDIR/$DUT_OUTPUT + rm -f "$SHUNIT_TMPDIR/$DUT_OUTPUT" } tearDown() { @@ -283,7 +281,7 @@ tearDown() { } request_release_line() { - $SOURCE_DIR/gpioget -c "$@" >/dev/null + "$SOURCE_DIR/gpioget" -c "$@" >/dev/null } # @@ -332,21 +330,21 @@ test_gpiodetect_a_chip() { local sim2dev=${GPIOSIM_DEV_NAME[sim2]} # by name - run_tool gpiodetect $sim0 + run_tool gpiodetect "$sim0" output_regex_match "$sim0 \[${sim0dev}[-:]node0\] \(4 lines\)" num_lines_is 1 status_is 0 # by path - run_tool gpiodetect ${GPIOSIM_CHIP_PATH[sim1]} + run_tool gpiodetect "${GPIOSIM_CHIP_PATH[sim1]}" output_regex_match "$sim1 \[${sim1dev}[-:]node0\] \(8 lines\)" num_lines_is 1 status_is 0 # by number - run_tool gpiodetect $(gpiosim_chip_number sim2) + run_tool gpiodetect "$(gpiosim_chip_number sim2)" output_regex_match "$sim2 \[${sim2dev}[-:]node0\] \(16 lines\)" num_lines_is 1 @@ -354,7 +352,7 @@ test_gpiodetect_a_chip() { # by symlink gpiosim_chip_symlink sim2 . - run_tool gpiodetect $GPIOSIM_CHIP_LINK + run_tool gpiodetect "$GPIOSIM_CHIP_LINK" output_regex_match "$sim2 \[${sim2dev}[-:]node0\] \(16 lines\)" num_lines_is 1 @@ -373,7 +371,7 @@ test_gpiodetect_multiple_chips() { local sim1dev=${GPIOSIM_DEV_NAME[sim1]} local sim2dev=${GPIOSIM_DEV_NAME[sim2]} - run_tool gpiodetect $sim0 $sim1 $sim2 + run_tool gpiodetect "$sim0" "$sim1" "$sim2" output_regex_match "$sim0 \[${sim0dev}[-:]node0\] \(4 lines\)" output_regex_match "$sim1 \[${sim1dev}[-:]node0\] \(8 lines\)" @@ -441,7 +439,7 @@ test_gpioinfo_a_chip() { local sim1=${GPIOSIM_CHIP_NAME[sim1]} # by name - run_tool gpioinfo --chip $sim1 + run_tool gpioinfo --chip "$sim1" output_contains_line "$sim1 - 4 lines:" output_regex_match "\\s+line\\s+0:\\s+unnamed\\s+input" @@ -452,7 +450,7 @@ test_gpioinfo_a_chip() { status_is 0 # by path - run_tool gpioinfo --chip $sim1 + run_tool gpioinfo --chip "$sim1" output_contains_line "$sim1 - 4 lines:" output_regex_match "\\s+line\\s+0:\\s+unnamed\\s+input" @@ -463,7 +461,7 @@ test_gpioinfo_a_chip() { status_is 0 # by number - run_tool gpioinfo --chip $sim1 + run_tool gpioinfo --chip "$sim1" output_contains_line "$sim1 - 4 lines:" output_regex_match "\\s+line\\s+0:\\s+unnamed\\s+input" @@ -475,7 +473,7 @@ test_gpioinfo_a_chip() { # by symlink gpiosim_chip_symlink sim1 . - run_tool gpioinfo --chip $GPIOSIM_CHIP_LINK + run_tool gpioinfo --chip "$GPIOSIM_CHIP_LINK" output_contains_line "$sim1 - 4 lines:" output_regex_match "\\s+line\\s+0:\\s+unnamed\\s+input" @@ -494,7 +492,7 @@ test_gpioinfo_a_line() { local sim1=${GPIOSIM_CHIP_NAME[sim1]} # by offset - run_tool gpioinfo --chip $sim1 2 + run_tool gpioinfo --chip "$sim1" 2 output_regex_match "$sim1 2\\s+\"bar\"\\s+input" num_lines_is 1 @@ -508,14 +506,14 @@ test_gpioinfo_a_line() { status_is 0 # by chip and name - run_tool gpioinfo --chip $sim1 2 + run_tool gpioinfo --chip "$sim1" 2 output_regex_match "$sim1 2\\s+\"bar\"\\s+input" num_lines_is 1 status_is 0 # unquoted - run_tool gpioinfo --unquoted --chip $sim1 2 + run_tool gpioinfo --unquoted --chip "$sim1" 2 output_regex_match "$sim1 2\\s+bar\\s+input" num_lines_is 1 @@ -547,7 +545,7 @@ test_gpioinfo_multiple_lines() { local sim1=${GPIOSIM_CHIP_NAME[sim1]} # by offset - run_tool gpioinfo --chip $sim1 1 2 + run_tool gpioinfo --chip "$sim1" 1 2 output_regex_match "$sim1 1\\s+unnamed\\s+input" output_regex_match "$sim1 2\\s+\"baz\"\\s+input" @@ -563,7 +561,7 @@ test_gpioinfo_multiple_lines() { status_is 0 # by name and offset - run_tool gpioinfo --chip $sim0 bar 3 + run_tool gpioinfo --chip "$sim0" bar 3 output_regex_match "$sim0 5\\s+\"bar\"\\s+input" output_regex_match "$sim0 3\\s+unnamed\\s+input" @@ -652,7 +650,7 @@ test_gpioinfo_with_same_line_twice() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # by offset - run_tool gpioinfo --chip $sim0 1 1 + run_tool gpioinfo --chip "$sim0" 1 1 output_regex_match "$sim0 1\\s+\"foo\"\\s+input" output_regex_match ".*lines '1' and '1' are the same line" @@ -668,7 +666,7 @@ test_gpioinfo_with_same_line_twice() { status_is 1 # by name and offset - run_tool gpioinfo --chip $sim0 foo 1 + run_tool gpioinfo --chip "$sim0" foo 1 output_regex_match "$sim0 1\\s+\"foo\"\\s+input" output_regex_match ".*lines 'foo' and '1' are the same line" @@ -703,7 +701,7 @@ test_gpioinfo_with_lines_strictly_by_name() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # first by offset (to show offsets match first) - run_tool gpioinfo --chip $sim0 1 6 + run_tool gpioinfo --chip "$sim0" 1 6 output_regex_match "$sim0 1\\s+\"6\"\\s+input" output_regex_match "$sim0 6\\s+\"1\"\\s+input" @@ -711,7 +709,7 @@ test_gpioinfo_with_lines_strictly_by_name() { status_is 0 # then strictly by name - run_tool gpioinfo --by-name --chip $sim0 1 + run_tool gpioinfo --by-name --chip "$sim0" 1 output_regex_match "$sim0 6\\s+\"1\"\\s+input" num_lines_is 1 @@ -734,7 +732,7 @@ test_gpioinfo_with_nonexistent_line() { output_regex_match ".*cannot find line 'nonexistent-line'" status_is 1 - run_tool gpioinfo --chip ${GPIOSIM_CHIP_NAME[sim0]} nonexistent-line + run_tool gpioinfo --chip "${GPIOSIM_CHIP_NAME[sim0]}" nonexistent-line output_regex_match ".*cannot find line 'nonexistent-line'" status_is 1 @@ -745,7 +743,7 @@ test_gpioinfo_with_offset_out_of_range() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioinfo --chip $sim0 0 1 2 3 4 5 + run_tool gpioinfo --chip "$sim0" 0 1 2 3 4 5 output_regex_match "$sim0 0\\s+unnamed\\s+input" output_regex_match "$sim0 1\\s+unnamed\\s+input" @@ -782,12 +780,12 @@ test_gpioget_by_offset() { gpiosim_set_pull sim0 1 pull-up - run_tool gpioget --chip ${GPIOSIM_CHIP_NAME[sim0]} 1 + run_tool gpioget --chip "${GPIOSIM_CHIP_NAME[sim0]}" 1 output_is "\"1\"=active" status_is 0 - run_tool gpioget --unquoted --chip ${GPIOSIM_CHIP_NAME[sim0]} 1 + run_tool gpioget --unquoted --chip "${GPIOSIM_CHIP_NAME[sim0]}" 1 output_is "1=active" status_is 0 @@ -799,7 +797,7 @@ test_gpioget_by_symlink() { gpiosim_set_pull sim0 1 pull-up - run_tool gpioget --chip $GPIOSIM_CHIP_LINK 1 + run_tool gpioget --chip "$GPIOSIM_CHIP_LINK" 1 output_is "\"1\"=active" status_is 0 @@ -811,12 +809,12 @@ test_gpioget_by_chip_and_name() { gpiosim_set_pull sim1 3 pull-up - run_tool gpioget --chip ${GPIOSIM_CHIP_NAME[sim1]} foo + run_tool gpioget --chip "${GPIOSIM_CHIP_NAME[sim1]}" foo output_is "\"foo\"=active" status_is 0 - run_tool gpioget --unquoted --chip ${GPIOSIM_CHIP_NAME[sim1]} foo + run_tool gpioget --unquoted --chip "${GPIOSIM_CHIP_NAME[sim1]}" foo output_is "foo=active" status_is 0 @@ -845,7 +843,7 @@ test_gpioget_multiple_lines() { gpiosim_set_pull sim0 5 pull-up gpiosim_set_pull sim0 7 pull-up - run_tool gpioget --unquoted --chip ${GPIOSIM_CHIP_NAME[sim0]} 0 1 2 3 4 5 6 7 + run_tool gpioget --unquoted --chip "${GPIOSIM_CHIP_NAME[sim0]}" 0 1 2 3 4 5 6 7 output_is \ "0=inactive 1=inactive 2=active 3=active 4=inactive 5=active 6=inactive 7=active" @@ -861,7 +859,7 @@ test_gpioget_multiple_lines_by_name_and_offset() { gpiosim_set_pull sim0 4 pull-up gpiosim_set_pull sim0 6 pull-up - run_tool gpioget --chip $sim0 0 foo 4 bar + run_tool gpioget --chip "$sim0" 0 foo 4 bar output_is "\"0\"=inactive \"foo\"=active \"4\"=active \"bar\"=active" status_is 0 @@ -890,7 +888,7 @@ test_gpioget_with_numeric_values() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioget --numeric --chip $sim0 0 1 2 3 4 5 6 7 + run_tool gpioget --numeric --chip "$sim0" 0 1 2 3 4 5 6 7 output_is "0 0 1 1 0 1 0 1" status_is 0 @@ -906,7 +904,7 @@ test_gpioget_with_active_low() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioget --active-low --unquoted --chip $sim0 0 1 2 3 4 5 6 7 + run_tool gpioget --active-low --unquoted --chip "$sim0" 0 1 2 3 4 5 6 7 output_is \ "0=active 1=active 2=inactive 3=inactive 4=active 5=inactive 6=active 7=inactive" @@ -937,7 +935,7 @@ test_gpioget_with_pull_up() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioget --bias=pull-up --unquoted --chip $sim0 0 1 2 3 4 5 6 7 + run_tool gpioget --bias=pull-up --unquoted --chip "$sim0" 0 1 2 3 4 5 6 7 output_is \ "0=active 1=active 2=active 3=active 4=active 5=active 6=active 7=active" @@ -954,7 +952,7 @@ test_gpioget_with_pull_down() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioget --bias=pull-down --unquoted --chip $sim0 0 1 2 3 4 5 6 7 + run_tool gpioget --bias=pull-down --unquoted --chip "$sim0" 0 1 2 3 4 5 6 7 output_is \ "0=inactive 1=inactive 2=inactive 3=inactive 4=inactive 5=inactive 6=inactive 7=inactive" @@ -1026,12 +1024,12 @@ test_gpioget_with_lines_by_offset() { gpiosim_set_pull sim0 1 pull-up gpiosim_set_pull sim0 6 pull-down - run_tool gpioget --chip ${GPIOSIM_CHIP_NAME[sim0]} 1 6 + run_tool gpioget --chip "${GPIOSIM_CHIP_NAME[sim0]}" 1 6 output_is "\"1\"=active \"6\"=inactive" status_is 0 - run_tool gpioget --unquoted --chip ${GPIOSIM_CHIP_NAME[sim0]} 1 6 + run_tool gpioget --unquoted --chip "${GPIOSIM_CHIP_NAME[sim0]}" 1 6 output_is "1=active 6=inactive" status_is 0 @@ -1045,12 +1043,12 @@ test_gpioget_with_lines_strictly_by_name() { gpiosim_set_pull sim0 1 pull-up gpiosim_set_pull sim0 6 pull-down - run_tool gpioget --by-name --chip ${GPIOSIM_CHIP_NAME[sim0]} 1 6 + run_tool gpioget --by-name --chip "${GPIOSIM_CHIP_NAME[sim0]}" 1 6 output_is "\"1\"=inactive \"6\"=active" status_is 0 - run_tool gpioget --by-name --unquoted --chip ${GPIOSIM_CHIP_NAME[sim0]} 1 6 + run_tool gpioget --by-name --unquoted --chip "${GPIOSIM_CHIP_NAME[sim0]}" 1 6 output_is "1=inactive 6=active" status_is 0 @@ -1066,7 +1064,7 @@ test_gpioget_with_no_arguments() { test_gpioget_with_chip_but_no_line_specified() { gpiosim_chip sim0 num_lines=8 - run_tool gpioget --chip ${GPIOSIM_CHIP_NAME[sim0]} + run_tool gpioget --chip "${GPIOSIM_CHIP_NAME[sim0]}" output_regex_match ".*at least one GPIO line must be specified" status_is 1 @@ -1076,7 +1074,7 @@ test_gpioget_with_offset_out_of_range() { gpiosim_chip sim0 num_lines=4 local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioget --chip $sim0 0 1 2 3 4 5 + run_tool gpioget --chip "$sim0" 0 1 2 3 4 5 output_regex_match ".*offset 4 is out of range on chip '$sim0'" output_regex_match ".*offset 5 is out of range on chip '$sim0'" @@ -1095,7 +1093,7 @@ test_gpioget_with_same_line_twice() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # by offset - run_tool gpioget --chip $sim0 0 0 + run_tool gpioget --chip "$sim0" 0 0 output_regex_match ".*lines '0' and '0' are the same line" status_is 1 @@ -1107,19 +1105,19 @@ test_gpioget_with_same_line_twice() { status_is 1 # by chip and name - run_tool gpioget --chip $sim0 foo foo + run_tool gpioget --chip "$sim0" foo foo output_regex_match ".*lines 'foo' and 'foo' are the same line" status_is 1 # by name and offset - run_tool gpioget --chip $sim0 foo 1 + run_tool gpioget --chip "$sim0" foo 1 output_regex_match ".*lines 'foo' and '1' are the same line" status_is 1 # by offset and name - run_tool gpioget --chip $sim0 1 foo + run_tool gpioget --chip "$sim0" 1 foo output_regex_match ".*lines '1' and 'foo' are the same line" status_is 1 @@ -1128,7 +1126,7 @@ test_gpioget_with_same_line_twice() { test_gpioget_with_invalid_bias() { gpiosim_chip sim0 num_lines=8 - run_tool gpioget --bias=bad --chip ${GPIOSIM_CHIP_NAME[sim0]} 0 1 + run_tool gpioget --bias=bad --chip "${GPIOSIM_CHIP_NAME[sim0]}" 0 1 output_regex_match ".*invalid bias.*" status_is 1 @@ -1137,7 +1135,7 @@ test_gpioget_with_invalid_bias() { test_gpioget_with_invalid_hold_period() { gpiosim_chip sim0 num_lines=8 - run_tool gpioget --hold-period=bad --chip ${GPIOSIM_CHIP_NAME[sim0]} 0 + run_tool gpioget --hold-period=bad --chip "${GPIOSIM_CHIP_NAME[sim0]}" 0 output_regex_match ".*invalid period.*" status_is 1 @@ -1158,7 +1156,7 @@ test_gpioset_by_name() { test_gpioset_by_offset() { gpiosim_chip sim0 num_lines=8 - dut_run gpioset --banner --chip ${GPIOSIM_CHIP_NAME[sim0]} 1=1 + dut_run gpioset --banner --chip "${GPIOSIM_CHIP_NAME[sim0]}" 1=1 gpiosim_check_value sim0 1 1 } @@ -1167,7 +1165,7 @@ test_gpioset_by_symlink() { gpiosim_chip sim0 num_lines=8 gpiosim_chip_symlink sim0 . - dut_run gpioset --banner --chip $GPIOSIM_CHIP_LINK 1=1 + dut_run gpioset --banner --chip "$GPIOSIM_CHIP_LINK" 1=1 gpiosim_check_value sim0 1 1 } @@ -1176,7 +1174,7 @@ test_gpioset_by_chip_and_name() { gpiosim_chip sim0 num_lines=8 line_name=1:foo gpiosim_chip sim1 num_lines=8 line_name=3:foo - dut_run gpioset --banner --chip ${GPIOSIM_CHIP_NAME[sim1]} foo=1 + dut_run gpioset --banner --chip "${GPIOSIM_CHIP_NAME[sim1]}" foo=1 gpiosim_check_value sim1 3 1 } @@ -1198,7 +1196,7 @@ test_gpioset_multiple_lines() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpioset --banner --chip $sim0 0=0 1=0 2=1 3=1 4=1 5=1 6=0 7=1 + dut_run gpioset --banner --chip "$sim0" 0=0 1=0 2=1 3=1 4=1 5=1 6=0 7=1 gpiosim_check_value sim0 0 0 gpiosim_check_value sim0 1 0 @@ -1213,7 +1211,7 @@ test_gpioset_multiple_lines() { test_gpioset_multiple_lines_by_name_and_offset() { gpiosim_chip sim0 num_lines=4 line_name=1:foo line_name=2:bar - dut_run gpioset --banner --chip ${GPIOSIM_CHIP_NAME[sim0]} 0=1 foo=1 bar=1 3=1 + dut_run gpioset --banner --chip "${GPIOSIM_CHIP_NAME[sim0]}" 0=1 foo=1 bar=1 3=1 gpiosim_check_value sim0 0 1 gpiosim_check_value sim0 1 1 @@ -1238,7 +1236,7 @@ test_gpioset_with_active_low() { gpiosim_chip sim0 num_lines=8 local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpioset --banner --active-low -c $sim0 \ + dut_run gpioset --banner --active-low -c "$sim0" \ 0=0 1=0 2=1 3=1 4=1 5=1 6=0 7=1 gpiosim_check_value sim0 0 1 @@ -1272,7 +1270,7 @@ test_gpioset_with_push_pull() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpioset --banner --drive=push-pull --chip $sim0 \ + dut_run gpioset --banner --drive=push-pull --chip "$sim0" \ 0=0 1=0 2=1 3=1 4=1 5=1 6=0 7=1 gpiosim_check_value sim0 0 0 @@ -1295,7 +1293,7 @@ test_gpioset_with_open_drain() { gpiosim_set_pull sim0 5 pull-up gpiosim_set_pull sim0 7 pull-up - dut_run gpioset --banner --drive=open-drain --chip $sim0 \ + dut_run gpioset --banner --drive=open-drain --chip "$sim0" \ 0=0 1=0 2=1 3=1 4=1 5=1 6=0 7=1 gpiosim_check_value sim0 0 0 @@ -1318,7 +1316,7 @@ test_gpioset_with_open_source() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpioset --banner --drive=open-source --chip $sim0 \ + dut_run gpioset --banner --drive=open-source --chip "$sim0" \ 0=0 1=0 2=1 3=0 4=1 5=1 6=0 7=1 gpiosim_check_value sim0 0 0 @@ -1337,7 +1335,7 @@ test_gpioset_with_pull_up() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpioset --banner --bias=pull-up --drive=open-drain \ - --chip $sim0 0=0 1=0 2=1 3=0 4=1 5=1 6=0 7=1 + --chip "$sim0" 0=0 1=0 2=1 3=0 4=1 5=1 6=0 7=1 gpiosim_check_value sim0 0 0 gpiosim_check_value sim0 1 0 @@ -1355,7 +1353,7 @@ test_gpioset_with_pull_down() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpioset --banner --bias=pull-down --drive=open-source \ - --chip $sim0 0=0 1=0 2=1 3=0 4=1 5=1 6=0 7=1 + --chip "$sim0" 0=0 1=0 2=1 3=0 4=1 5=1 6=0 7=1 gpiosim_check_value sim0 0 0 gpiosim_check_value sim0 1 0 @@ -1381,7 +1379,7 @@ test_gpioset_with_value_variants() { gpiosim_set_pull sim0 6 pull-up gpiosim_set_pull sim0 7 pull-down - dut_run gpioset --banner --chip $sim0 0=0 1=1 2=active \ + dut_run gpioset --banner --chip "$sim0" 0=0 1=1 2=active \ 3=inactive 4=on 5=off 6=false 7=true gpiosim_check_value sim0 0 0 @@ -1401,7 +1399,7 @@ test_gpioset_with_hold_period() { gpiosim_set_pull sim0 5 pull-up - dut_run gpioset --banner --hold-period=1200ms -t0 --chip $sim0 0=1 5=0 7=1 + dut_run gpioset --banner --hold-period=1200ms -t0 --chip "$sim0" 0=1 5=0 7=1 gpiosim_check_value sim0 0 1 gpiosim_check_value sim0 5 0 @@ -1417,7 +1415,7 @@ test_gpioset_interactive_exit() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpioset --interactive --chip $sim0 1=0 2=1 5=1 6=0 7=1 + dut_run gpioset --interactive --chip "$sim0" 1=0 2=1 5=1 6=0 7=1 gpiosim_check_value sim0 1 0 gpiosim_check_value sim0 2 1 @@ -1656,7 +1654,7 @@ test_gpioset_with_lines_by_offset() { gpiosim_set_pull sim0 1 pull-down gpiosim_set_pull sim0 6 pull-up - dut_run gpioset --banner --chip ${GPIOSIM_CHIP_NAME[sim0]} 6=1 1=0 + dut_run gpioset --banner --chip "${GPIOSIM_CHIP_NAME[sim0]}" 6=1 1=0 gpiosim_check_value sim0 1 0 gpiosim_check_value sim0 6 1 @@ -1670,7 +1668,7 @@ test_gpioset_with_lines_strictly_by_name() { gpiosim_set_pull sim0 1 pull-down gpiosim_set_pull sim0 6 pull-up - dut_run gpioset --banner --by-name --chip ${GPIOSIM_CHIP_NAME[sim0]} 6=1 1=0 + dut_run gpioset --banner --by-name --chip "${GPIOSIM_CHIP_NAME[sim0]}" 6=1 1=0 gpiosim_check_value sim0 1 1 gpiosim_check_value sim0 6 0 @@ -1708,7 +1706,7 @@ test_gpioset_with_no_arguments() { test_gpioset_with_chip_but_no_line_specified() { gpiosim_chip sim0 num_lines=8 - run_tool gpioset --chip ${GPIOSIM_CHIP_NAME[sim0]} + run_tool gpioset --chip "${GPIOSIM_CHIP_NAME[sim0]}" output_regex_match ".*at least one GPIO line value must be specified" status_is 1 @@ -1719,7 +1717,7 @@ test_gpioset_with_offset_out_of_range() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioset --chip $sim0 0=1 1=1 2=1 3=1 4=1 5=1 + run_tool gpioset --chip "$sim0" 0=1 1=1 2=1 3=1 4=1 5=1 output_regex_match ".*offset 4 is out of range on chip '$sim0'" output_regex_match ".*offset 5 is out of range on chip '$sim0'" @@ -1731,7 +1729,7 @@ test_gpioset_with_invalid_hold_period() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioset --hold-period=bad --chip $sim0 0=1 + run_tool gpioset --hold-period=bad --chip "$sim0" 0=1 output_regex_match ".*invalid period.*" status_is 1 @@ -1743,13 +1741,13 @@ test_gpioset_with_invalid_value() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # by name - run_tool gpioset --chip $sim0 0=c + run_tool gpioset --chip "$sim0" 0=c output_regex_match ".*invalid line value.*" status_is 1 # by value - run_tool gpioset --chip $sim0 0=3 + run_tool gpioset --chip "$sim0" 0=3 output_regex_match ".*invalid line value.*" status_is 1 @@ -1758,7 +1756,7 @@ test_gpioset_with_invalid_value() { test_gpioset_with_invalid_offset() { gpiosim_chip sim0 num_lines=8 - run_tool gpioset --chip ${GPIOSIM_CHIP_NAME[sim0]} 4000000000=0 + run_tool gpioset --chip "${GPIOSIM_CHIP_NAME[sim0]}" 4000000000=0 output_regex_match ".*cannot find line '4000000000'" status_is 1 @@ -1767,7 +1765,7 @@ test_gpioset_with_invalid_offset() { test_gpioset_with_invalid_bias() { gpiosim_chip sim0 num_lines=8 - run_tool gpioset --bias=bad --chip ${GPIOSIM_CHIP_NAME[sim0]} 0=1 1=1 + run_tool gpioset --bias=bad --chip "${GPIOSIM_CHIP_NAME[sim0]}" 0=1 1=1 output_regex_match ".*invalid bias.*" status_is 1 @@ -1776,7 +1774,7 @@ test_gpioset_with_invalid_bias() { test_gpioset_with_invalid_drive() { gpiosim_chip sim0 num_lines=8 - run_tool gpioset --drive=bad --chip ${GPIOSIM_CHIP_NAME[sim0]} 0=1 1=1 + run_tool gpioset --drive=bad --chip "${GPIOSIM_CHIP_NAME[sim0]}" 0=1 1=1 output_regex_match ".*invalid drive.*" status_is 1 @@ -1787,7 +1785,7 @@ test_gpioset_with_interactive_and_toggle() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpioset --interactive --toggle 1s --chip $sim0 0=1 + run_tool gpioset --interactive --toggle 1s --chip "$sim0" 0=1 output_regex_match ".*can't combine interactive with toggle" status_is 1 @@ -1806,25 +1804,25 @@ test_gpioset_with_same_line_twice() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # by offset - run_tool gpioset --chip $sim0 0=1 0=1 + run_tool gpioset --chip "$sim0" 0=1 0=1 output_regex_match ".*lines '0' and '0' are the same line" status_is 1 # by name - run_tool gpioset --chip $sim0 foo=1 foo=1 + run_tool gpioset --chip "$sim0" foo=1 foo=1 output_regex_match ".*lines 'foo' and 'foo' are the same line" status_is 1 # by name and offset - run_tool gpioset --chip $sim0 foo=1 1=1 + run_tool gpioset --chip "$sim0" foo=1 1=1 output_regex_match ".*lines 'foo' and '1' are the same line" status_is 1 # by offset and name - run_tool gpioset --chip $sim0 1=1 foo=1 + run_tool gpioset --chip "$sim0" 1=1 foo=1 output_regex_match ".*lines '1' and 'foo' are the same line" status_is 1 @@ -1856,7 +1854,7 @@ test_gpiomon_by_offset() { gpiosim_set_pull sim0 4 pull-up - dut_run gpiomon --banner --edges=rising --chip $sim0 4 + dut_run gpiomon --banner --edges=rising --chip "$sim0" 4 dut_regex_match "Monitoring line .*" gpiosim_set_pull sim0 4 pull-down @@ -1874,7 +1872,7 @@ test_gpiomon_by_symlink() { gpiosim_set_pull sim0 4 pull-up - dut_run gpiomon --banner --edges=rising --chip $GPIOSIM_CHIP_LINK 4 + dut_run gpiomon --banner --edges=rising --chip "$GPIOSIM_CHIP_LINK" 4 dut_regex_match "Monitoring line .*" gpiosim_set_pull sim0 4 pull-down @@ -1893,7 +1891,7 @@ test_gpiomon_by_chip_and_name() { gpiosim_set_pull sim1 0 pull-up - dut_run gpiomon --banner --edges=rising --chip $sim1 foo + dut_run gpiomon --banner --edges=rising --chip "$sim1" foo dut_regex_match "Monitoring line .*" gpiosim_set_pull sim1 2 pull-down @@ -1925,7 +1923,7 @@ test_gpiomon_rising_edge() { gpiosim_set_pull sim0 4 pull-up - dut_run gpiomon --banner --edges=rising --chip $sim0 4 + dut_run gpiomon --banner --edges=rising --chip "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-down @@ -1941,7 +1939,7 @@ test_gpiomon_falling_edge() { gpiosim_set_pull sim0 4 pull-down - dut_run gpiomon --banner --edges=falling --chip $sim0 4 + dut_run gpiomon --banner --edges=falling --chip "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -1955,7 +1953,7 @@ test_gpiomon_both_edges() { gpiosim_chip sim0 num_lines=8 local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner --edges=both --chip $sim0 4 + dut_run gpiomon --banner --edges=both --chip "$sim0" 4 dut_regex_match "Monitoring line .*" gpiosim_set_pull sim0 4 pull-up @@ -1971,7 +1969,7 @@ test_gpiomon_with_pull_up() { gpiosim_set_pull sim0 4 pull-down - dut_run gpiomon --banner --bias=pull-up --chip $sim0 4 + dut_run gpiomon --banner --bias=pull-up --chip "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-down @@ -1986,7 +1984,7 @@ test_gpiomon_with_pull_down() { gpiosim_set_pull sim0 4 pull-up - dut_run gpiomon --banner --bias=pull-down --chip $sim0 4 + dut_run gpiomon --banner --bias=pull-down --chip "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2002,7 +2000,7 @@ test_gpiomon_with_active_low() { gpiosim_set_pull sim0 4 pull-up - dut_run gpiomon --banner --active-low --chip $sim0 4 + dut_run gpiomon --banner --active-low --chip "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-down @@ -2035,7 +2033,7 @@ test_gpiomon_with_quiet_mode() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner --edges=rising --quiet --chip $sim0 4 + dut_run gpiomon --banner --edges=rising --quiet --chip "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2063,7 +2061,7 @@ test_gpiomon_with_num_events() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # redirect, as gpiomon exits after 4 events - dut_run_redirect gpiomon --num-events=4 --chip $sim0 4 + dut_run_redirect gpiomon --num-events=4 --chip "$sim0" 4 gpiosim_set_pull sim0 4 pull-up sleep 0.01 @@ -2107,7 +2105,7 @@ test_gpiomon_with_idle_timeout() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # redirect, as gpiomon exits - dut_run_redirect gpiomon --idle-timeout 10ms --chip $sim0 4 + dut_run_redirect gpiomon --idle-timeout 10ms --chip "$sim0" 4 dut_wait status_is 0 @@ -2120,7 +2118,7 @@ test_gpiomon_multiple_lines() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner --format=%o --chip $sim0 1 3 2 5 4 + dut_run gpiomon --banner --format=%o --chip "$sim0" 1 3 2 5 4 dut_regex_match "Monitoring lines .*" gpiosim_set_pull sim0 2 pull-up @@ -2138,7 +2136,7 @@ test_gpiomon_multiple_lines_by_name_and_offset() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner --format=%o --chip $sim0 foo bar 3 + dut_run gpiomon --banner --format=%o --chip "$sim0" foo bar 3 dut_regex_match "Monitoring lines .*" gpiosim_set_pull sim0 2 pull-up @@ -2173,7 +2171,7 @@ test_gpiomon_exit_after_SIGINT() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner --chip $sim0 4 + dut_run gpiomon --banner --chip "$sim0" 4 dut_regex_match "Monitoring line .*" dut_kill -SIGINT @@ -2187,7 +2185,7 @@ test_gpiomon_exit_after_SIGTERM() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner --chip $sim0 4 + dut_run gpiomon --banner --chip "$sim0" 4 dut_regex_match "Monitoring line .*" dut_kill -SIGTERM @@ -2209,7 +2207,7 @@ test_gpiomon_with_same_line_twice() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # by offset - run_tool gpiomon --chip $sim0 0 0 + run_tool gpiomon --chip "$sim0" 0 0 output_regex_match ".*lines '0' and '0' are the same line" status_is 1 @@ -2221,7 +2219,7 @@ test_gpiomon_with_same_line_twice() { status_is 1 # by name and offset - run_tool gpiomon --chip $sim0 1 foo + run_tool gpiomon --chip "$sim0" 1 foo output_regex_match ".*lines '1' and 'foo' are the same line" status_is 1 @@ -2248,7 +2246,7 @@ test_gpiomon_with_lines_by_offset() { gpiosim_set_pull sim0 1 pull-up - dut_run gpiomon --banner --chip $sim0 6 1 + dut_run gpiomon --banner --chip "$sim0" 6 1 dut_flush gpiosim_set_pull sim0 1 pull-down @@ -2275,7 +2273,7 @@ test_gpiomon_with_lines_strictly_by_name() { gpiosim_set_pull sim0 1 pull-up - dut_run gpiomon --banner --by-name --chip $sim0 42 13 + dut_run gpiomon --banner --by-name --chip "$sim0" 42 13 dut_flush gpiosim_set_pull sim0 1 pull-down @@ -2303,7 +2301,7 @@ test_gpiomon_with_no_arguments() { test_gpiomon_with_no_line_specified() { gpiosim_chip sim0 num_lines=8 - run_tool gpiomon --chip ${GPIOSIM_CHIP_NAME[sim0]} + run_tool gpiomon --chip "${GPIOSIM_CHIP_NAME[sim0]}" output_regex_match ".*at least one GPIO line must be specified" status_is 1 @@ -2314,7 +2312,7 @@ test_gpiomon_with_offset_out_of_range() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpiomon --chip $sim0 5 + run_tool gpiomon --chip "$sim0" 5 output_regex_match ".*offset 5 is out of range on chip '$sim0'" status_is 1 @@ -2325,7 +2323,7 @@ test_gpiomon_with_invalid_bias() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpiomon --bias=bad -c $sim0 0 1 + run_tool gpiomon --bias=bad -c "$sim0" 0 1 output_regex_match ".*invalid bias.*" status_is 1 @@ -2336,7 +2334,7 @@ test_gpiomon_with_invalid_debounce_period() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpiomon --debounce-period bad -c $sim0 0 1 + run_tool gpiomon --debounce-period bad -c "$sim0" 0 1 output_regex_match ".*invalid period: bad" status_is 1 @@ -2347,7 +2345,7 @@ test_gpiomon_with_invalid_idle_timeout() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpiomon --idle-timeout bad -c $sim0 0 1 + run_tool gpiomon --idle-timeout bad -c "$sim0" 0 1 output_regex_match ".*invalid period: bad" status_is 1 @@ -2358,7 +2356,7 @@ test_gpiomon_with_custom_format_event_type_offset() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=%e %o" -c $sim0 4 + dut_run gpiomon --banner "--format=%e %o" -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2371,7 +2369,7 @@ test_gpiomon_with_custom_format_event_type_offset_joined() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=%e%o" -c $sim0 4 + dut_run gpiomon --banner "--format=%e%o" -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2384,7 +2382,7 @@ test_gpiomon_with_custom_format_edge_chip_and_line() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=%e %o %E %c %l" -c $sim0 baz + dut_run gpiomon --banner "--format=%e %o %E %c %l" -c "$sim0" baz dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2396,7 +2394,7 @@ test_gpiomon_with_custom_format_seconds_timestamp() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=%e %o %S" -c $sim0 4 + dut_run gpiomon --banner "--format=%e %o %S" -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2409,7 +2407,7 @@ test_gpiomon_with_custom_format_UTC_timestamp() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpiomon --banner "--format=%U %e %o " --event-clock=realtime \ - -c $sim0 4 + -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2423,7 +2421,7 @@ test_gpiomon_with_custom_format_localtime_timestamp() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpiomon --banner "--format=%L %e %o" --event-clock=realtime \ - -c $sim0 4 + -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2436,7 +2434,7 @@ test_gpiomon_with_custom_format_double_percent_sign() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=start%%end" -c $sim0 4 + dut_run gpiomon --banner "--format=start%%end" -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2449,7 +2447,7 @@ test_gpiomon_with_custom_format_double_percent_sign_event_type_specifier() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=%%e" -c $sim0 4 + dut_run gpiomon --banner "--format=%%e" -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2462,7 +2460,7 @@ test_gpiomon_with_custom_format_single_percent_sign() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=%" -c $sim0 4 + dut_run gpiomon --banner "--format=%" -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2475,7 +2473,7 @@ test_gpiomon_with_custom_format_single_percent_sign_between_other_characters() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=foo % bar" -c $sim0 4 + dut_run gpiomon --banner "--format=foo % bar" -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2488,7 +2486,7 @@ test_gpiomon_with_custom_format_unknown_specifier() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpiomon --banner "--format=%x" -c $sim0 4 + dut_run gpiomon --banner "--format=%x" -c "$sim0" 4 dut_flush gpiosim_set_pull sim0 4 pull-up @@ -2508,7 +2506,7 @@ test_gpionotify_by_name() { dut_run gpionotify --banner foo dut_regex_match "Watching line .*" - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"foo\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"foo\"" @@ -2520,10 +2518,10 @@ test_gpionotify_by_offset() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --chip $sim0 4 + dut_run gpionotify --banner --chip "$sim0" 4 dut_regex_match "Watching line .*" - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 4" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 4" @@ -2536,10 +2534,10 @@ test_gpionotify_by_symlink() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --chip $GPIOSIM_CHIP_LINK 4 + dut_run gpionotify --banner --chip "$GPIOSIM_CHIP_LINK" 4 dut_regex_match "Watching line .*" - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0\\s+4" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0\\s+4" @@ -2552,10 +2550,10 @@ test_gpionotify_by_chip_and_name() { local sim1=${GPIOSIM_CHIP_NAME[sim1]} - dut_run gpionotify --banner --chip $sim1 foo + dut_run gpionotify --banner --chip "$sim1" foo dut_regex_match "Watching line .*" - request_release_line $sim1 2 + request_release_line "$sim1" 2 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim1 2 \"foo\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim1 2 \"foo\"" @@ -2572,7 +2570,7 @@ test_gpionotify_first_matching_named_line() { dut_run gpionotify --banner foobar dut_regex_match "Watching line .*" - request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 3 + request_release_line "${GPIOSIM_CHIP_NAME[sim0]}" 3 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"foobar\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"foobar\"" @@ -2586,10 +2584,10 @@ test_gpionotify_with_requested() { gpiosim_set_pull sim0 4 pull-up - dut_run gpionotify --banner --event=requested --chip $sim0 4 + dut_run gpionotify --banner --event=requested --chip "$sim0" 4 dut_flush - request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 4 + request_release_line "${GPIOSIM_CHIP_NAME[sim0]}" 4 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 4" assert_fail dut_readable } @@ -2600,10 +2598,10 @@ test_gpionotify_with_released() { gpiosim_set_pull sim0 4 pull-down - dut_run gpionotify --banner --event=released --chip $sim0 4 + dut_run gpionotify --banner --event=released --chip "$sim0" 4 dut_flush - request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 4 + request_release_line "${GPIOSIM_CHIP_NAME[sim0]}" 4 dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 4" assert_fail dut_readable } @@ -2613,10 +2611,10 @@ test_gpionotify_with_quiet_mode() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --quiet --chip $sim0 4 + dut_run gpionotify --banner --quiet --chip "$sim0" 4 dut_flush - request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 4 + request_release_line "${GPIOSIM_CHIP_NAME[sim0]}" 4 assert_fail dut_readable } @@ -2628,7 +2626,7 @@ test_gpionotify_with_unquoted() { dut_run gpionotify --banner --unquoted foo dut_regex_match "Watching line .*" - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+foo" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+foo" @@ -2640,11 +2638,11 @@ test_gpionotify_with_num_events() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # redirect, as gpionotify exits after 4 events - dut_run_redirect gpionotify --num-events=4 --chip $sim0 3 4 + dut_run_redirect gpionotify --num-events=4 --chip "$sim0" 3 4 - request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 4 - request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 3 + request_release_line "${GPIOSIM_CHIP_NAME[sim0]}" 4 + request_release_line "${GPIOSIM_CHIP_NAME[sim0]}" 3 dut_wait status_is 0 @@ -2663,7 +2661,7 @@ test_gpionotify_with_idle_timeout() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # redirect, as gpionotify exits - dut_run_redirect gpionotify --idle-timeout 10ms --chip $sim0 3 4 + dut_run_redirect gpionotify --idle-timeout 10ms --chip "$sim0" 3 4 dut_wait status_is 0 @@ -2677,18 +2675,18 @@ test_gpionotify_multiple_lines() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --chip $sim0 1 2 3 4 5 + dut_run gpionotify --banner --chip "$sim0" 1 2 3 4 5 dut_regex_match "Watching lines .*" - request_release_line $sim0 2 + request_release_line "$sim0" 2 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 2" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 2" - request_release_line $sim0 3 + request_release_line "$sim0" 3 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 3" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 3" - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 4" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 4" @@ -2700,18 +2698,18 @@ test_gpionotify_multiple_lines_by_name_and_offset() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --chip $sim0 bar foo 3 + dut_run gpionotify --banner --chip "$sim0" bar foo 3 dut_regex_match "Watching lines .*" - request_release_line $sim0 2 + request_release_line "$sim0" 2 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 2\\s+\"bar\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 2\\s+\"bar\"" - request_release_line $sim0 1 + request_release_line "$sim0" 1 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 1\\s+\"foo\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 1\\s+\"foo\"" - request_release_line $sim0 3 + request_release_line "$sim0" 3 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 3" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 3" @@ -2728,19 +2726,19 @@ test_gpionotify_multiple_lines_across_multiple_chips() { dut_run gpionotify --banner baz bar foo xyz dut_regex_match "Watching lines .*" - request_release_line $sim0 2 + request_release_line "$sim0" 2 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"bar\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"bar\"" - request_release_line $sim0 1 + request_release_line "$sim0" 1 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"foo\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"foo\"" - request_release_line $sim1 4 + request_release_line "$sim1" 4 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"xyz\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"xyz\"" - request_release_line $sim1 0 + request_release_line "$sim1" 0 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"baz\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"baz\"" @@ -2750,7 +2748,7 @@ test_gpionotify_multiple_lines_across_multiple_chips() { test_gpionotify_exit_after_SIGINT() { gpiosim_chip sim0 num_lines=8 - dut_run gpionotify --banner --chip ${GPIOSIM_CHIP_NAME[sim0]} 4 + dut_run gpionotify --banner --chip "${GPIOSIM_CHIP_NAME[sim0]}" 4 dut_regex_match "Watching line .*" dut_kill -SIGINT @@ -2762,7 +2760,7 @@ test_gpionotify_exit_after_SIGINT() { test_gpionotify_exit_after_SIGTERM() { gpiosim_chip sim0 num_lines=8 - dut_run gpionotify --banner --chip ${GPIOSIM_CHIP_NAME[sim0]} 4 + dut_run gpionotify --banner --chip "${GPIOSIM_CHIP_NAME[sim0]}" 4 dut_regex_match "Watching line .*" dut_kill -SIGTERM @@ -2784,7 +2782,7 @@ test_gpionotify_with_same_line_twice() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} # by offset - run_tool gpionotify --chip $sim0 0 0 + run_tool gpionotify --chip "$sim0" 0 0 output_regex_match ".*lines '0' and '0' are the same line" num_lines_is 1 @@ -2798,7 +2796,7 @@ test_gpionotify_with_same_line_twice() { status_is 1 # by name and offset - run_tool gpionotify --chip $sim0 1 foo + run_tool gpionotify --chip "$sim0" 1 foo output_regex_match ".*lines '1' and 'foo' are the same line" num_lines_is 1 @@ -2825,14 +2823,14 @@ test_gpionotify_with_lines_by_offset() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --chip $sim0 1 + dut_run gpionotify --banner --chip "$sim0" 1 dut_flush - request_release_line $sim0 1 + request_release_line "$sim0" 1 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 1" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 1" - request_release_line $sim0 6 + request_release_line "$sim0" 6 assert_fail dut_readable } @@ -2844,14 +2842,14 @@ test_gpionotify_with_lines_strictly_by_name() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --by-name --chip $sim0 1 + dut_run gpionotify --banner --by-name --chip "$sim0" 1 dut_flush - request_release_line $sim0 6 + request_release_line "$sim0" 6 dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 6 \"1\"" dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 6 \"1\"" - request_release_line $sim0 1 + request_release_line "$sim0" 1 assert_fail dut_readable } @@ -2865,7 +2863,7 @@ test_gpionotify_with_no_arguments() { test_gpionotify_with_no_line_specified() { gpiosim_chip sim0 num_lines=8 - run_tool gpionotify --chip ${GPIOSIM_CHIP_NAME[sim0]} + run_tool gpionotify --chip "${GPIOSIM_CHIP_NAME[sim0]}" output_regex_match ".*at least one GPIO line must be specified" status_is 1 @@ -2876,7 +2874,7 @@ test_gpionotify_with_offset_out_of_range() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpionotify --chip $sim0 5 + run_tool gpionotify --chip "$sim0" 5 output_regex_match ".*offset 5 is out of range on chip '$sim0'" status_is 1 @@ -2887,7 +2885,7 @@ test_gpionotify_with_invalid_idle_timeout() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - run_tool gpionotify --idle-timeout bad -c $sim0 0 1 + run_tool gpionotify --idle-timeout bad -c "$sim0" 0 1 output_regex_match ".*invalid period: bad" status_is 1 @@ -2898,10 +2896,10 @@ test_gpionotify_with_custom_format_event_type_offset() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --event=requested "--format=%e %o" -c $sim0 4 + dut_run gpionotify --banner --event=requested "--format=%e %o" -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_read output_is "1 4" } @@ -2911,10 +2909,10 @@ test_gpionotify_with_custom_format_event_type_offset_joined() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --event=requested "--format=%e%o" -c $sim0 4 + dut_run gpionotify --banner --event=requested "--format=%e%o" -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_read output_is "14" } @@ -2925,10 +2923,10 @@ test_gpionotify_with_custom_format_event_chip_and_line() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpionotify --banner --event=released \ - "--format=%e %o %E %c %l" -c $sim0 baz + "--format=%e %o %E %c %l" -c "$sim0" baz dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match "2 4 released $sim0 baz" } @@ -2938,10 +2936,10 @@ test_gpionotify_with_custom_format_seconds_timestamp() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpionotify --banner --event=requested "--format=%e %o %S" \ - -c $sim0 4 + -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match "1 4 [0-9]+\\.[0-9]+" } @@ -2951,10 +2949,10 @@ test_gpionotify_with_custom_format_UTC_timestamp() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpionotify --banner --event=released \ - "--format=%U %e %o" -c $sim0 4 + "--format=%U %e %o" -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match \ "[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\\.[0-9]+Z 2 4" } @@ -2965,10 +2963,10 @@ test_gpionotify_with_custom_format_localtime_timestamp() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpionotify --banner --event=released \ - "--format=%L %e %o" -c $sim0 4 + "--format=%L %e %o" -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_regex_match \ "[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\\.[0-9]+ 2 4" } @@ -2979,10 +2977,10 @@ test_gpionotify_with_custom_format_double_percent_sign() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} dut_run gpionotify --banner --event=requested "--format=start%%end" \ - -c $sim0 4 + -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_read output_is "start%end" } @@ -2992,10 +2990,10 @@ test_gpionotify_with_custom_format_double_percent_sign_event_type_specifier() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --event=requested "--format=%%e" -c $sim0 4 + dut_run gpionotify --banner --event=requested "--format=%%e" -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_read output_is "%e" } @@ -3005,10 +3003,10 @@ test_gpionotify_with_custom_format_single_percent_sign() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --event=requested "--format=%" -c $sim0 4 + dut_run gpionotify --banner --event=requested "--format=%" -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_read output_is "%" } @@ -3018,10 +3016,10 @@ test_gpionotify_with_custom_format_single_percent_sign_between_other_characters( local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --event=requested "--format=foo % bar" -c $sim0 4 + dut_run gpionotify --banner --event=requested "--format=foo % bar" -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_read output_is "foo % bar" } @@ -3031,10 +3029,10 @@ test_gpionotify_with_custom_format_unknown_specifier() { local sim0=${GPIOSIM_CHIP_NAME[sim0]} - dut_run gpionotify --banner --event=requested "--format=%x" -c $sim0 4 + dut_run gpionotify --banner --event=requested "--format=%x" -c "$sim0" 4 dut_flush - request_release_line $sim0 4 + request_release_line "$sim0" 4 dut_read output_is "%x" }