Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: test/sputnik/testcfg.py

Issue 3164023: Refactor the tools/test.py script and related testcfg.py files.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mozilla/testcfg.py ('k') | tools/test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2009 the V8 project authors. All rights reserved. 1 # Copyright 2009 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 18 matching lines...) Expand all
29 import os 29 import os
30 from os.path import join, exists 30 from os.path import join, exists
31 import sys 31 import sys
32 import test 32 import test
33 import time 33 import time
34 34
35 35
36 class SputnikTestCase(test.TestCase): 36 class SputnikTestCase(test.TestCase):
37 37
38 def __init__(self, case, path, context, mode): 38 def __init__(self, case, path, context, mode):
39 super(SputnikTestCase, self).__init__(context, path) 39 super(SputnikTestCase, self).__init__(context, path, mode)
40 self.case = case 40 self.case = case
41 self.mode = mode
42 self.tmpfile = None 41 self.tmpfile = None
43 self.source = None 42 self.source = None
44 43
45 def IsNegative(self): 44 def IsNegative(self):
46 return '@negative' in self.GetSource() 45 return '@negative' in self.GetSource()
47 46
48 def IsFailureOutput(self, output): 47 def IsFailureOutput(self, output):
49 if output.exit_code != 0: 48 if output.exit_code != 0:
50 return True 49 return True
51 out = output.stdout 50 out = output.stdout
52 return "SputnikError" in out 51 return "SputnikError" in out
53 52
54 def BeforeRun(self): 53 def BeforeRun(self):
55 self.tmpfile = sputnik.TempFile(suffix='.js', prefix='sputnik-', text=True) 54 self.tmpfile = sputnik.TempFile(suffix='.js', prefix='sputnik-', text=True)
56 self.tmpfile.Write(self.GetSource()) 55 self.tmpfile.Write(self.GetSource())
57 self.tmpfile.Close() 56 self.tmpfile.Close()
58 57
59 def AfterRun(self): 58 def AfterRun(self, result):
60 self.tmpfile.Dispose() 59 # Dispose the temporary file if everything looks okay.
60 if not result.HasPreciousOutput(): self.tmpfile.Dispose()
61 self.tmpfile = None 61 self.tmpfile = None
62 62
63 def GetCommand(self): 63 def GetCommand(self):
64 result = [self.context.GetVm(self.mode)] 64 result = self.context.GetVmCommand(self, self.mode)
65 result.append(self.tmpfile.name) 65 result.append(self.tmpfile.name)
66 return result 66 return result
67 67
68 def GetLabel(self): 68 def GetLabel(self):
69 return "%s sputnik %s" % (self.mode, self.GetName()) 69 return "%s sputnik %s" % (self.mode, self.GetName())
70 70
71 def GetName(self): 71 def GetName(self):
72 return self.path[-1] 72 return self.path[-1]
73 73
74 def GetSource(self): 74 def GetSource(self):
(...skipping 28 matching lines...) Expand all
103 return ['sample', 'sample=shell'] 103 return ['sample', 'sample=shell']
104 104
105 def GetTestStatus(self, sections, defs): 105 def GetTestStatus(self, sections, defs):
106 status_file = join(self.root, 'sputnik.status') 106 status_file = join(self.root, 'sputnik.status')
107 if exists(status_file): 107 if exists(status_file):
108 test.ReadConfigurationInto(status_file, sections, defs) 108 test.ReadConfigurationInto(status_file, sections, defs)
109 109
110 110
111 def GetConfiguration(context, root): 111 def GetConfiguration(context, root):
112 return SputnikTestConfiguration(context, root) 112 return SputnikTestConfiguration(context, root)
OLDNEW
« no previous file with comments | « test/mozilla/testcfg.py ('k') | tools/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698