1import subprocess 2import sys 3 4opt = subprocess.run( 5 ["opt", "-passes=print<loops>", "-disable-output", sys.argv[1]], 6 stdout=subprocess.PIPE, 7 stderr=subprocess.PIPE, 8) 9 10stdout = opt.stdout.decode() 11 12pattern = "Loop at depth 1 containing" 13 14if pattern in opt.stderr.decode(): 15 print("This is interesting!") 16 sys.exit(0) 17else: 18 print("This is NOT interesting!") 19 sys.exit(1) 20