Created
December 7, 2013 05:49
-
-
Save ashashwat/7837708 to your computer and use it in GitHub Desktop.
Runs all tests from greed generated source code as different process.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
import os | |
import re | |
import sys | |
import subprocess | |
try: | |
FILE = sys.argv [1] | |
except IndexError: | |
print "Usage: % python tctest.py filename" | |
exit (0) | |
BASENAME = os.path.splitext (FILE) [0] | |
data = open (BASENAME + ".sample", 'r').read () | |
BASENAME = BASENAME.replace (' ', '\ ') | |
tests = int (re.findall (r'-- Example (\d+)', data) [-1]) | |
subprocess.check_output ("g++ -O2 " + BASENAME + ".cpp", shell = True) | |
for test in range (tests): | |
print subprocess.check_output ("./a.out " + str (test), shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment