run-find-stack-comptrs.py
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 78 de1d37e87cf475be8a34750609238c74740b5611
permissions -rw-r--r--
State as of now

import sys
import subprocess
import os

thisfile = __file__
thisdir = os.path.split(thisfile)[0]

dehydra = '/builds/oink-stack/oink/dehydra'
findstack_js = os.path.join(thisdir, 'find-stack-comptrs.js')

def run_single(file):
    """Run dehydra on a single .ii file and spit out errors and warnings."""

    p = subprocess.Popen([dehydra, '-dehydra-javascript', findstack_js, file],
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output, err = p.communicate()
    if p.returncode:
        print "ERROR: Dehydra returned exit code %s\nError putout: %s" % (p.returncode,
                                                                   err)
    for line in output.splitlines():
        if line.find('ERROR:') != -1:
            print line

        # if line.find('WARNING:') != -1:
        # print line

for file in sys.stdin:
    file = file.strip()
    print file
    
    run_single(file)