-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
48 lines (35 loc) · 1.29 KB
/
test.py
File metadata and controls
48 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/python
import os,sys,string,re,time
ExitError = "error executing process"
multiple = re.compile(".*\(.*\)")
def run(command, args):
pid = os.fork()
if (pid == 0):
#redirect standard output to /dev/null at a low-level
devnull = os.open("/dev/null", os.O_WRONLY | os.O_APPEND)
os.dup2(devnull, 1)
#then execute the process
os.execvp(command, list([command] + list(args)))
raise ExitError #or raise an error
else:
status = os.wait()[1]
if (os.WIFEXITED(status)):
return os.WEXITSTATUS(status)
else:
raise ExitError
if (__name__ == '__main__'):
#print(run("./rhyme", ["g54jg8954g"]))
print("Checking the build ... this will take a very VERY long time")
print("(feel free to kill this process if you have better things to do)")
time.sleep(5)
line = sys.stdin.readline()
while (line):
line = string.lower(string.split(string.strip(line), " ")[0])
if (not multiple.match(line)):
print("Testing \"%s\"" % (line))
if (run("./rhyme", [line]) != 0):
print("Error searching for \"%s\"" % (line))
break
line = sys.stdin.readline()
else:
print("All tests completed successfully!")