Skip to content

Commit 8cc4299

Browse files
committed
tests/rv_copyandpaste: Do no start vdagent and use root session.
Spice vdagent is started with gnome-session automatically and use root session when needed since default user for spice tests is non-root. Do not fail test If gnome-session does not run. Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
1 parent bc2ced8 commit 8cc4299

File tree

1 file changed

+29
-39
lines changed

1 file changed

+29
-39
lines changed

tests/rv_copyandpaste.py

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ def copy_and_paste_pos(session_to_copy_from, session_to_paste_to,
456456
# Before doing the copy and paste, verify vdagent is
457457
# installed and the daemon is running on the guest
458458
utils_spice.verify_vdagent(guest_session, test_timeout)
459-
# Start vdagent daemon
460-
utils_spice.start_vdagent(guest_session, test_timeout)
461459
# Make sure virtio driver is running
462460
utils_spice.verify_virtio(guest_session, test_timeout)
463461
# Command to copy text and put it in the keyboard, copy on the client
@@ -492,8 +490,6 @@ def restart_cppaste(session_to_copy_from, session_to_paste_to,
492490
# Before doing the copy and paste, verify vdagent is
493491
# installed and the daemon is running on the guest
494492
utils_spice.verify_vdagent(guest_session, test_timeout)
495-
# start vdagent daemon
496-
utils_spice.start_vdagent(guest_session, test_timeout)
497493
# Make sure virtio driver is running
498494
utils_spice.verify_virtio(guest_session, test_timeout)
499495
# Command to copy text and put it in the keyboard, copy on the client
@@ -545,8 +541,6 @@ def copy_and_paste_cpdisabled_neg(session_to_copy_from, session_to_paste_to,
545541
# Before doing the copy and paste, verify vdagent is installed and the
546542
# daemon is running on the guest
547543
utils_spice.verify_vdagent(guest_session, test_timeout)
548-
# Start vdagent for this negative test
549-
utils_spice.start_vdagent(guest_session, test_timeout)
550544
# Make sure virtio driver is running
551545
utils_spice.verify_virtio(guest_session, test_timeout)
552546
# Command to copy text and put it in the keyboard, copy on the client
@@ -584,8 +578,6 @@ def copy_and_paste_largetext(session_to_copy_from, session_to_paste_to,
584578
# Before doing the copy and paste, verify vdagent is
585579
# installed and the daemon is running on the guest
586580
utils_spice.verify_vdagent(guest_session, test_timeout)
587-
# Start vdagent
588-
utils_spice.start_vdagent(guest_session, test_timeout)
589581
# Make sure virtio driver is running
590582
utils_spice.verify_virtio(guest_session, test_timeout)
591583

@@ -627,8 +619,6 @@ def restart_cppaste_lrgtext(session_to_copy_from, session_to_paste_to,
627619
# Before doing the copy and paste, verify vdagent is
628620
# installed and the daemon is running on the guest
629621
utils_spice.verify_vdagent(guest_session, test_timeout)
630-
# Start vdagent
631-
utils_spice.start_vdagent(guest_session, test_timeout)
632622
# Make sure virtio driver is running
633623
utils_spice.verify_virtio(guest_session, test_timeout)
634624

@@ -691,8 +681,6 @@ def copy_and_paste_image_pos(session_to_copy_from, session_to_paste_to,
691681
# Before doing the copy and paste, verify vdagent is
692682
# installed and the daemon is running on the guest
693683
utils_spice.verify_vdagent(guest_session, test_timeout)
694-
# Start vdagent for this negative test
695-
utils_spice.start_vdagent(guest_session, test_timeout)
696684
# Make sure virtio driver is running
697685
utils_spice.verify_virtio(guest_session, test_timeout)
698686

@@ -760,8 +748,6 @@ def restart_cppaste_image(session_to_copy_from, session_to_paste_to,
760748
# Before doing the copy and paste, verify vdagent is
761749
# installed and the daemon is running on the guest
762750
utils_spice.verify_vdagent(guest_session, test_timeout)
763-
# Start vdagent
764-
utils_spice.start_vdagent(guest_session, test_timeout)
765751
# Make sure virtio driver is running
766752
utils_spice.verify_virtio(guest_session, test_timeout)
767753

@@ -909,8 +895,6 @@ def copyandpasteimg_cpdisabled_neg(session_to_copy_from, session_to_paste_to,
909895
# Before doing the copy and paste, verify vdagent is
910896
# installed and the daemon is running on the guest
911897
utils_spice.verify_vdagent(guest_session, test_timeout)
912-
# Start vdagent for this negative test
913-
utils_spice.start_vdagent(guest_session, test_timeout)
914898
# Make sure virtio driver is running
915899
utils_spice.verify_virtio(guest_session, test_timeout)
916900
# Command to copy text and put it in the keyboard, copy on the client
@@ -961,6 +945,9 @@ def run_rv_copyandpaste(test, params, env):
961945
guest_vm = env.get_vm(params["guest_vm"])
962946
guest_session = guest_vm.wait_for_login(
963947
timeout=int(params.get("login_timeout", 360)))
948+
guest_root_session = guest_vm.wait_for_login(
949+
timeout=int(params.get("login_timeout", 360)),
950+
username="root", password="123456")
964951
logging.info("Get PID of remote-viewer")
965952
client_session.cmd("pgrep remote-viewer")
966953

@@ -1014,11 +1001,14 @@ def run_rv_copyandpaste(test, params, env):
10141001

10151002
client_session.cmd("export DISPLAY=:0.0")
10161003

1017-
utils_spice.launch_startx(guest_vm)
1004+
# Verify that gnome is now running on the guest
1005+
try:
1006+
guest_session.cmd("ps aux | grep -v grep | grep gnome-session")
1007+
except aexpect.ShellCmdError:
1008+
raise error.TestWarn("gnome-session was probably not corretly started")
10181009

10191010
guest_session.cmd("export DISPLAY=:0.0")
1020-
# Verify that gnome is now running on the guest
1021-
guest_session.cmd("ps aux | grep -v grep | grep gnome-session")
1011+
10221012

10231013
# Make sure the clipboards are clear before starting the test
10241014
clear_cb(guest_session, params)
@@ -1034,23 +1024,23 @@ def run_rv_copyandpaste(test, params, env):
10341024
logging.info("Negative Test Case: Copy/Paste Disabled, Copying"
10351025
"Image from the Client to Guest Should Not Work\n")
10361026
copyandpasteimg_cpdisabled_neg(client_session, guest_session,
1037-
guest_session, params)
1027+
guest_root_session, params)
10381028
else:
10391029
logging.info("Negative Test Case: Copy/Paste Disabled, Copying"
10401030
" from the Client to Guest Should Not Work\n")
10411031
copy_and_paste_cpdisabled_neg(client_session, guest_session,
1042-
guest_session, params)
1032+
guest_root_session, params)
10431033
if "guest_to_client" in test_type:
10441034
if "image" in test_type:
10451035
logging.info("Negative Test Case: Copy/Paste Disabled, Copying"
10461036
"Image from the Guest to Client Should Not Work\n")
10471037
copyandpasteimg_cpdisabled_neg(guest_session, client_session,
1048-
guest_session, params)
1038+
guest_root_session, params)
10491039
else:
10501040
logging.info("Negative Test Case: Copy/Paste Disabled, Copying"
10511041
" from the Guest to Client Should Not Work\n")
10521042
copy_and_paste_cpdisabled_neg(guest_session, client_session,
1053-
guest_session, params)
1043+
guest_root_session, params)
10541044

10551045
elif "positive" in test_type:
10561046
# These are positive tests, where the clipboards are synced because
@@ -1060,61 +1050,61 @@ def run_rv_copyandpaste(test, params, env):
10601050
if "restart" in test_type:
10611051
logging.info("Restart Vdagent, Cp Img Client to Guest")
10621052
restart_cppaste_image(client_session, guest_session,
1063-
guest_session, params)
1053+
guest_root_session, params)
10641054
else:
10651055
logging.info("Copying an Image from the Client to Guest")
10661056
copy_and_paste_image_pos(client_session, guest_session,
1067-
guest_session, params)
1057+
guest_root_session, params)
10681058
elif testing_text.isdigit():
10691059
if "restart" in test_type:
10701060
logging.info("Restart Vdagent, Copying a String of size "
10711061
+ testing_text + " from the Client to Guest")
10721062
restart_cppaste_lrgtext(client_session, guest_session,
1073-
guest_session, params)
1063+
guest_root_session, params)
10741064
else:
10751065
logging.info("Copying a String of size " + testing_text +
10761066
" from the Client to Guest")
10771067
copy_and_paste_largetext(client_session, guest_session,
1078-
guest_session, params)
1068+
guest_root_session, params)
10791069
else:
10801070
if "restart" in test_type:
10811071
logging.info("Restart Vdagent, Copying from Client to Guest\n")
10821072
restart_cppaste(client_session, guest_session,
1083-
guest_session, params)
1073+
guest_root_session, params)
10841074
else:
10851075
logging.info("Copying from the Client to Guest\n")
10861076
copy_and_paste_pos(client_session, guest_session,
1087-
guest_session, params)
1077+
guest_root_session, params)
10881078
if "guest_to_client" in test_type:
10891079
if "image" in test_type:
10901080
if "restart" in test_type:
10911081
logging.info("Restart Vdagent, Copy Img Guest to Client")
10921082
restart_cppaste_image(guest_session, client_session,
1093-
guest_session, params)
1083+
guest_root_session, params)
10941084
else:
10951085
logging.info("Copying an Image from the Guest to Client")
10961086
copy_and_paste_image_pos(guest_session, client_session,
1097-
guest_session, params)
1087+
guest_root_session, params)
10981088
elif testing_text.isdigit():
10991089
if "restart" in test_type:
11001090
logging.info("Restart Vdagent, Copying a String of size "
11011091
+ testing_text + " from the Guest to Client")
11021092
restart_cppaste_lrgtext(guest_session, client_session,
1103-
guest_session, params)
1093+
guest_root_session, params)
11041094
else:
11051095
logging.info("Copying a String of size " + testing_text +
11061096
" from the Guest to Client")
11071097
copy_and_paste_largetext(guest_session, client_session,
1108-
guest_session, params)
1098+
guest_root_session, params)
11091099
else:
11101100
if "restart" in test_type:
11111101
logging.info("Restart Vdagent, Copying: Client to Guest\n")
11121102
restart_cppaste(guest_session, client_session,
1113-
guest_session, params)
1103+
guest_root_session, params)
11141104
else:
11151105
logging.info("Copying from the Guest to Client\n")
11161106
copy_and_paste_pos(guest_session, client_session,
1117-
guest_session, params)
1107+
guest_root_session, params)
11181108
elif "negative" in test_type:
11191109
# These are negative tests, where the clipboards are not synced because
11201110
# the spice-vdagent service will not be running on the guest.
@@ -1123,23 +1113,23 @@ def run_rv_copyandpaste(test, params, env):
11231113
logging.info("Negative Test Case: Copying an Image from the "
11241114
"Client to Guest")
11251115
copy_and_paste_image_neg(client_session, guest_session,
1126-
guest_session, params)
1116+
guest_root_session, params)
11271117
else:
11281118
logging.info("Negative Test Case: Copying from the Client to"
11291119
"Guest Should Not Work\n")
11301120
copy_and_paste_neg(client_session, guest_session,
1131-
guest_session, params)
1121+
guest_root_session, params)
11321122
if "guest_to_client" in test_type:
11331123
if "image" in test_type:
11341124
logging.info("Negative Test Case: Copying an Image from the "
11351125
"Guest to Client")
11361126
copy_and_paste_image_neg(guest_session, client_session,
1137-
guest_session, params)
1127+
guest_root_session, params)
11381128
else:
11391129
logging.info("Negative Test Case: Copying from the Guest to"
11401130
" Client Should Not Work\n")
11411131
copy_and_paste_neg(guest_session, client_session,
1142-
guest_session, params)
1132+
guest_root_session, params)
11431133
else:
11441134
# The test is not supported, verify what is a supported test.
11451135
raise error.TestFail("Couldn't Find the Correct Test To Run")

0 commit comments

Comments
 (0)