| Index: scripts/slave/recipe_api.py
|
| diff --git a/scripts/slave/recipe_api.py b/scripts/slave/recipe_api.py
|
| index b1122b6b50e6ff2bc0ba62f2b1eeac8e8b3a8b1c..58fecc7b4d49a64fc285d7e7651052f1140bde49 100644
|
| --- a/scripts/slave/recipe_api.py
|
| +++ b/scripts/slave/recipe_api.py
|
| @@ -6,6 +6,7 @@ import imp
|
| import inspect
|
| import os
|
| import sys
|
| +import tempfile
|
|
|
|
|
| class Placeholder(object):
|
| @@ -19,6 +20,30 @@ class Placeholder(object):
|
| pass
|
|
|
|
|
| +class InputDataPlaceholder(Placeholder):
|
| + def __init__(self, data, suffix):
|
| + assert isinstance(data, basestring)
|
| + self.data = data
|
| + self.suffix = suffix
|
| + self.input_file = None
|
| + super(InputDataPlaceholder, self).__init__()
|
| +
|
| + def render(self, test_data):
|
| + if test_data is not None:
|
| + # cheat and pretend like we're going to pass the data on the
|
| + # cmdline for test expectation purposes.
|
| + return [self.data]
|
| + else: # pragma: no cover
|
| + input_fd, self.input_file = tempfile.mkstemp(suffix=self.suffix)
|
| + os.write(input_fd, self.data)
|
| + os.close(input_fd)
|
| + return [self.input_file]
|
| +
|
| + def step_finished(self, stream, step_result, test_data):
|
| + if test_data is None: # pragma: no cover
|
| + os.unlink(self.input_file)
|
| +
|
| +
|
| class ModuleInjectionSite(object):
|
| pass
|
|
|
|
|