|
35 | 35 |
|
36 | 36 | class TTYTestCase(test.TestCase): |
37 | 37 |
|
38 | | - def __init__(self, path, file, expected, arch, mode, context, config): |
| 38 | + def __init__(self, path, file, expected, input, arch, mode, context, config): |
39 | 39 | super(TTYTestCase, self).__init__(context, path, arch, mode) |
40 | 40 | self.file = file |
41 | 41 | self.expected = expected |
| 42 | + self.input = input |
42 | 43 | self.config = config |
43 | 44 | self.arch = arch |
44 | 45 | self.mode = mode |
@@ -104,12 +105,16 @@ def GetSource(self): |
104 | 105 | + open(self.expected).read()) |
105 | 106 |
|
106 | 107 | def RunCommand(self, command, env): |
| 108 | + input = None |
| 109 | + if self.input is not None and exists(self.input): |
| 110 | + input = open(self.input).read() |
107 | 111 | full_command = self.context.processor(command) |
108 | 112 | output = test.Execute(full_command, |
109 | 113 | self.context, |
110 | 114 | self.context.GetTimeout(self.mode), |
111 | 115 | env, |
112 | | - True) |
| 116 | + faketty=True, |
| 117 | + input=input) |
113 | 118 | return test.TestOutput(self, |
114 | 119 | full_command, |
115 | 120 | output, |
@@ -139,11 +144,12 @@ def ListTests(self, current_path, path, arch, mode): |
139 | 144 | if self.Contains(path, test): |
140 | 145 | file_prefix = join(self.root, reduce(join, test[1:], "")) |
141 | 146 | file_path = file_prefix + ".js" |
| 147 | + input_path = file_prefix + ".in" |
142 | 148 | output_path = file_prefix + ".out" |
143 | 149 | if not exists(output_path): |
144 | 150 | raise Exception("Could not find %s" % output_path) |
145 | 151 | result.append(TTYTestCase(test, file_path, output_path, |
146 | | - arch, mode, self.context, self)) |
| 152 | + input_path, arch, mode, self.context, self)) |
147 | 153 | return result |
148 | 154 |
|
149 | 155 | def GetBuildRequirements(self): |
|
0 commit comments