Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4438580

Browse files
committed
Make timedRun no longer responsible for dealing with stack traces, and remove the wantStack argument. (Part 2 of making timedRun.py not rely on our subprocesses.py.)
1 parentc35a50a commit4438580

File tree

4 files changed

+11
-44
lines changed

4 files changed

+11
-44
lines changed

‎interestingness/crashes.py‎

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,30 @@
11
#!/usr/bin/env python
22

3-
importos
4-
importsys
5-
importtimedRun
6-
73
fromoptparseimportOptionParser
8-
path0=os.path.dirname(os.path.abspath(__file__))
9-
path1=os.path.abspath(os.path.join(path0,os.pardir,'util'))
10-
sys.path.append(path1)
11-
importfileIngredients
4+
5+
importtimedRun
126

137

148
defparseOptions(arguments):
159
parser=OptionParser()
1610
parser.disable_interspersed_args()
17-
parser.add_option('-r','--regex',action='store_true',dest='useRegex',
18-
default=False,
19-
help='Allow search for regular expressions instead of strings.')
20-
parser.add_option('-s','--sig',action='store',dest='sig',
21-
default='',
22-
help='Optionally set the crash signature. Defaults to "%default".')
2311
parser.add_option('-t','--timeout',type='int',action='store',dest='condTimeout',
2412
default=120,
2513
help='Optionally set the timeout. Defaults to "%default" seconds.')
2614

2715
options,args=parser.parse_args(arguments)
2816

29-
returnoptions.useRegex,options.sig,options.condTimeout,args
17+
returnoptions.condTimeout,args
3018

3119

3220
definteresting(cliArgs,tempPrefix):
33-
(regexEnabled,crashSig,timeout,args)=parseOptions(cliArgs)
34-
35-
# Examine stack for crash signature, this is needed if crashSig is specified.
36-
wantStack= (crashSig!='')
37-
runinfo=timedRun.timed_run(args,timeout,tempPrefix,wantStack)
21+
(timeout,args)=parseOptions(cliArgs)
3822

23+
runinfo=timedRun.timed_run(args,timeout,tempPrefix)
3924
timeString=" (%.3f seconds)"%runinfo.elapsedtime
40-
41-
crashLogName=tempPrefix+"-crash.txt"
42-
4325
ifruninfo.sta==timedRun.CRASHED:
44-
ifnotwantStack:
45-
print'Exit status: '+runinfo.msg+timeString
46-
returnTrue
47-
elifos.path.exists(crashLogName):
48-
# When using this script, remember to escape characters, e.g. "\(" instead of "(" !
49-
found,foundSig=fileIngredients.fileContains(crashLogName,crashSig,regexEnabled)
50-
iffound:
51-
print'Exit status: '+runinfo.msg+timeString
52-
returnTrue
53-
else:
54-
print"[Uninteresting] It crashed somewhere else!"+timeString
55-
returnFalse
56-
else:
57-
print"[Uninteresting] It appeared to crash, but no crash log was found?"+timeString
58-
returnFalse
26+
print'Exit status: '+runinfo.msg+timeString
27+
returnTrue
5928
else:
6029
print"[Uninteresting] It didn't crash."+timeString
6130
returnFalse

‎interestingness/hangs.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
importtimedRun
44

5+
56
definteresting(args,tempPrefix):
67
timeout=int(args[0])
78

8-
wantStack=False# No need to examine crash signatures here.
9-
runinfo=timedRun.timed_run(args[1:],timeout,tempPrefix,wantStack)
9+
runinfo=timedRun.timed_run(args[1:],timeout,tempPrefix)
1010

1111
ifruninfo.sta==timedRun.TIMED_OUT:
1212
returnTrue

‎interestingness/outputs.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ def interesting(cliArgs, tempPrefix):
2828

2929
searchFor=args[0]
3030

31-
wantStack=False# No need to examine crash signatures when considering stdout/stderr.
32-
runinfo=timedRun.timed_run(args[1:],timeout,tempPrefix,wantStack)
31+
runinfo=timedRun.timed_run(args[1:],timeout,tempPrefix)
3332

3433
result=fileIngredients.fileContains(tempPrefix+"-out.txt",searchFor,regexEnabled)[0]or \
3534
fileIngredients.fileContains(tempPrefix+"-err.txt",searchFor,regexEnabled)[0]

‎interestingness/timedRun.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def xpkill(p):
5454
p.kill()# Re-verify that the process is really killed.
5555

5656

57-
deftimed_run(commandWithArgs,timeout,logPrefix,wantStack,input=None,preexec_fn=None):
57+
deftimed_run(commandWithArgs,timeout,logPrefix,input=None,preexec_fn=None):
5858
'''If logPrefix is None, uses pipes instead of files for all output.'''
5959

6060
ifnotisinstance(commandWithArgs,list):
@@ -153,7 +153,6 @@ def timed_run(commandWithArgs, timeout, logPrefix, wantStack, input=None, preexe
153153
signum=-rc
154154
msg='CRASHED signal %d (%s)'% (signum,getSignalName(signum,"Unknown signal"))
155155
sta=CRASHED
156-
sps.grabCrashLog(commandWithArgs[0],child.pid,logPrefix,wantStack)
157156

158157
ifuseLogFiles:
159158
# Am I supposed to do this?

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp