forked from dgubanovv/qa-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
efi_test.py
665 lines (556 loc) · 30.1 KB
/
efi_test.py
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
import contextlib
import os
import io
import tempfile
import time
import urlparse
import zipfile
import pytest
import re
from tools.constants import BUILDS_SERVER
from tools.command import Command
from tools.power import Power
from tools.utils import get_atf_logger, upload_file, upload_directory, remove_directory, \
get_url_response, download_directory, download_file
from infra.test_base import TestBase
log = get_atf_logger()
def setup_module(module):
# import tools._test_setup # uncomment for manual test setup
os.environ["TEST"] = "efi_test"
class TestEFITools(TestBase):
TIMEOUT = 30
EFI_RUN_TIMEOUT = 40
POWER_UP_TIMEOUT = 100
EFI_TOOL_DIR = "tools"
USB_PATH = "/media/usb/EFI/BOOT"
OUTPUT = "TEST_OUTPUT"
@classmethod
def setup_class(cls):
super(TestEFITools, cls).setup_class()
cls.log_server_dir = cls.create_logs_dir_on_log_server()
try:
cmd = "rm -rf {}/{}".format(cls.USB_PATH, cls.EFI_TOOL_DIR)
Command(host=cls.dut_hostname, cmd=cmd).run()
cmd = "rm -rf {}/efi_test.nsh".format(cls.USB_PATH)
Command(host=cls.dut_hostname, cmd=cmd).run()
cmd = "rm -rf {}/{}".format(cls.USB_PATH, cls.OUTPUT)
Command(host=cls.dut_hostname, cmd=cmd).run()
cls.mount_flash("/media/usb", host=cls.dut_hostname)
dir_tool = cls.download_efi_tool(cls.efi_version, cls.working_dir)
download_file("nn-nfs01", "/storage/export/qa/testing/sha256.bin", os.path.join(dir_tool, "sha256.bin"))
download_file("nn-nfs01", "/storage/export/qa/testing/pcicfg.bin", os.path.join(dir_tool, "pcicfg.bin"))
upload_directory(cls.dut_hostname, dir_tool, cls.USB_PATH)
upload_file(cls.dut_hostname, "efi_test.nsh", cls.USB_PATH + "/efi_test.nsh")
cls.launch_efi_tests()
except Exception as e:
log.exception("Failed while setting up class")
raise e
@classmethod
def download_efi_tool(cls, version, base_dir=None):
log.info("Downloading efi...")
if base_dir is None:
directory = tempfile.mkdtemp()
else:
directory = os.path.join(base_dir, cls.EFI_TOOL_DIR)
remove_directory(directory)
os.mkdir(directory)
url = urlparse.urljoin(BUILDS_SERVER, "tools/efi/{}/efi.zip".format(version))
log.debug("Downloading EFI from {}".format(url))
content = get_url_response(url)
with zipfile.ZipFile(io.BytesIO(content)) as archive:
archive.extractall(directory)
log.debug("EFI has been downloaded and extracted to {}".
format(directory))
return directory
@staticmethod
def mount_flash(usb_dir="/media/usb", host='localhost'):
cmd = "sudo fdisk -l | grep FAT16 | awk '{print $1}'"
out = Command(host=host, cmd=cmd).run()["output"]
if out:
device = out[0]
else:
raise Exception("Not USB Flash(FAT16) in machine")
cmd = "mkdir -p {}".format(usb_dir)
Command(host=host, cmd=cmd).run()
cmd = "sudo umount {}".format(usb_dir)
Command(host=host, cmd=cmd).run()
cmd = "sudo mount {} {} -o umask=000".format(device, usb_dir)
Command(host=host, cmd=cmd).run()
def read_output(self, test):
log.info("Analyze {} output".format(test))
path_to_out = os.path.join(self.working_dir, self.OUTPUT, test)
if not os.path.exists(path_to_out):
raise Exception("Output '{}' from AtlSwitchNcb.efi not found ".format(path_to_out))
res = ""
log.info("file name os -> {}".format(path_to_out))
with io.open(path_to_out, mode='r', encoding='utf16') as f:
res = f.read()
log.info(res)
return res
@staticmethod
def get_actual_efi_tool_version(version):
suburl = "tools/efi/{}/version.txt".format(version)
url = urlparse.urljoin(BUILDS_SERVER, suburl)
response = get_url_response(url)
return response.rstrip("\r\n")
@classmethod
def launch_efi_tests(cls):
Power(host=cls.dut_hostname).reboot()
time.sleep(cls.TIMEOUT)
# if not self.is_host_powered_on(self.dut_hostname):
# raise Exception("DUT didn't light up power LED after magic packet")
log.info("EFI shell tests are running")
time.sleep(cls.EFI_RUN_TIMEOUT)
if not cls.poll_host_alive(cls.dut_hostname, cls.POWER_UP_TIMEOUT):
raise Exception("DUT didn't come back after reboot".format())
cls.mount_flash("/media/usb", host=cls.dut_hostname)
download_directory(cls.dut_hostname, "{}/{}".format(cls.USB_PATH, cls.OUTPUT), cls.working_dir)
######################################## switch_ncb ##############################################################
def test_switch_ncb(self):
output = self.read_output("switchNCB.txt")
ncb = re.findall("CURRENT NCB IS (.+) \*\*", output, re.MULTILINE)
if len(ncb) != 3:
raise Exception("Not launched all getNCB.efi")
switch_ncb = re.findall("SUCCESS \((.+) is now valid, (.+) is now invalid", output, re.MULTILINE)
if len(switch_ncb) != 2:
raise Exception("Not launched all switchNCB.efi with SUCCESS")
switch_ncb = [switch_ncb[0][1], switch_ncb[0][0], switch_ncb[1][0]]
if ncb != switch_ncb:
raise Exception("Not correct switch NCB get: {} != switch: {}".format(ncb, switch_ncb))
def test_switch_ncb_dev_num_0(self):
output = self.read_output("switchNCB_dev_num_0.txt")
if "SUCCESS" not in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_switch_ncb_dev_num_20(self):
output = self.read_output("switchNCB_dev_num_20.txt")
if "Error! Was only able to find" not in output:
raise Exception("should be error. We don't have dev 20 <tool>.efi -dev_num 20")
def test_switch_ncb_dev_num_21(self):
output = self.read_output("switchNCB_dev_num_21.txt")
if not "Error! Flag -dev_num only allows values up to 32" in output:
raise Exception("should be error. <tool>.efi -dev_num 21")
######################################## help ##############################################################
def test_switch_help(self):
output = self.read_output("switchNCB_help.txt")
if not "AtlSwitchNcb.efi" in output:
raise Exception("Not help usage")
if not "switch current NCB" in output:
raise Exception("Not help info")
def test_chip_reset_help(self):
output = self.read_output("ChipReset_help.txt")
if not "AtlChipReset.efi" in output:
raise Exception("Not help usage")
if not "This utility will perform a chip reset" in output:
raise Exception("Not help info")
def test_dump_flash_help(self):
output = self.read_output("DumpFlash_help.txt")
if not "AtlDumpFlash.efi" in output:
raise Exception("Not help usage")
if not "This utility will always dump out" in output:
raise Exception("Not help info")
def test_efuse_burnB1_help(self):
output = self.read_output("EfuseBurnB1_help.txt")
if "AtlEfuseBurnB1.efi" not in output:
raise Exception("Not help usage")
if "Will burn flashless configuration, using clx file to burn efuse" not in output:
raise Exception("Not help info")
def test_efuse_read_help(self):
output = self.read_output("EfuseRead_help.txt")
if not "AtlEfuseRead.efi" in output:
raise Exception("Not help usage")
if not "This utility will always dump" in output:
raise Exception("Not help info")
def test_get_NCB_help(self):
output = self.read_output("getNCB_help.txt")
if not "AtlGetNcb.efi" in output:
raise Exception("Not help usage")
if not "This utility will print out current NCB" in output:
raise Exception("Not help info")
def test_read_reg_help(self):
output = self.read_output("ReadReg_help.txt")
if not "AtlReadReg.efi" in output:
raise Exception("Not help usage")
if not "This utility will read 1 Atlantic register" in output:
raise Exception("Not help info")
def test_reset_done_help(self):
output = self.read_output("ResetDone_help.txt")
if not "AtlResetDone.efi" in output:
raise Exception("Not help usage")
if not "This utility will check if HW reset" in output:
raise Exception("Not help info")
######################################## version ##############################################################
def test_switch_version(self):
current_version = self.get_current_version_efi(self.efi_version)
output = self.read_output("switchNCB_version.txt")
if current_version not in output and "Version" not in output:
raise Exception("Version incorrect")
def test_chip_reset_version(self):
current_version = self.get_current_version_efi(self.efi_version)
output = self.read_output("ChipReset_version.txt")
if current_version not in output and "Version" not in output:
raise Exception("Version incorrect")
def test_dump_flash_version(self):
current_version = self.get_current_version_efi(self.efi_version)
output = self.read_output("DumpFlash_version.txt")
if current_version not in output and "Version" not in output:
raise Exception("Version incorrect")
def test_efuse_burnB1_version(self):
current_version = self.get_current_version_efi(self.efi_version)
output = self.read_output("EfuseBurnB1_version.txt")
if current_version not in output and "Version" not in output:
raise Exception("Version incorrect")
def test_efuse_read_version(self):
current_version = self.get_current_version_efi(self.efi_version)
output = self.read_output("EfuseRead_version.txt")
if current_version not in output and "Version" not in output:
raise Exception("Version incorrect")
def test_getNCB_version(self):
current_version = self.get_current_version_efi(self.efi_version)
output = self.read_output("getNCB_version.txt")
if current_version not in output and "Version" not in output:
raise Exception("Version incorrect")
def test_read_reg_version(self):
current_version = self.get_current_version_efi(self.efi_version)
output = self.read_output("ReadReg_version.txt")
if current_version not in output and "Version" not in output:
raise Exception("Version incorrect")
def test_reset_done_version(self):
current_version = self.get_current_version_efi(self.efi_version)
output = self.read_output("ResetDone_version.txt")
if current_version not in output and "Version" not in output:
raise Exception("Version incorrect")
######################################## chip_reset ##############################################################
def test_chip_reset(self):
output = self.read_output("ChipReset.txt")
if not "MAC kickstart complete" in output:
raise Exception("MAC kickstart failed")
if not "PHY kickstart complete" in output:
raise Exception("PHY kickstart failed")
if not "CHIP RESET DONE" in output:
raise Exception("Not Success in <tool>.efi")
def test_chip_reset_phy_0(self):
output = self.read_output("ChipReset_phy_0.txt")
if not "CHIP RESET DONE" in output:
raise Exception("Not Success in <tool>.efi -phy 0")
def test_chip_reset_phy_1(self):
output = self.read_output("ChipReset_phy_1.txt")
if not "MAC kickstart complete" in output:
raise Exception("MAC kickstart failed")
if not "PHY kickstart failed " in output:
raise Exception("PHY kickstart complete, should be fail with phy id 1")
def test_chip_reset_skip(self):
output = self.read_output("ChipReset_skip.txt")
if "PHY kickstart" in output:
raise Exception("Found PHY kickstart, should be skip phy kickstart")
if not "CHIP RESET DONE" in output:
raise Exception("Not Success in AtlChipReset.efi -phy_id 1 -skip_phy_kickstart")
def test_chip_reset_dev_num_0(self):
output = self.read_output("ChipReset_dev_num_0.txt")
if not "CHIP RESET DONE" in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_chip_reset_dev_num_20(self):
output = self.read_output("ChipReset_dev_num_20.txt")
if not "Error! Was only able to find" in output:
raise Exception("should be error. We don't have dev 20 <tool>.efi -dev_num 20")
def test_chip_reset_dev_num_21(self):
output = self.read_output("ChipReset_dev_num_21.txt")
if not "Error! Flag -dev_num only allows values up to 32" in output:
raise Exception("should be error. <tool>.efi -dev_num 21")
######################################## dump_flash ##############################################################
def test_dump_flash(self):
output = self.read_output("DumpFlash.txt")
if "SUCCESS" not in output and "Successfully" not in output:
raise Exception("Failed flash dump")
def test_dump_flash_dev_num_0(self):
output = self.read_output("DumpFlash_dev_num_0.txt")
if not "SUCCESS" in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_dump_flash_dev_num_20(self):
output = self.read_output("DumpFlash_dev_num_20.txt")
if not "Error! Was only able to find" in output:
raise Exception("should be error. We don't have dev 20 <tool>.efi -dev_num 20")
def test_dump_flash_dev_num_21(self):
output = self.read_output("DumpFlash_dev_num_21.txt")
if not "Error! Flag -dev_num only allows values up to 32" in output:
raise Exception("should be error. <tool>.efi -dev_num 21")
############################################## efuse_burn ########################################################
def test_efuse_burn_ncbstart_0(self):
output = self.read_output("EfuseBurnB1_ncbstart_0.txt")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_ncbstart_1(self):
output = self.read_output("EfuseBurnB1_ncbstart_1.txt")
if "Checking if RMW is supported...Flash supports it" not in output:
raise Exception("Flash not support")
if "Error! The current NCB is" not in output:
raise Exception("Flash not support")
def test_efuse_burn_ncbstart_10(self):
output = self.read_output("EfuseBurnB1_ncbstart_10.txt")
if "Error! Flag -ncbstart only allows values up to 1" not in output:
raise Exception("Works, But should not error. Flag -ncbstart only allows values up to 1")
def test_efuse_burn_ncbstart(self):
output = self.read_output("EfuseBurnB1_ncbstart.txt")
if "Error! Flag -ncbstart requires a value!" not in output:
raise Exception("Not in output: Error! Flag -ncbstart requires a value!")
def test_efuse_burn_ncbend_0(self):
output = self.read_output("EfuseBurnB1_ncbend_0.txt")
if "Checking if RMW is supported...Flash supports it" not in output:
raise Exception("Flash not support")
if "Error! The current NCB is" not in output:
raise Exception("Flash not support")
def test_efuse_burn_ncbend_1(self):
output = self.read_output("EfuseBurnB1_ncbend_1.txt")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_ncbend_10(self):
output = self.read_output("EfuseBurnB1_ncbend_10.txt")
if "Error! Flag -ncbend only allows values up to 1" not in output:
raise Exception("Works, But should not error. Flag -ncbend only allows values up to 1")
def test_efuse_burn_ncbend(self):
output = self.read_output("EfuseBurnB1_ncbend.txt")
if "Error! Flag -ncbend requires a value!" not in output:
raise Exception("Not in output: Error! Flag -ncbend requires a value!")
def test_efuse_burn_flashless_0(self):
output = self.read_output("EfuseBurnB1_flashless_0.txt")
if "[62]0x27020" not in output:
raise Exception("Error: Not burn 62 dword to 27020")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_flashless_1(self):
output = self.read_output("EfuseBurnB1_flashless_1.txt")
if "[62]0x27000" not in output:
raise Exception("Error: Not burn 62 dword to 0x27000")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_flashless_not_val(self):
output = self.read_output("EfuseBurnB1_flashless.txt")
if not "Flag -flashless requires a value" in output:
raise Exception("Works, But should not work")
def test_efuse_burn_pcicfg_0(self):
output = self.read_output("EfuseBurnB1_pcicfg_0.txt")
if "[62]0x27400" not in output:
raise Exception("Error: Not burn 62 dword to 0x27400")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_pcicfg_1(self):
output = self.read_output("EfuseBurnB1_pcicfg_1.txt")
if "[62]0x27600" not in output:
raise Exception("Error: Not burn 62 dword to 0x27600")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_lock_bit_0(self):
output = self.read_output("EfuseBurnB1_lock_bit_0.txt")
if "[127]0x0" not in output:
raise Exception("Error: Not burn 127 dword to 0x0")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_lock_bit_1(self):
output = self.read_output("EfuseBurnB1_pcicfg_1.txt")
if "[127]0x0" not in output:
raise Exception("Error: Not burn 127 dword to 0x0")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_lock_bit_sha(self):
output = self.read_output("EfuseBurnB1_lock_bit_sha.txt")
if "[121]0x61393177 [122]0xDCB4449F [123]0xF865057 [124]0x8C74398D [125]0xE5D3DAE7" not in output:
raise Exception("Error: No Hash")
if "[127]0x80000000" not in output:
raise Exception("Error: Not burn 127 dword to 0x8")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_lock_bit_10(self):
output = self.read_output("EfuseBurnB1_lock_bit_10.txt")
if "Error! Flag -lock_bit only allows values up to 1" not in output:
raise Exception("Error! Flag -lock_bit only allows values up to 1, but you entered 16!")
def test_efuse_burn_lock_bit(self):
output = self.read_output("EfuseBurnB1_lock_bit.txt")
if "Error! Flag -lock_bit requires a value" not in output:
raise Exception("Error! Flag -lock_bit requires a value")
def test_efuse_burn_mac(self):
output = self.read_output("EfuseBurnB1_mac.txt")
if "[40]0x11223344 [41]0x55660000" not in output:
raise Exception("Error: Not burn MAC dword to 11-22-33-44-55-66")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_mac_incorrect(self):
output = self.read_output("EfuseBurnB1_mac_incorrect.txt")
if "Invalid MAC Address format" not in output:
raise Exception("Error: Invalid MAC Address format")
def test_efuse_burn_pcicfg_bin(self):
output = self.read_output("EfuseBurnB1_pcicfg_bin.txt")
if "[64]0xEFDA0001 [65]0x7B11D6A [66]0x2000002 [67]0x187106B [68]0x0 [69]0x40001 [70]0xFFFFFFFF [71]0xF004FFFF [72]0xFFFFFFFF [73]0x4FFFF [74]0xFFFFFFC0" not in output:
raise Exception("Error: PCICONFIG setting error")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_pcicfg_bin_incorrect(self):
output = self.read_output("EfuseBurnB1_pcicfg_bin_incorrect.txt")
if "PCI Cfg bin file was not the valid marker default" not in output:
raise Exception("Error: PCI Cfg bin file was not the valid marker default")
def test_efuse_burn_sha_bin(self):
output = self.read_output("EfuseBurnB1_sha_bin.txt")
if "[121]0x61393177 [122]0xDCB4449F [123]0xF865057 [124]0x8C74398D [125]0xE5D3DAE7" not in output:
raise Exception("Error: No Hash")
if "[127]0x80000000" not in output:
raise Exception("Error: Not burn 127 dword to 0x8")
if "Correct CRC for loaded" not in output:
raise Exception("Incorrect CRC")
if "Sample of efuseBufFilled" not in output:
raise Exception("Not efuse")
if "Efusing agent didn't start successfully" not in output:
raise Exception("Efusing agent start successfully")
if "FAILURE!!! EFUSE BURNING FAILED" not in output:
raise Exception("Efusing passing - fail!!!")
def test_efuse_burn_sha_bin_incorrect(self):
output = self.read_output("EfuseBurnB1_sha_bin_incorrect.txt")
if "File size is 96 bytes, but should be 32 bytes" not in output:
raise Exception("Error: File size is 96 bytes, but should be 32 bytes")
def test_efuse_burn_dev_num_0(self):
output = self.read_output("EfuseBurnB1_dev_num_0.txt")
if not "Sample of efuseBufFilled" in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_efuse_burn_dev_num_20(self):
output = self.read_output("EfuseBurnB1_dev_num_20.txt")
if not "Error! Was only able to find" in output:
raise Exception("should be error. We don't have dev 20 <tool>.efi -dev_num 20")
def test_efuse_burn_dev_num_21(self):
output = self.read_output("EfuseBurnB1_dev_num_21.txt")
if not "Error! Flag -dev_num only allows values up to 32" in output:
raise Exception("should be error. <tool>.efi -dev_num 21")
######################################## get_ncb ##############################################################
def test_get_ncb_dev_num_0(self):
output = self.read_output("getNCB_dev_num_0.txt")
if not "CURRENT NCB IS" in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_get_ncb_dev_num_20(self):
output = self.read_output("getNCB_dev_num_20.txt")
if not "Error! Was only able to find" in output:
raise Exception("should be error. We don't have dev 20 <tool>.efi -dev_num 20")
def test_get_ncb_dev_num_21(self):
output = self.read_output("getNCB_dev_num_21.txt")
if not "Error! Flag -dev_num only allows values up to 32" in output:
raise Exception("should be error. <tool>.efi -dev_num 21")
######################################## read_reg ##############################################################
def test_read_reg_18(self):
output = self.read_output("ReadReg_18.txt")
if not "Value for register" in output:
raise Exception("Cannot read register")
if not "0x18: 0x30" in output:
raise Exception("Incorrect value")
def test_read_reg_dev_num_0(self):
output = self.read_output("ReadReg_dev_num_0.txt")
if not "Wrong number of commands" in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_read_reg_dev_num_20(self):
output = self.read_output("ReadReg_dev_num_20.txt")
if not "Error! Was only able to find" in output:
raise Exception("should be error. We don't have dev 20 <tool>.efi -dev_num 20")
def test_read_reg_dev_num_21(self):
output = self.read_output("ReadReg_dev_num_21.txt")
if not "Error! Flag -dev_num only allows values up to 32" in output:
raise Exception("should be error. <tool>.efi -dev_num 21")
######################################## efuse_read ##############################################################
def test_efuse_read(self):
output = self.read_output("EfuseRead.txt")
if not "Efuse contents" in output:
raise Exception("Not Efuse contents")
if not "Writing efuse contents to efuse_read.bin" in output:
raise Exception("Cannot write to bin file")
if not "Successfully" in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_efuse_read_dev_num_0(self):
output = self.read_output("EfuseRead_dev_num_0.txt")
if not "Successfully " in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_efuse_read_dev_num_20(self):
output = self.read_output("EfuseRead_dev_num_20.txt")
if not "Error! Was only able to find" in output:
raise Exception("should be error. We don't have dev 20 <tool>.efi -dev_num 20")
def test_efuse_read_dev_num_21(self):
output = self.read_output("EfuseRead_dev_num_21.txt")
if not "Error! Flag -dev_num only allows values up to 32" in output:
raise Exception("should be error. <tool>.efi -dev_num 21")
######################################## reset_done ##############################################################
def test_reset_done(self):
output = self.read_output("ResetDone.txt")
if not "RESET CHECK PASSED" in output:
raise Exception("Not Success in <tool>.efi -dev_num 0")
def test_reset_done_dev_num_0(self):
output = self.read_output("ResetDone_dev_num_0.txt")
if not "RESET CHECK PASSED" in output:
raise Exception("Not Success in <tool>.efi")
def test_reset_done_dev_num_20(self):
output = self.read_output("ResetDone_dev_num_20.txt")
if not "Error! Was only able to find" in output:
raise Exception("should be error. We don't have dev 20 <tool>.efi -dev_num 20")
def test_reset_done_dev_num_21(self):
output = self.read_output("ResetDone_dev_num_21.txt")
if not "Error! Flag -dev_num only allows values up to 32" in output:
raise Exception("should be error. <tool>.efi -dev_num 21")
if __name__ == "__main__":
pytest.main([__file__, "-s", "-v"])