@@ -170,10 +170,17 @@ class TestConfig:
170
170
preload_max = MAX_CONCURRENCY ,
171
171
),
172
172
TestConfig ("dispvm-api" , admin_api = True ),
173
- TestConfig ("dispvm-concurrent-api" , concurrent = True , admin_api = True ),
173
+ TestConfig (
174
+ "dispvm-concurrent-api" ,
175
+ concurrent = True ,
176
+ admin_api = True ,
177
+ ),
174
178
TestConfig ("dispvm-gui-api" , gui = True , admin_api = True ),
175
179
TestConfig (
176
- "dispvm-gui-concurrent-api" , gui = True , concurrent = True , admin_api = True
180
+ "dispvm-gui-concurrent-api" ,
181
+ gui = True ,
182
+ concurrent = True ,
183
+ admin_api = True ,
177
184
),
178
185
TestConfig (
179
186
"dispvm-preload-more-api" ,
@@ -189,7 +196,7 @@ class TestConfig:
189
196
TestConfig (
190
197
"dispvm-preload-concurrent-api" ,
191
198
concurrent = True ,
192
- preload_max = MAX_PRELOAD ,
199
+ preload_max = MAX_CONCURRENCY ,
193
200
admin_api = True ,
194
201
),
195
202
TestConfig (
@@ -202,12 +209,18 @@ class TestConfig:
202
209
"dispvm-preload-gui-concurrent-api" ,
203
210
gui = True ,
204
211
concurrent = True ,
205
- preload_max = MAX_PRELOAD ,
212
+ preload_max = MAX_CONCURRENCY ,
206
213
admin_api = True ,
207
214
),
208
215
]
209
216
210
217
218
+ def get_load () -> str :
219
+ with open ("/proc/loadavg" , "r" , encoding = "ascii" ) as file :
220
+ load = file .read ()
221
+ return load .rstrip ()
222
+
223
+
211
224
def get_time ():
212
225
return time .clock_gettime (time .CLOCK_MONOTONIC )
213
226
@@ -327,8 +340,12 @@ def run_latency_calls(self, test):
327
340
f" { e .stdout } ,"
328
341
f" { e .stderr } "
329
342
)
330
- except subprocess .TimeoutExpired :
331
- raise Exception (f"service '{ cmd } ' failed: timeout expired" )
343
+ except subprocess .TimeoutExpired as e :
344
+ raise Exception (
345
+ f"service '{ cmd } ' failed: timeout expired:"
346
+ f" { e .stdout } ,"
347
+ f" { e .stderr } "
348
+ )
332
349
end_time = get_time ()
333
350
return round (end_time - start_time , ROUND_PRECISION )
334
351
@@ -342,17 +359,22 @@ def call_api(self, test, service, qube):
342
359
target_qube = self .vm1
343
360
else :
344
361
target_qube = qubesadmin .vm .DispVM .from_appvm (app , appvm )
362
+ name = target_qube .name
345
363
target_time = get_time ()
346
364
try :
347
365
target_qube .run_service_for_stdio (service , timeout = 60 )
348
366
except subprocess .CalledProcessError as e :
349
367
raise Exception (
350
- f"service '{ service } ' failed ({ e .returncode } ):"
368
+ f"'{ name } ': service '{ service } ' failed ({ e .returncode } ):"
369
+ f" { e .stdout } ,"
370
+ f" { e .stderr } "
371
+ )
372
+ except subprocess .TimeoutExpired as e :
373
+ raise Exception (
374
+ f"'{ name } ': service '{ service } ' failed: timeout expired:"
351
375
f" { e .stdout } ,"
352
376
f" { e .stderr } "
353
377
)
354
- except subprocess .TimeoutExpired :
355
- raise Exception (f"service '{ service } ' failed: timeout expired" )
356
378
run_service_time = get_time ()
357
379
if not test .non_dispvm :
358
380
target_qube .cleanup ()
@@ -514,6 +536,7 @@ def run_test(self, test: TestConfig):
514
536
preload_max = test .preload_max
515
537
self .dvm .features ["preload-dispvm-max" ] = str (preload_max )
516
538
asyncio .run (self .wait_preload (preload_max ))
539
+ print (f"Load before test: '{ get_load ()} '" )
517
540
if test .admin_api :
518
541
result = self .run_latency_api_calls (test )
519
542
else :
@@ -534,6 +557,18 @@ def run_test(self, test: TestConfig):
534
557
if orig_preload_max != 0 :
535
558
asyncio .run (self .wait_preload (orig_preload_max ))
536
559
os .unlink (POLICY_FILE )
560
+ if not os .getenv ("QUBES_TEST_SKIP_TEARDOWN_SLEEP" ):
561
+ print (f"Load before sleep: '{ get_load ()} '" )
562
+ delay = 5
563
+ if not test .non_dispvm :
564
+ delay += 10
565
+ if test .gui :
566
+ delay += 2
567
+ if test .concurrent :
568
+ delay += 8
569
+ print (f"Sleeping for '{ delay } ' seconds" )
570
+ time .sleep (delay )
571
+ print (f"Load after sleep: '{ get_load ()} '" )
537
572
538
573
539
574
def main ():
@@ -567,7 +602,7 @@ def main():
567
602
if args .iterations :
568
603
run .iterations = args .iterations
569
604
570
- for index , test in enumerate ( tests ) :
605
+ for test in tests :
571
606
run .run_test (test )
572
607
573
608
0 commit comments