test-ndnpeekpoke: test case for testing ndn-tlv-peek and ndn-tlv-poke
on a single host
Change-Id: Ie45f37a5b53fadd70c1f3c7bb29d3dcd91a7fb65
refs: #1387
diff --git a/library_helpers/process_manager.py b/library_helpers/process_manager.py
index fa2fdf3..204d61d 100644
--- a/library_helpers/process_manager.py
+++ b/library_helpers/process_manager.py
@@ -23,22 +23,50 @@
self.subprocesses.clear()
self.results.clear()
- def runProcess(self, processKey, processCallFormat, message, subprocesses, results):
+ def runProcess(self,
+ processKey,
+ processCallFormat,
+ message,
+ subprocesses,
+ results,
+ inputFile,
+ outputFile):
print message
+ stdin = None
+ if inputFile is not None:
+ stdin = open(inputFile, "r")
+ stdout = subprocess.PIPE
+ if outputFile is not None:
+ stdout = open(outputFile, "w")
process = subprocess.Popen(
- processCallFormat, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
+ processCallFormat,
+ stdin=stdin,
+ stdout=stdout,
+ stderr=subprocess.PIPE)
subprocesses[processKey] = process
try:
stdout, stderr = process.communicate()
returnCode = process.returncode
results[processKey] = (returnCode, stdout, stderr)
except IOError as e:
+ print e
pass
- def startProcess(self, processKey, processCallFormat, message):
+ def startProcess(self,
+ processKey,
+ processCallFormat,
+ message,
+ inputFile=None,
+ outputFile=None):
self.processes[processKey] = mp.Process(
- target = self.runProcess,
- args = [processKey, processCallFormat, message, self.subprocesses, self.results])
+ target=self.runProcess,
+ args=[processKey,
+ processCallFormat,
+ message,
+ self.subprocesses,
+ self.results,
+ inputFile,
+ outputFile])
self.processes[processKey].start()
def killProcess(self, processKey):