forked from open-power/op-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
op-test
executable file
·1030 lines (853 loc) · 33.9 KB
/
op-test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: op-test-framework/ci/source/op_ci_bmc.py $
#
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2015-2017
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
"""
op-test: run OpenPOWER test suite(s)
"""
from testcases import HelloWorld
import testcases
from testcases import PetitbootMMU
from testcases import RunHostTest
from testcases import OpTestRebootTimeout
from testcases import OpTestMtdPnorDriver
from testcases import OpTestMamboSim
from testcases import IpmiTorture
from testcases import InstallUpstreamKernel
from testcases import EMStress
from testcases import ConsoleBug150765
from testcases import BootTorture
from testcases import BMCResetTorture
from testcases import OpTestKernelArg
from testcases import EnergyScale_BaseLine
from testcases import CpuHotPlug
from testcases import IplParams
from testcases import TrustedBoot
from testcases import SecureBoot
from testcases import OpalSysfsTests
from testcases import gcov
from testcases import OpTestOpenCAPI
from testcases import OpTestCAPI
from testcases import InstallHostOS
from testcases import InstallRhel
from testcases import InstallUbuntu
from testcases import PciSlotLocCodes
from testcases import DeviceTreeWarnings
from testcases import DeviceTreeValidation
from testcases import SbePassThrough
from testcases import OpalGard
from testcases import OpTestPNOR
from testcases import testCronus
from testcases import testRestAPI
from testcases import Console
from testcases import fspTODCorruption
from testcases import OpalUtils
from testcases import OpTestPrdDaemon
from testcases import fspresetReload
from testcases import PowerNVDump
from testcases import EPOW
from testcases import DPO
from testcases import LightPathDiagnostics
from testcases import OpalErrorLog
from testcases import OpTestFlash
from testcases import KernelLog
from testcases import OpalMsglog
from testcases import SystemLogin
from testcases import OpTestDumps
from testcases import OpTestSystemBootSequence
from testcases import OpTestOCC
from testcases import OpTestOOBIPMI
from testcases import OpTestNVRAM
from testcases import OpTestInbandUsbInterface
from testcases import OpTestInbandIPMI
from testcases import OpTestIPMIReprovision
from testcases import OpTestIPMILockMode
from testcases import I2C
from testcases import OpTestHeartbeat
from testcases import OpTestHMIHandling
from testcases import OpTestFastReboot
from testcases import OpTestEnergyScale
from testcases import OpTestEEH
from testcases import AT24driver
from testcases import OpTestEM
from testcases import OpTestRTCdriver
from testcases import Petitbooti18n
from testcases import PetitbootDropbearServer
from testcases import BasicIPL
from testcases import FWTS
from testcases import OpTestPCI
from testcases import OpTestPrdDriver
from testcases import OpTestSensors
from testcases import OpTestSwitchEndianSyscall
from testcases import OpTestHostboot
from testcases import OpTestExample
from testcases import OpTestDlparIO
from testcases import OpTestLPM
import OpTestConfiguration
import sys
import time
import traceback
import os
import unittest
import re
import signal
import logging
import OpTestLogger
# op-test is the parent logger
optestlog = logging.getLogger(OpTestLogger.optest_logger_glob.parent_logger)
OpTestConfiguration.conf = OpTestConfiguration.OpTestConfiguration()
def optest_handler(signum, frame):
# CURRENTLY we do NOT have any artifacts needing cleanup
# during the exposed signal handler window when the OpTestConfiguration
# object is not bootstrapped
# Future design consideration should provide parent/child
# structure to monitor for signals if needing to close this exposure
signal_dict = dict((key, value) for value, key in reversed(sorted(signal.__dict__.items()))
if value.startswith('SIG') and not value.startswith('SIG_'))
if OpTestConfiguration.conf.signal_ready == True:
OpTestConfiguration.conf.util.cleanup()
traceback.print_stack()
optestlog.error("OpTestSystem exiting from signal '{}' signum={}".format(
signal_dict[signum], signum))
os._exit(1)
# do not use sys.exit, sys.exit in python throws an exception
# to the stack frame executing at the time the signal is received
# by the python interpreter, if the exception was caught during some other
# try/except block, control will be given back to that block
signal.signal(signal.SIGHUP, optest_handler)
signal.signal(signal.SIGINT, optest_handler)
signal.signal(signal.SIGQUIT, optest_handler)
signal.signal(signal.SIGILL, optest_handler)
signal.signal(signal.SIGABRT, optest_handler)
signal.signal(signal.SIGFPE, optest_handler)
signal.signal(signal.SIGSEGV, optest_handler)
signal.signal(signal.SIGTERM, optest_handler)
signal.signal(signal.SIGUSR1, optest_handler)
signal.signal(signal.SIGUSR2, optest_handler)
# parse config options and create log files, take the host lock, etc.
try:
args, remaining_args = OpTestConfiguration.conf.parse_args(sys.argv)
except Exception as e:
print("Config error: {}".format(e));
sys.exit(1)
def print_tests(s):
for test in s:
if isinstance(test, unittest.TestSuite):
print_tests(test)
else:
test_id = test.id()
print('{0:40}'.format(test_id))
if OpTestConfiguration.conf.args.list_all_tests:
print_tests(unittest.TestLoader().discover('testcases', '*.py'))
exit(0)
# create loggers, take hostlocks, etc
try:
OpTestConfiguration.conf.do_testing_setup()
except Exception as e:
print()
print("Test setup error! {}".format(e));
print()
print(traceback.format_exc())
print()
OpTestConfiguration.conf.util.cleanup()
sys.exit(1)
OpTestConfiguration.conf.objs()
class SystemAccessSuite():
'''
Tests all system interfaces
'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(SystemLogin.system_access_suite())
def suite(self):
return self.s
class StandbySuite():
'''Machine at standby. Focused on BMC'''
def __init__(self):
self.s = unittest.TestSuite()
# self.s.addTest(OpTestEnergyScale.standby_suite())
def suite(self):
return self.s
class SkirootSuite():
'''Tests in Petitboot environment'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(BasicIPL.GotoPetitbootShell())
# disabling DeviceTreeWarnings temporarily
# self.s.addTest(DeviceTreeWarnings.Skiroot())
self.s.addTest(unittest.TestLoader(
).loadTestsFromTestCase(IplParams.Skiroot))
# disabling temporarily
# self.s.addTest(SecureBoot.VerifyOPALSecureboot())
self.s.addTest(TrustedBoot.VerifyOPALTrustedBoot())
# disabling OpTestEM temporarily
# self.s.addTest(OpTestEM.skiroot_suite())
self.s.addTest(OpTestInbandIPMI.skiroot_full_suite())
self.s.addTest(OpTestInbandUsbInterface.skiroot_full_suite())
self.s.addTest(OpTestRTCdriver.SkirootRTC())
# disabling temporarily
# self.s.addTest(AT24driver.SkirootAT24())
self.s.addTest(I2C.BasicSkirootI2C())
self.s.addTest(PciSlotLocCodes.SkirootDT())
self.s.addTest(OpTestPCI.skiroot_suite())
self.s.addTest(PetitbootDropbearServer.PetitbootDropbearServer())
self.s.addTest(Petitbooti18n.Petitbooti18n())
self.s.addTest(OpTestFastReboot.OpTestFastReboot())
self.s.addTest(OpTestHeartbeat.HeartbeatSkiroot())
self.s.addTest(OpTestNVRAM.SkirootNVRAM())
self.s.addTest(Console.suite())
self.s.addTest(OpTestPNOR.Skiroot())
self.s.addTest(DeviceTreeValidation.DeviceTreeValidationSkiroot())
# disabling temporarily
# self.s.addTest(unittest.TestLoader().loadTestsFromTestCase(OpalSysfsTests.Skiroot))
# disabling OpalMsglog temporarily
# self.s.addTest(OpalMsglog.Skiroot())
# disabling KernelLog temporarily
# self.s.addTest(KernelLog.Skiroot())
self.s.addTest(gcov.Skiroot())
self.s.addTest(DPO.DPOSkiroot())
# self.s.addTest(OpTestEnergyScale.runtime_suite())
self.s.addTest(PetitbootMMU.PetitbootMMU())
def suite(self):
return self.s
class MamboSuite():
'''Tests in Petitboot environment under Mambo'''
def __init__(self):
# All of the commented out suites should be eventually enabled
self.s = unittest.TestSuite()
self.s.addTest(BasicIPL.GotoPetitbootShell())
self.s.addTest(DeviceTreeWarnings.Skiroot())
# self.s.addTest(unittest.TestLoader().loadTestsFromTestCase(IplParams.Skiroot))
self.s.addTest(SecureBoot.VerifyOPALSecureboot())
self.s.addTest(TrustedBoot.VerifyOPALTrustedBoot())
# self.s.addTest(OpTestEM.skiroot_suite())
self.s.addTest(OpTestInbandIPMI.skiroot_full_suite())
self.s.addTest(OpTestInbandUsbInterface.skiroot_full_suite())
self.s.addTest(OpTestRTCdriver.SkirootRTC())
# self.s.addTest(AT24driver.SkirootAT24())
self.s.addTest(I2C.BasicSkirootI2C())
self.s.addTest(PciSlotLocCodes.SkirootDT())
self.s.addTest(OpTestPCI.skiroot_suite())
self.s.addTest(PetitbootDropbearServer.PetitbootDropbearServer())
self.s.addTest(Petitbooti18n.Petitbooti18n())
self.s.addTest(OpTestFastReboot.OpTestFastReboot())
self.s.addTest(OpTestHeartbeat.HeartbeatSkiroot())
self.s.addTest(OpTestNVRAM.SkirootNVRAM())
# self.s.addTest(Console.suite())
self.s.addTest(OpTestPNOR.Skiroot())
self.s.addTest(DeviceTreeValidation.DeviceTreeValidationSkiroot())
self.s.addTest(unittest.TestLoader().loadTestsFromTestCase(
OpalSysfsTests.Skiroot))
self.s.addTest(OpalMsglog.Skiroot())
self.s.addTest(KernelLog.Skiroot())
self.s.addTest(DPO.DPOSkiroot())
# self.s.addTest(OpTestEnergyScale.runtime_suite())
self.s.addTest(PetitbootMMU.PetitbootMMU())
def suite(self):
return self.s
class HostSuite():
'''Tests run in booted OS'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(SystemLogin.OOBHostLogin())
# disabling temporarily
# self.s.addTest(DeviceTreeWarnings.Host())
self.s.addTest(OpTestOCC.basic_suite())
self.s.addTest(unittest.TestLoader(
).loadTestsFromTestCase(IplParams.Host))
self.s.addTest(OpTestPrdDriver.OpTestPrdDriver())
self.s.addTest(PciSlotLocCodes.HostDT())
self.s.addTest(OpTestPCI.host_suite())
self.s.addTest(FWTS.FWTS())
self.s.addTest(OpTestRTCdriver.BasicRTC())
# disabling temporarily
# self.s.addTest(OpTestEM.host_suite())
self.s.addTest(AT24driver.AT24driver())
self.s.addTest(I2C.BasicI2C())
self.s.addTest(OpTestIPMILockMode.OpTestIPMILockMode())
self.s.addTest(OpTestInbandIPMI.basic_suite())
self.s.addTest(OpTestInbandUsbInterface.basic_suite())
self.s.addTest(OpTestNVRAM.HostNVRAM())
self.s.addTest(OpTestHeartbeat.HeartbeatHost())
self.s.addTest(OpTestSensors.OpTestSensors())
self.s.addTest(OpalErrorLog.BasicTest())
self.s.addTest(OpTestPrdDaemon.OpTestPrdDaemon())
self.s.addTest(SbePassThrough.SbePassThrough())
self.s.addTest(DeviceTreeValidation.DeviceTreeValidationHost())
# disabling temporarily
# self.s.addTest(unittest.TestLoader().loadTestsFromTestCase(OpalSysfsTests.Host))
# disabling temporarily
# self.s.addTest(KernelLog.Host()) # We run before HMI to clear out HMI errors from kernel log
self.s.addTest(OpTestHMIHandling.suite())
self.s.addTest(OpTestPNOR.Host())
# disabling temporarily
# self.s.addTest(OpalMsglog.Host())
# self.s.addTest(KernelLog.Host())
self.s.addTest(OpTestOCC.OCC_RESET())
self.s.addTest(gcov.Host())
def suite(self):
return self.s
class ExperimentalSuite():
'''Tests that need further development'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestEEH.suite())
# SwitchEndian is here as we need to resolve issue of running
# kernel self-tests as part of op-test or not.
self.s.addTest(OpTestSwitchEndianSyscall.OpTestSwitchEndianSyscall())
def suite(self):
return self.s
class BasicIPLSuite():
'''Basic boot/reboot power on/off'''
def suite(self):
return BasicIPL.suite()
class SBSuite():
'''Secure boot tests'''
def suite(self):
return SecureBoot.secureboot_suite()
class TBSuite():
'''Trusted boot tests'''
def suite(self):
return TrustedBoot.trustedboot_suite()
class DefaultSuite():
'''Basic regression tests'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(SkirootSuite().suite())
if OpTestConfiguration.conf.args.host_scratch_disk:
self.s.addTest(InstallHost().suite())
self.s.addTest(HostSuite().suite())
def suite(self):
return self.s
class QemuSuite():
'''Basic regression tests'''
def __init__(self):
# this is the same as Skiroot, but with currently
# failing tests disabled
self.s = unittest.TestSuite()
self.s.addTest(BasicIPL.GotoPetitbootShell())
# Currently we have some device tree warnings
# self.s.addTest(DeviceTreeWarnings.Skiroot())
# self.s.addTest(unittest.TestLoader().loadTestsFromTestCase(IplParams.Skiroot))
self.s.addTest(SecureBoot.VerifyOPALSecureboot())
self.s.addTest(TrustedBoot.VerifyOPALTrustedBoot())
self.s.addTest(OpTestEM.skiroot_suite())
self.s.addTest(OpTestInbandIPMI.skiroot_full_suite())
self.s.addTest(OpTestInbandUsbInterface.skiroot_full_suite())
self.s.addTest(OpTestRTCdriver.SkirootRTC())
self.s.addTest(AT24driver.SkirootAT24())
self.s.addTest(I2C.BasicSkirootI2C())
# self.s.addTest(PciSlotLocCodes.SkirootDT())
self.s.addTest(OpTestPCI.skiroot_suite())
self.s.addTest(PetitbootDropbearServer.PetitbootDropbearServer())
self.s.addTest(Petitbooti18n.Petitbooti18n())
self.s.addTest(OpTestFastReboot.OpTestFastReboot())
self.s.addTest(OpTestHeartbeat.HeartbeatSkiroot())
self.s.addTest(OpTestNVRAM.SkirootNVRAM())
self.s.addTest(Console.suite())
self.s.addTest(OpTestPNOR.Skiroot())
self.s.addTest(DeviceTreeValidation.DeviceTreeValidationSkiroot())
self.s.addTest(unittest.TestLoader().loadTestsFromTestCase(
OpalSysfsTests.Skiroot))
self.s.addTest(OpalMsglog.Skiroot())
self.s.addTest(KernelLog.Skiroot())
self.s.addTest(DPO.DPOSkiroot())
self.s.addTest(PetitbootMMU.PetitbootMMU())
def suite(self):
return self.s
class FullSuite():
'''Every stable test'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(BasicIPLSuite().suite())
self.s.addTest(DefaultSuite().suite())
self.s.addTest(testRestAPI.runtime_suite())
self.s.addTest(OpalGard.OpalGard())
self.s.addTest(OpalUtils.OpalUtils())
self.s.addTest(OpTestRTCdriver.HostRTC())
self.s.addTest(OpTestInbandIPMI.full_suite())
self.s.addTest(OpTestInbandUsbInterface.full_suite())
self.s.addTest(I2C.FullI2C())
self.s.addTest(OpTestSensors.OpTestSensors())
self.s.addTest(LightPathDiagnostics.suite())
self.s.addTest(OpalErrorLog.FullTest())
self.s.addTest(OpTestSwitchEndianSyscall.OpTestSwitchEndianSyscall())
self.s.addTest(OpalMsglog.Host())
self.s.addTest(KernelLog.Host())
def suite(self):
return self.s
class OpTestEMHostSuite():
'''Energy Management'''
def __init__(self):
self.s = unittest.TestSuite()
def suite(self):
self.s.addTest(OpTestEM.host_suite())
self.s.addTest(EnergyScale_BaseLine.EnergyScale_BaseLine())
self.s.addTest(unittest.TestLoader(
).loadTestsFromTestCase(OpalSysfsTests.Host))
self.s.addTest(OpTestSensors.OpTestSensors())
self.s.addTest(CpuHotPlug.CpuHotPlug())
self.s.addTest(OCCSuite().suite())
self.s.addTest(OpTestSensors.OpTestSensors())
return self.s
class OpTestEMSuite():
'''Energy Management'''
def __init__(self):
self.s = unittest.TestSuite()
def suite(self):
self.s.addTest(OpTestEMHostSuite().suite())
self.s.addTest(OpTestEM.skiroot_suite())
return self.s
class BasicPCISuite():
'''Basic PCI Suite'''
def __init__(self):
self.s = unittest.TestSuite()
def suite(self):
self.s.addTest(OpTestPCI.skiroot_suite())
self.s.addTest(OpTestPCI.host_suite())
return self.s
class OpTestEEHSuite():
'''PCI EEH error recovery'''
def suite(self):
return OpTestEEH.suite()
class HMISuite():
'''HMI handling'''
def suite(self):
return OpTestHMIHandling.suite()
class ExperimentalHMISuite():
def suite(self):
return OpTestHMIHandling.experimental_suite()
class UnrecoverableHMISuite():
def suite(self):
return OpTestHMIHandling.unrecoverable_suite()
class OpTestEnergyScaleSuite():
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestEnergyScale.standby_suite())
self.s.addTest(OpTestEnergyScale.runtime_suite())
def suite(self):
return self.s
class BrokenReprovisionSuite():
def suite(self):
return OpTestIPMIReprovision.broken_suite()
class ExperimentalReprovisionSuite():
def suite(self):
return OpTestIPMIReprovision.experimental_suite()
class InbandIPMISuite():
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestInbandIPMI.basic_suite())
self.s.addTest(OpTestInbandIPMI.full_suite())
self.s.addTest(OpTestInbandUsbInterface.basic_suite())
self.s.addTest(OpTestInbandUsbInterface.full_suite())
self.s.addTest(OpTestInbandIPMI.skiroot_basic_suite())
self.s.addTest(OpTestInbandIPMI.skiroot_full_suite())
self.s.addTest(OpTestInbandUsbInterface.skiroot_full_suite())
def suite(self):
return self.s
class OutofbandIPMISuite():
'''Out of band IPMI'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestOOBIPMI.basic_suite())
self.s.addTest(OpTestOOBIPMI.standby_suite())
self.s.addTest(OpTestOOBIPMI.runtime_suite())
def suite(self):
return self.s
class RestAPISuite():
'''REST API(OpenBMC Specific Out of band management)'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(testRestAPI.runtime_suite())
self.s.addTest(testRestAPI.host_off_suite())
def suite(self):
return self.s
class CronusSuite():
'''Cronus'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(testCronus.runtime_suite())
self.s.addTest(testCronus.host_off_suite())
def suite(self):
return self.s
class OCCSuite():
'''OCC Test Suite'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestOCC.OCC_RESET())
self.s.addTest(OpTestOCC.basic_suite())
self.s.addTest(OpTestOCC.full_suite())
self.s.addTest(OpTestOCC.OCCRESET_FSP())
def suite(self):
return self.s
class CAPISuite():
'''CAPI Tests'''
def suite(self):
return OpTestCAPI.capi_test_suite()
class OpenCAPISuite():
'''OpenCAPI Tests'''
def suite(self):
return OpTestOpenCAPI.opencapi_test_suite()
class SystemIPLSuite():
'''System IPL's'''
def suite(self):
return OpTestSystemBootSequence.suite()
class CrashSuite():
'''Crash Test Suite'''
def suite(self):
return PowerNVDump.crash_suite()
class OSdumpSuite():
'''Crash Test Suite which Verify operating System Crash Dump Functionality'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(PowerNVDump.KernelCrash_OnlyKdumpEnable())
self.s.addTest(PowerNVDump.KernelCrash_KdumpSSH())
self.s.addTest(PowerNVDump.KernelCrash_KdumpNFS())
def suite(self):
return self.s
class DlparIOSuite():
'''DlparIO Test Suite'''
def suite(self):
return OpTestDlparIO.DlparIO_suite()
class LPMSuite():
'''LPM Test Suite'''
def suite(self):
return OpTestLPM.LPM_suite()
class FspOpalSuite():
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestDumps.suite())
self.s.addTest(OpalErrorLog.BasicTest())
self.s.addTest(OpalErrorLog.FullTest())
self.s.addTest(LightPathDiagnostics.extended_suite())
self.s.addTest(fspresetReload.suite())
self.s.addTest(EPOW.suite())
self.s.addTest(OpTestOCC.OCCRESET_FSP())
self.s.addTest(fspTODCorruption.suite())
def suite(self):
return self.s
class KnownBugs():
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(Console.Console32k())
self.s.addTest(Console.ControlC())
def suite(self):
return self.s
class FlashFirmware():
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(testcases.OpTestFlash.FSPFWImageFLASH())
self.s.addTest(testcases.OpTestFlash.BmcImageFlash())
self.s.addTest(testcases.OpTestFlash.PNORFLASH())
self.s.addTest(testcases.OpTestFlash.OpalLidsFLASH())
def suite(self):
return self.s
class InstallHost():
def __init__(self):
self.s = unittest.TestSuite()
conf = OpTestConfiguration.conf
target = conf.args.os_repo if conf.args.os_repo else conf.args.os_cdrom
if conf.args.host_scratch_disk and target:
if "ubuntu" in target.lower():
self.s.addTest(InstallUbuntu.InstallUbuntu())
optestlog.info('InstallUbuntu added to default suite')
elif "rhel" or "fedora" in target.lower():
self.s.addTest(InstallRhel.InstallRhel())
optestlog.info('InstallRhel added to default suite')
elif "hostos" in target.lower():
self.s.addTest(InstallHostOS.InstallHostOS())
optestlog.info('InstallHostOS added to default suite')
else:
optestlog.info(
"Could not parse OS name from '{}'".format(target))
conf.util.cleanup()
exit(-1)
else:
optestlog.info("Missing parameters for InstallHost suite, if this"
" is unexpected, check AES/Hostlocker for Attached Disk."
" This was triggered with host_scratch_disk={} target={}"
.format(conf.args.host_scratch_disk, target))
conf.util.cleanup()
exit(-1)
def suite(self):
return self.s
class OpPCIRegressionSuite():
'''Tests covering PCI'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestPCI.skiroot_hardboot_suite())
self.s.addTest(OpTestPCI.host_hardboot_suite())
self.s.addTest(OpTestPCI.skiroot_softboot_suite())
self.s.addTest(OpTestPCI.host_softboot_suite())
def suite(self):
return self.s
class OpTestHostbootSuite():
'''Tests in OpTestHostboot'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestHostboot.skiroot_full_suite())
self.s.addTest(OpTestHostboot.host_full_suite())
self.s.addTest(PowerNVDump.SBECrash_MPIPL())
def suite(self):
return self.s
class OpTestExampleSuite():
'''Tests in OpTestExample'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestExample.skiroot_full_suite())
self.s.addTest(OpTestExample.host_full_suite())
def suite(self):
return self.s
class OpenBMCPalmettoSkirootSuite():
'''Tests that pass for an OpenBMC Palmetto, restricted to Petitboot environment'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(BasicIPL.GotoPetitbootShell())
# fails due to many DT warnings.
# self.s.addTest(DeviceTreeWarnings.Skiroot())
# fails
# self.s.addTest(unittest.TestLoader().loadTestsFromTestCase(IplParams.Skiroot))
# fails CAPP verification
# self.s.addTest(SecureBoot.VerifyOPALSecureboot())
self.s.addTest(TrustedBoot.VerifyOPALTrustedBoot())
self.s.addTest(OpTestEM.skiroot_suite())
# No FRUs for Palmetto, other tests do work though.
# self.s.addTest(OpTestInbandIPMI.skiroot_full_suite())
# self.s.addTest(OpTestInbandUsbInterface.skiroot_full_suite())
self.s.addTest(OpTestRTCdriver.SkirootRTC())
# We're having some strange I2c issues, so disable these
# self.s.addTest(AT24driver.SkirootAT24())
# self.s.addTest(I2C.BasicSkirootI2C())
self.s.addTest(PciSlotLocCodes.SkirootDT())
self.s.addTest(OpTestPCI.skiroot_suite())
self.s.addTest(PetitbootDropbearServer.PetitbootDropbearServer())
self.s.addTest(Petitbooti18n.Petitbooti18n())
self.s.addTest(OpTestFastReboot.OpTestFastReboot())
self.s.addTest(OpTestHeartbeat.HeartbeatSkiroot())
self.s.addTest(OpTestNVRAM.SkirootNVRAM())
self.s.addTest(Console.suite())
# We seem to be hitting a failure :/
# self.s.addTest(OpTestPNOR.Skiroot())
self.s.addTest(DeviceTreeValidation.DeviceTreeValidationSkiroot())
self.s.addTest(unittest.TestLoader().loadTestsFromTestCase(
OpalSysfsTests.Skiroot))
# duplicate sensors and partition verification fails
# self.s.addTest(OpalMsglog.Skiroot())
self.s.addTest(KernelLog.Skiroot())
self.s.addTest(DPO.DPOSkiroot())
# self.s.addTest(OpTestEnergyScale.runtime_suite())
def suite(self):
return self.s
class OpTestPerCommitSuite():
'''Simple Suite to run for CI on per-commit basis'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestExample.skiroot_full_suite())
self.s.addTest(OpTestExample.host_full_suite())
self.s.addTest(SystemLogin.system_access_suite())
def suite(self):
return self.s
class OpTestPullRequestSuite():
'''Simple Suite to run for CI on pull-request basis'''
def __init__(self):
self.s = unittest.TestSuite()
self.s.addTest(OpTestExample.skiroot_full_suite())
self.s.addTest(OpTestExample.host_full_suite())
self.s.addTest(SystemLogin.system_access_suite())
def suite(self):
return self.s
suites = {
'system-access': SystemAccessSuite(),
'skiroot': SkirootSuite(),
'host': HostSuite(),
'default': DefaultSuite(),
'qemu': QemuSuite(),
'mambo': MamboSuite(),
'BasicIPL': BasicIPLSuite(),
'BasicPCI': BasicPCISuite(),
'secure-boot': SBSuite(),
'trusted-boot': TBSuite(),
'em': OpTestEMSuite(),
'em-host': OpTestEMHostSuite(),
'known-bugs': KnownBugs(),
'experimental': ExperimentalSuite(),
'experimental-eeh': OpTestEEHSuite(),
'experimental-energyscale': OpTestEnergyScaleSuite(),
'standby': StandbySuite(),
'hmi': HMISuite(),
'experimental-hmi': ExperimentalHMISuite(),
'experimental-unrecoverable-hmi': UnrecoverableHMISuite(),
'experimental-reprovision': ExperimentalReprovisionSuite(),
'broken-reprovision': BrokenReprovisionSuite(),
'full-inbandipmi': InbandIPMISuite(),
'full-outofbandipmi': OutofbandIPMISuite(),
'rest-api': RestAPISuite(),
'cronus': CronusSuite(),
'full-occ': OCCSuite(),
'capi': CAPISuite(),
'opencapi': OpenCAPISuite(),
'crash-suite': CrashSuite(),
'osdump-suite': OSdumpSuite(),
'dlpario-suite': DlparIOSuite(),
'lpm-suite': LPMSuite(),
'system-ipl': SystemIPLSuite(),
'fsp-opal-suite': FspOpalSuite(),
'full': FullSuite(),
'hostboot': OpTestHostbootSuite(),
'example': OpTestExampleSuite(),
'pci-regression': OpPCIRegressionSuite(),
'palmetto-ci': OpenBMCPalmettoSkirootSuite(),
'per-commit': OpTestPerCommitSuite(),
'pull-request': OpTestPullRequestSuite(),
}
try:
# Loop through the addons and load in suites defined there
for opt in OpTestConfiguration.optAddons:
suites = OpTestConfiguration.optAddons[opt].addSuites(suites)
if OpTestConfiguration.conf.args.list_suites:
print('{0:34}{1}'.format('Test Suite', 'Description'))
print('{0:34}{1}'.format('----------', '-----------'))
for key in suites:
print('{0:34}{1}'.format(key, suites[key].__doc__))
OpTestConfiguration.conf.util.cleanup()
exit(0)
t = unittest.TestSuite()
if OpTestConfiguration.conf.args.run_suite:
for suite in OpTestConfiguration.conf.args.run_suite:
try:
t.addTest(suites[suite].suite())
except Exception as e:
optestlog.error("We encountered a problem adding suite={},"
" see if its a valid suite name and retry"
.format(suite))
raise e
if OpTestConfiguration.conf.args.run:
t.addTest(unittest.TestLoader().loadTestsFromNames(
OpTestConfiguration.conf.args.run))
if not OpTestConfiguration.conf.args.run_suite and not OpTestConfiguration.conf.args.run:
if not OpTestConfiguration.conf.args.only_flash:
t.addTest(suites['default'].suite())
if OpTestConfiguration.conf.args.list_tests:
print('{0:40}'.format('Tests'))
print('{0:40}'.format('----------'))
print_tests(t)
OpTestConfiguration.conf.util.cleanup()
exit(0)
xml_msg = ""
except Exception as e:
traceback.print_exc()
optestlog.error("Exit unexpectedly with Exception={}".format(e))
OpTestConfiguration.conf.util.cleanup()
exit(-1)
def run_tests(t, failfast):
runner = unittest.TextTestRunner
kwargs = {
'verbosity': 2,
'failfast': failfast,
}
try:
import xmlrunner # requires unittest-xml-reporting package
runner = xmlrunner.XMLTestRunner
kwargs.update({
'output': OpTestConfiguration.conf.output,
'outsuffix': OpTestConfiguration.conf.outsuffix,
'stream': OpTestConfiguration.conf.logfile,
})
# xmlrunner pre v1.13 doesn't support failfast
try:
runner(failfast=True)
except TypeError:
if failfast:
optestlog.info("Ignoring failfast: not supported by runner")
del kwargs['failfast']
except ImportError:
pass
return runner(**kwargs).run(t)
exit_code = 0
try:
res = None
optestlog.debug("op-test argv={}".format(sys.argv))
if not OpTestConfiguration.conf.args.noflash:
if any(s in OpTestConfiguration.conf.args.bmc_type for s in ("QEMU", "qemu")):
optestlog.info("Not adding FlashFirmware suite for QEMU machine")
else:
res = run_tests(FlashFirmware().suite(),
failfast=OpTestConfiguration.conf.args.failfast)
if OpTestConfiguration.conf.args.only_flash:
if res is not None:
optestlog.info('Exit with Result errors="{}" and failures="{}" from only_flash'.format(
len(res.errors), len(res.failures)))
OpTestConfiguration.conf.util.cleanup()
exit_code = len(res.errors + res.failures)
sys.exit(exit_code)
else:
OpTestConfiguration.conf.util.cleanup()
sys.exit(exit_code)
if not res or (res and not (res.errors or res.failures)):
res = run_tests(t, failfast=OpTestConfiguration.conf.args.failfast)
else:
optestlog.error('Skipping main tests as flashing failed')
OpTestConfiguration.conf.util.cleanup()
exit_code = -1
sys.exit(exit_code)
# delay here to allow test results to dump first
time.sleep(2)
optestlog.info('Exit with Result errors="{}" and failures="{}"'.format(
len(res.errors), len(res.failures)))
OpTestConfiguration.conf.util.cleanup()
if len(res.errors) == 0:
optestlog.debug("Exit Results with No Errors")
if len(res.failures) == 0:
optestlog.debug("Exit Results with No Failures")
for i, elem in enumerate(res.errors):