Skip to contentSkip to conversation

qemu-iotests: Don't run the test when user is root

RFC Superseded Farhan Ali 2 participants 3 messages Nov 30, 2018 1 message not in the archive

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Farhan Ali

author
#1 lore raw

RFC v3 1/1 qemu-iotests: Don't run the test when user is root

In reply to a message not in the archive

Test 232 creates image files with read-only permission and expects an error message when trying to access the image files with read-only and auto-read-only turned off.

Don't run as root user, since root can open files with read/write access for read-only files.

---
 tests/qemu-iotests/232 | 5 +++++
 1 file changed, 5 insertions(+)
tests/qemu-iotests/232 +5 -0
index 0708b8b..1d34242 100755
@@ -92,6 +92,11 @@ echo
 
 chmod a-w $TEST_IMG
 
+if [ -w $TEST_IMG ]
+then
+    _notrun "Cannot run this test as root user"
+fi
+
 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=off
 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=on
 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on
Signature · 1 line
2.7.4
Reviewed-by on v3 1/1
#2 lore raw
Quoted 11 lines · Farhan Ali

Test 232 creates image files with read-only permission and expects an error message when trying to access the image files with read-only and auto-read-only turned off.

Don't run as root user, since root can open files with read/write access for read-only files.

---
  tests/qemu-iotests/232 | 5 +++++
  1 file changed, 5 insertions(+)

Did you mean to keep RFC in the subject line? Will patchew even spot it without PATCH in the subject line?

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
author
#3 lore raw
Quoted 8 lines · Eric Blake
Quoted 7 lines · Farhan Ali

Test 232 creates image files with read-only permission and expects an error message when trying to access the image files with read-only and auto-read-only turned off.

Don't run as root user, since root can open files with read/write access for read-only files.

Quoted 9 lines
Quoted 4 lines

---
  tests/qemu-iotests/232 | 5 +++++

  1 file changed, 5 insertions(+)

Did you mean to keep RFC in the subject line?  Will patchew even spot it without PATCH in the subject line?

Thanks for reviewing the patch. I am not sure if patchew will pick it up; I have no problem in spinning another patch but I will wait till Monday to see if anyone else has any feedback.

Thanks
Farhan