def check_output(dir): for opt in polyopt_options: target_path = dir + re.match("--polyopt-([a-zA-Z0-9\-_]+)", opt).group(1).replace("-", "_") color_printer.print_bold("checkling %s..."%(target_path)) if os.path.exists(target_path): lst = os.listdir(target_path) if not glob.glob(target_path+ "/*.out"): color_printer.print_fail("%s compiled fail!"%(target_path)) else: color_printer.print_fail("%s compiled fail!"%(target_path))
def execute(cmd, handle_err=False): sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) print " ".join(cmd) out, err = sp.communicate() if handle_err: if sp.returncode == 0: color_printer.print_ok_green("looks good...") else: color_printer.print_fail("command \"%s\" executed failed!" % " ".join(cmd)) print out print err return out, err