mirror of
				https://github.com/YosysHQ/sby.git
				synced 2025-10-31 13:02:28 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			712 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			712 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| try:
 | |
|     from xmlschema import XMLSchema, XMLSchemaValidationError
 | |
| except ImportError:
 | |
|     import os
 | |
|     if "NOSKIP" not in os.environ.get("MAKEFLAGS", ""):
 | |
|         print()
 | |
|         print("SKIPPING python library xmlschema not found, skipping JUnit output validation")
 | |
|         print()
 | |
|         exit(0)
 | |
| 
 | |
| import argparse
 | |
| 
 | |
| def main():
 | |
|     parser = argparse.ArgumentParser(description="Validate JUnit output")
 | |
|     parser.add_argument('xml')
 | |
|     parser.add_argument('--xsd', default="JUnit.xsd")
 | |
| 
 | |
|     args = parser.parse_args()
 | |
| 
 | |
|     schema = XMLSchema(args.xsd)
 | |
|     try:
 | |
|         schema.validate(args.xml)
 | |
|     except XMLSchemaValidationError as e:
 | |
|         print(e)
 | |
|         exit(1)
 | |
| 
 | |
| if __name__ == '__main__':
 | |
|     main()
 |