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/test_ndnpeekpoke/test_ndnpeekpoke.py b/test_ndnpeekpoke/test_ndnpeekpoke.py
new file mode 100644
index 0000000..257cfbc
--- /dev/null
+++ b/test_ndnpeekpoke/test_ndnpeekpoke.py
@@ -0,0 +1,58 @@
+#!/usr/bin/python2
+# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2014 University of Arizona
+# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
+# See COPYING for copyright and distribution information.
+#
+
+import os
+import time
+import unittest
+import process_manager
+
+class test_ndnpeekpoke(unittest.TestCase, process_manager.ProcessManager):
+ """Test case for testing ndn-tlv-peek and ndn-tlv-poke applications"""
+
+ def setUp(self):
+ print "\nTesting ndn-tlv-peek & ndn-tlv-poke"
+ print "***********************************"
+
+ def tearDown(self):
+ self.killNfd()
+ self.killProcess("ndn-tlv-poke")
+ self.killProcess("ndn-tlv-peek")
+ self.cleanupProcesses()
+
+ def test_peekpoke(self):
+ self.startNfd()
+ time.sleep(1)
+ pokeInputFile = os.path.abspath("test_ndnpeekpoke/test-poke-input.txt")
+ self.startProcess("ndn-tlv-poke",
+ ["ndn-tlv-poke", "ndn:/test/peekpoke"],
+ "-> Starting Poke",
+ inputFile=pokeInputFile)
+ time.sleep(1)
+ peekOutputFile = os.path.abspath("/tmp/test-peek-output.txt")
+ self.startProcess("ndn-tlv-peek",
+ ["ndn-tlv-peek", "ndn:/test/peekpoke"],
+ "-> Starting Peek",
+ outputFile=peekOutputFile)
+ time.sleep(1)
+ self.waitForProcessCompletion("ndn-tlv-peek", 10)
+ self.waitForProcessCompletion("ndn-tlv-poke", 10)
+ if self.hasProcessCompleted("ndn-tlv-peek"):
+ if self.getProcessReturnCode("ndn-tlv-peek") != 0:
+ print self.getProcessReturnCode("ndn-tlv-peek")
+ print self.getProcessError("ndn-tlv-peek")
+ print self.getProcessOutput("ndn-tlv-peek")
+ self.fail(">> TEST FAILED - received non-zero return code from ndn-tlv-peek")
+ else:
+ self.fail(">> TEST FAILED - ndn-tlv-peek failed to complete")
+ if self.hasProcessCompleted("ndn-tlv-poke"):
+ if self.getProcessReturnCode("ndn-tlv-poke") != 0:
+ print self.getProcessError("ndn-tlv-poke")
+ self.fail(">> TEST FAILED - received non-zero return code from ndn-tlv-poke")
+ else:
+ self.fail(">> TEST FAILED - ndn-tlv-poke failed to complete")
+ print ">> TEST SUCCESSFUL"