Skip to contentSkip to conversation

Clean up the arm/run script

PATCH Applied Shaoqin Huang 2 participants 4 messages Mar 3, 2023 – Mar 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Clean up the arm/run script

Using more simple bash command to clean up the arm/run script.

Patch 1 replace the obsolete qemu script.

Patch 2 clean up the arm/run script to make the format consistent and simple.

Changelog:
----------
v2:
- Add the oldest QEMU version for which -chardev ? work.
- use grep -q replace the grep > /dev/null.
- Add a new patch to clean up the arm/run.

v1: https://lore.kernel.org/all/[email protected]/

Shaoqin Huang (2):
arm: Replace the obsolete qemu script
arm: Clean up the run script

 arm/run | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
Signature · 1 line
2.39.1
#1 lore raw

PATCH v2 1/2 arm: Replace the obsolete qemu script

The qemu script used to detect the testdev is obsoleted, replace it with the modern way to detect if testdev exists which was first introduced at QEMU v2.7.50 by:
517b3d4016 (chardev: Add 'help' option to print all available chardev backend types).

---
 arm/run | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arm/run +1 -2
index 1284891..b918029 100755
@@ -59,8 +59,7 @@ if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then
 	exit 2
 fi
 
-if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \
-		| grep backend > /dev/null; then
+if ! $qemu $M -chardev '?' | grep -q testdev; then
 	echo "$qemu doesn't support chr-testdev. Exiting."
 	exit 2
 fi
Signature · 1 line
2.39.1
#2 lore raw

PATCH v2 2/2 arm: Clean up the run script

In reply to Shaoqin Huang

Using more simple bash command to clean up the run script.

No functional change intended.

---
 arm/run | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arm/run +4 -4
index b918029..c6f25b8 100755
@@ -28,7 +28,7 @@ fi
 
 ACCEL=$accel
 
-if ! $qemu -machine '?' 2>&1 | grep 'ARM Virtual Machine' > /dev/null; then
+if ! $qemu -machine '?' | grep -q 'ARM Virtual Machine'; then
 	echo "$qemu doesn't support mach-virt ('-machine virt'). Exiting."
 	exit 2
 fi
@@ -36,7 +36,7 @@ fi
 M='-machine virt'
 
 if [ "$ACCEL" = "kvm" ]; then
-	if $qemu $M,\? 2>&1 | grep gic-version > /dev/null; then
+	if $qemu $M,\? | grep -q gic-version; then
 		M+=',gic-version=host'
 	fi
 fi
@@ -54,7 +54,7 @@ if [ "$ARCH" = "arm" ]; then
 	M+=",highmem=off"
 fi
 
-if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then
+if ! $qemu $M -device '?' | grep -q virtconsole; then
 	echo "$qemu doesn't support virtio-console for chr-testdev. Exiting."
 	exit 2
 fi
@@ -68,7 +68,7 @@ chr_testdev='-device virtio-serial-device'
 chr_testdev+=' -device virtconsole,chardev=ctd -chardev testdev,id=ctd'
 
 pci_testdev=
-if $qemu $M -device '?' 2>&1 | grep pci-testdev > /dev/null; then
+if $qemu $M -device '?' | grep -q pci-testdev; then
 	pci_testdev="-device pci-testdev"
 fi
 
Signature · 1 line
2.39.1
Applied
#3 lore raw
In reply to Shaoqin Huang
Quoted 6 lines · Shaoqin Huang

Using more simple bash command to clean up the arm/run script.

Patch 1 replace the obsolete qemu script.

Patch 2 clean up the arm/run script to make the format consistent and simple.

Quoted 8 lines

Changelog:
----------
v2:
- Add the oldest QEMU version for which -chardev ? work.
- use grep -q replace the grep > /dev/null.
- Add a new patch to clean up the arm/run.

[...]

Applied to arm/queue, thanks!

https://gitlab.com/jones-drew/kvm-unit-tests/-/commits/arm/queue

drew