Skip to contentSkip to conversation

arm: Replace the obsolete qemu script

kvm-unit-tests Shaoqin Huang 2 participants 6 messages Mar 1, 2023 – Mar 2, 2023

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

The qemu script used to detect the testdev is obsoleted, replace it with the modern way to detect if testdev exists.

---
 arm/run | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arm/run +1 -2
index 1284891..9800cfb 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 '?' 2>&1 | grep testdev > /dev/null; then
 	echo "$qemu doesn't support chr-testdev. Exiting."
 	exit 2
 fi
Signature · 1 line
2.39.1
#1 lore raw
Quoted 2 lines · Shaoqin Huang

The qemu script used to detect the testdev is obsoleted, replace it with the modern way to detect if testdev exists.

Hi Shaoqin,

Can you please point out the oldest QEMU version for which the modern way works?

Quoted 11 lines
---
 arm/run | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arm/run +0 -0
index 1284891..9800cfb 100755

arm/run if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then · line 62

Quoted 6 lines
arm/run +1 -2
@@ -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 '?' 2>&1 | grep testdev > /dev/null; then

^ This shouldn't be necessary. afaict,
only stdio is used

We can change the 'grep testdev >/dev/null' to 'grep -q testdev'

Quoted 6 lines
arm/run +0 -0
 	echo "$qemu doesn't support chr-testdev. Exiting."
 	exit 2
 fi
Signature · 1 line
2.39.1

Thanks,
drew

#2 lore raw
Quoted 8 lines · Andrew Jones
Quoted 2 lines · Shaoqin Huang

The qemu script used to detect the testdev is obsoleted, replace it with the modern way to detect if testdev exists.

Hi Shaoqin,

Can you please point out the oldest QEMU version for which the modern way works?

Hi drew,

This way was introduced by 517b3d4016 (chardev: Add 'help' option to print all available chardev backend types). Which the QEMU verison is v2.7.50.

Quoted 15 lines
Quoted 15 lines
---
  arm/run | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
arm/run +0 -0
index 1284891..9800cfb 100755
@@ -59,8 +59,7 @@ if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then
  	exit 2
  fi
 
Quoted 7 lines

arm/run if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then · line 62

Quoted 3 lines
arm/run +1 -2
-if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \
-		| grep backend > /dev/null; then
+if ! $qemu $M -chardev '?' 2>&1 | grep testdev > /dev/null; then

^ This shouldn't be necessary. afaict,
only stdio is used

We can change the 'grep testdev >/dev/null' to 'grep -q testdev'

Thanks for advice. I will change it.

Quoted 11 lines
Quoted 7 lines
arm/run +0 -0
  	echo "$qemu doesn't support chr-testdev. Exiting."
  	exit 2
  fi
Signature · 1 line
2.39.1

Thanks,
drew

Signature · 1 line
Shaoqin
#3 lore raw
In reply to Andrew Jones

Hi drew,

Quoted 23 lines · Andrew Jones
Quoted 2 lines · Shaoqin Huang

The qemu script used to detect the testdev is obsoleted, replace it with the modern way to detect if testdev exists.

Hi Shaoqin,

Can you please point out the oldest QEMU version for which the modern way works?

Quoted 14 lines
---
  arm/run | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
arm/run +0 -0
index 1284891..9800cfb 100755
@@ -59,8 +59,7 @@ if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then
  	exit 2
  fi
 
Quoted 8 lines

arm/run if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then · line 62

Quoted 3 lines
arm/run +1 -2
-if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \
-		| grep backend > /dev/null; then
+if ! $qemu $M -chardev '?' 2>&1 | grep testdev > /dev/null; then

^ This shouldn't be necessary. afaict,
only stdio is used

We can change the 'grep testdev >/dev/null' to 'grep -q testdev'

This just remind me if we could also change

if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then

to

if ! $qemu $M -device '?' | grep -q virtconsole; then

And all other place like that.

Thanks,

Quoted 10 lines
Quoted 6 lines
arm/run +0 -0
  	echo "$qemu doesn't support chr-testdev. Exiting."
  	exit 2
  fi
Signature · 1 line
2.39.1

Thanks,
drew

Signature · 1 line
Shaoqin
#4 lore raw
Quoted 36 lines · Shaoqin Huang

Hi drew,

Quoted 28 lines · Andrew Jones
Quoted 2 lines · Shaoqin Huang

The qemu script used to detect the testdev is obsoleted, replace it with the modern way to detect if testdev exists.

Hi Shaoqin,

Can you please point out the oldest QEMU version for which the modern way works?

Quoted 11 lines
---
  arm/run | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
arm/run +0 -0
index 1284891..9800cfb 100755

arm/run if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then · line 61

Quoted 5 lines
arm/run +1 -2
@@ -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 '?' 2>&1 | grep testdev > /dev/null; then

^ This shouldn't be necessary. afaict,
only stdio is used

Quoted 2 lines

We can change the 'grep testdev >/dev/null' to 'grep -q testdev'

This just remind me if we could also change

Quoted 7 lines

if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then

to

if ! $qemu $M -device '?' | grep -q virtconsole; then

And all other place like that.

Yup.

Also, unrelated, but can you change your patch prefix to

kvm-unit-tests PATCH

as suggested in the README? My filters are looking for 'PATCH'.

Thanks,
drew

Quoted 17 lines

Thanks,

Quoted 10 lines
Quoted 6 lines
arm/run +0 -0
  	echo "$qemu doesn't support chr-testdev. Exiting."
  	exit 2
  fi
Signature · 1 line
2.39.1

Thanks,
drew

Signature · 1 line
Shaoqin
#5 lore raw
Quoted 45 lines · Andrew Jones
Quoted 36 lines · Shaoqin Huang

Hi drew,

Quoted 28 lines · Andrew Jones
Quoted 2 lines · Shaoqin Huang

The qemu script used to detect the testdev is obsoleted, replace it with the modern way to detect if testdev exists.

Hi Shaoqin,

Can you please point out the oldest QEMU version for which the modern way works?

Quoted 11 lines
---
   arm/run | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)
arm/run +0 -0
index 1284891..9800cfb 100755

arm/run if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then · line 61

Quoted 5 lines
arm/run +1 -2
@@ -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 '?' 2>&1 | grep testdev > /dev/null; then

^ This shouldn't be necessary. afaict, only stdio is used

Quoted 2 lines

We can change the 'grep testdev >/dev/null' to 'grep -q testdev'

This just remind me if we could also change

Quoted 7 lines

if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then

to

if ! $qemu $M -device '?' | grep -q virtconsole; then

And all other place like that.

Quoted 8 lines

Yup.

Also, unrelated, but can you change your patch prefix to

kvm-unit-tests PATCH

as suggested in the README? My filters are looking for 'PATCH'.

Hi drew,

My bad. Has update it.

Thanks,
Shaoqin

Quoted 21 lines

Thanks,
drew

Quoted 17 lines

Thanks,

Quoted 10 lines
Quoted 6 lines
arm/run +0 -0
   	echo "$qemu doesn't support chr-testdev. Exiting."
   	exit 2
   fi
Signature · 1 line
2.39.1

Thanks,
drew

Signature · 1 line
Shaoqin
Signature · 1 line
Shaoqin