Fix up and expand test_checklist
# Copyright 2020 Silicon Compiler Authors. All Rights Reserved.
import siliconcompiler
+import os
+
def test_checklist():
'''API test for help method
'''
chip = siliconcompiler.Chip(loglevel="INFO")
+ chip.set('design', 'test')
chip.load_target('freepdk45_demo')
- #automated fail
+ # Test won't work if file doesn't exist
+ os.makedirs('build/test/job0/syn/0')
+ with open('build/test/job0/syn/0/yosys.log', 'w') as f:
+ f.write('test')
+
chip.set('metric','syn','0', 'errors', 'real', 1)
- chip.set('eda','yosys','report', 'syn', '0', 'qor', 'qor.rpt')
+ chip.set('eda', 'yosys', 'report', 'syn', '0', 'errors', 'yosys.log')
+ chip.record_history()
+
+ #automated fail
chip.set('checklist','iso', 'd0', 'criteria', 'errors==0')
- chip.set('checklist','iso', 'd0', 'step', 'syn')
- assert not chip.check_checklist('iso', 'd0')
+ chip.set('checklist','iso', 'd0', 'tasks', ('job0', 'syn', '0'))
+ assert not chip.check_checklist('iso', ['d0'])
#automated pass
- chip.set('checklist','iso', 'd1', 'step', 'syn')
- assert chip.check_checklist('iso', 'd1')
+ chip.set('checklist', 'iso', 'd1', 'criteria', 'errors<2')
+ chip.set('checklist','iso', 'd1', 'tasks', ('job0', 'syn', '0'))
+ assert chip.check_checklist('iso', ['d1'])
+
+ assert not chip.check_checklist('iso', ['d1'], check_ok=True)
+
+ chip.set('checklist', 'iso', 'd1', 'ok', True)
+ assert chip.check_checklist('iso', ['d1'], check_ok=True)
#########################
if __name__ == "__main__":
