Skip to contentSkip to conversation

scripts: Fix PV run handling

PATCH In review Janosch Frank 3 participants 11 messages Mar 18, 2021 – Jun 7, 2021

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

cover scripts: Fix PV run handling

There are some issues that make our current PV handling in run_tests.sh and s390x/run a bit awkward:

* With ACCEL=tcg or if KVM is not available we will try to run PV tests which won't work
* If a host key cert has been specified but it does not exists then the compilation will break

This series is based on the common script fixes I just sent out.

Janosch Frank (3):
s390x: Don't run PV testcases under tcg
configure: s390x: Check if the host key document exists
s390x: run: Skip PV tests when tcg is the accelerator

 configure               | 5 +++++
 s390x/run               | 5 +++++
 scripts/s390x/func.bash | 3 +++
 3 files changed, 13 insertions(+)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/3 s390x: Don't run PV testcases under tcg

The UV call facility is only available on hardware.

---
 scripts/s390x/func.bash | 3 +++
 1 file changed, 3 insertions(+)
scripts/s390x/func.bash +3 -0
index b3912081..bf799a56 100644
@@ -21,6 +21,9 @@ function arch_cmd_s390x()
 	"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
 
 	# run PV test case
+	if [ "$ACCEL" = 'tcg' ]; then
+		return
+	fi
 	kernel=${kernel%.elf}.pv.bin
 	testname=${testname}_PV
 	if [ ! -f "${kernel}" ]; then
Signature · 1 line
2.27.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [kvm-unit-tests PATCH 1/3] s390x: Don't run PV testcases under tcg

Quoted 13 lines · Janosch Frank

The UV call facility is only available on hardware.

---
  scripts/s390x/func.bash | 3 +++
  1 file changed, 3 insertions(+)
scripts/s390x/func.bash +0 -0
index b3912081..bf799a56 100644

scripts/s390x/func.bash function arch_cmd_s390x() · line 29

Quoted 9 lines
scripts/s390x/func.bash +3 -0
@@ -21,6 +21,9 @@ function arch_cmd_s390x()
  	"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
 
  	# run PV test case
+	if [ "$ACCEL" = 'tcg' ]; then
+		return
+	fi
  	kernel=${kernel%.elf}.pv.bin
  	testname=${testname}_PV
  	if [ ! -f "${kernel}" ]; then
Reviewed-by on v1 1/3
#3 lore raw

Re: [kvm-unit-tests PATCH 1/3] s390x: Don't run PV testcases under tcg

In reply to Janosch Frank
Quoted 13 lines · Janosch Frank

The UV call facility is only available on hardware.

---
  scripts/s390x/func.bash | 3 +++
  1 file changed, 3 insertions(+)
scripts/s390x/func.bash +0 -0
index b3912081..bf799a56 100644

scripts/s390x/func.bash function arch_cmd_s390x() · line 29

Quoted 9 lines
scripts/s390x/func.bash +3 -0
@@ -21,6 +21,9 @@ function arch_cmd_s390x()
  	"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
 
  	# run PV test case
+	if [ "$ACCEL" = 'tcg' ]; then
+		return
+	fi
  	kernel=${kernel%.elf}.pv.bin
  	testname=${testname}_PV
  	if [ ! -f "${kernel}" ]; then
Signature · 3 lines
Thanks,

David / dhildenb
#4 lore raw

PATCH 2/3 configure: s390x: Check if the host key document exists

In reply to Janosch Frank

I'd rather have a readable error message than make failing the build with cryptic errors.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
configure +5 -0
index cdcd34e9..4d4bb646 100755
@@ -121,6 +121,11 @@ while [[ "$1" = -* ]]; do
     esac
 done
 
+if [ "$host_key_document" ] && [ ! -f "$host_key_document" ]; then
+    echo "Host key document doesn't exist at the specified location."
+    exit 1
+fi
+
 if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then
     echo "erratatxt: $erratatxt does not exist or is not a regular file"
     exit 1
Signature · 1 line
2.27.0
Reviewed-by on v1 2/3
#5 lore raw

Re: [kvm-unit-tests PATCH 2/3] configure: s390x: Check if the host key document exists

Quoted 13 lines · Janosch Frank

I'd rather have a readable error message than make failing the build with cryptic errors.

---
  configure | 5 +++++
  1 file changed, 5 insertions(+)
configure +0 -0
index cdcd34e9..4d4bb646 100755

configure while [[ "$1" = -* ]]; do · line 124

Quoted 4 lines
configure +1 -0
@@ -121,6 +121,11 @@ while [[ "$1" = -* ]]; do
      esac
  done
 
+if [ "$host_key_document" ] && [ ! -f "$host_key_document" ]; then

Use [ -n "$host_key_document" ] instead of just
[ "$host_key_document" ] ?

With that fixed:

Quoted 8 lines
configure +4 -0
+    echo "Host key document doesn't exist at the specified location."
+    exit 1
+fi
+
  if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then
      echo "erratatxt: $erratatxt does not exist or is not a regular file"
      exit 1
#6 lore raw

Re: [kvm-unit-tests PATCH 2/3] configure: s390x: Check if the host key document exists

Quoted 24 lines · Thomas Huth
Quoted 13 lines · Janosch Frank

I'd rather have a readable error message than make failing the build with cryptic errors.

---
   configure | 5 +++++
   1 file changed, 5 insertions(+)
configure +0 -0
index cdcd34e9..4d4bb646 100755

configure while [[ "$1" = -* ]]; do · line 124

Quoted 4 lines
configure +1 -0
@@ -121,6 +121,11 @@ while [[ "$1" = -* ]]; do
       esac
   done
 
+if [ "$host_key_document" ] && [ ! -f "$host_key_document" ]; then

Use [ -n "$host_key_document" ] instead of just
[ "$host_key_document" ] ?

With that fixed:

Quoted 8 lines

configure while [[ "$1" = -* ]]; do · line 129

Quoted 5 lines
configure +4 -0
+    echo "Host key document doesn't exist at the specified location."
+    exit 1
+fi
+
   if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then

^should we adjust that then as well?

Signature · 3 lines
Thanks,

David / dhildenb
#7 lore raw

PATCH 3/3 s390x: run: Skip PV tests when tcg is the accelerator

In reply to Janosch Frank

TCG doesn't support PV.

---
 s390x/run | 5 +++++
 1 file changed, 5 insertions(+)
s390x/run +5 -0
index df7ef5ca..82922701 100755
@@ -19,6 +19,11 @@ else
     ACCEL=$DEF_ACCEL
 fi
 
+if [ "${1: -7}" == ".pv.bin" ] || [ "${TESTNAME: -3}" == "_PV" ] && [ $ACCEL == "tcg" ]; then
+	echo "Protected Virtualization isn't supported under TCG"
+	exit 2
+fi
+
 M='-machine s390-ccw-virtio'
 M+=",accel=$ACCEL"
 command="$qemu -nodefaults -nographic $M"
Signature · 1 line
2.27.0
Reviewed-by on v1 3/3
#8 lore raw

Re: [kvm-unit-tests PATCH 3/3] s390x: run: Skip PV tests when tcg is the accelerator

Quoted 12 lines · Janosch Frank

TCG doesn't support PV.

---
  s390x/run | 5 +++++
  1 file changed, 5 insertions(+)
s390x/run +0 -0
index df7ef5ca..82922701 100755

s390x/run else · line 22

Quoted 4 lines
s390x/run +1 -0
@@ -19,6 +19,11 @@ else
      ACCEL=$DEF_ACCEL
  fi
 
+if [ "${1: -7}" == ".pv.bin" ] || [ "${TESTNAME: -3}" == "_PV" ] && [ $ACCEL == "tcg" ]; then

Put $ACCEL in quotes?

With that nit fixed:

Quoted 8 lines
s390x/run +4 -0
+	echo "Protected Virtualization isn't supported under TCG"
+	exit 2
+fi
+
  M='-machine s390-ccw-virtio'
  M+=",accel=$ACCEL"
  command="$qemu -nodefaults -nographic $M"
#9 lore raw

Re: [kvm-unit-tests PATCH 3/3] s390x: run: Skip PV tests when tcg is the accelerator

Quoted 16 lines · Thomas Huth
Quoted 15 lines · Janosch Frank

TCG doesn't support PV.

---
   s390x/run | 5 +++++
   1 file changed, 5 insertions(+)
s390x/run +0 -0
index df7ef5ca..82922701 100755
@@ -19,6 +19,11 @@ else
       ACCEL=$DEF_ACCEL
   fi
 
Quoted 6 lines

s390x/run else · line 22

Quoted 1 line
s390x/run +1 -0
+if [ "${1: -7}" == ".pv.bin" ] || [ "${TESTNAME: -3}" == "_PV" ] && [ $ACCEL == "tcg" ]; then

Put $ACCEL in quotes?

With that nit fixed:

Should these "==" be "=" ? Bash string comparisons always mess with my mind.

Signature · 3 lines
Thanks,

David / dhildenb
#10 lore raw

Re: [kvm-unit-tests PATCH 3/3] s390x: run: Skip PV tests when tcg is the accelerator

Quoted 21 lines · David Hildenbrand
Quoted 20 lines · Thomas Huth
Quoted 12 lines · Janosch Frank

TCG doesn't support PV.

---
   s390x/run | 5 +++++

   1 file changed, 5 insertions(+)
s390x/run +0 -0
index df7ef5ca..82922701 100755
@@ -19,6 +19,11 @@ else
Quoted 4 lines

       ACCEL=$DEF_ACCEL
   fi
+if [ "${1: -7}" == ".pv.bin" ] || [ "${TESTNAME: -3}" == "_PV" ] && [ $ACCEL == "tcg" ]; then

Put $ACCEL in quotes?

Quoted 4 lines
Quoted 2 lines

With that nit fixed:

Should these "==" be "=" ? Bash string comparisons always mess with my mind.

Oh, right. I also always have to check "man test" to get the right answer, but "=" is more portable, indeed. (Well, k-u-t are hard-wired to bash, but it's better to write clean shell code anyway)

Thomas