install-apps: script to install NDN applications required for testing
test-ndntlvping: sample test case for testing ndn-tlv-ping
Change-Id: Ib54bd606f6854672ed890d3971ff5827197435e8
refs: #1220
diff --git a/test_ndntlvping/test_ndntlvping.py b/test_ndntlvping/test_ndntlvping.py
new file mode 100644
index 0000000..fbe1690
--- /dev/null
+++ b/test_ndntlvping/test_ndntlvping.py
@@ -0,0 +1,51 @@
+#!/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 time
+import unittest
+import process_manager
+
+class test_ndntlvping(unittest.TestCase, process_manager.process_manager):
+ """Test case for testing ndn-tlv-ping application"""
+
+ def setUp(self):
+ print "\nTesting ndn-tlv-ping"
+ print "********************"
+
+ def tearDown(self):
+ self.killNfd()
+ self.killProcess("ndnpingserver")
+ self.killProcess("ndnping")
+
+ def test_ping(self):
+ self.startNfd()
+ time.sleep(1)
+ self.startProcess("ndnpingserver",
+ ["ndnpingserver", "-p 1", "/test/ndntlvping"], "-> Starting Ping Server")
+ time.sleep(1)
+ self.startProcess("ndnping",
+ ["ndnping", "-c 1", "/test/ndntlvping"], "-> Starting Ping Client")
+ time.sleep(1)
+ self.waitForProcessCompletion("ndnping", 10)
+ self.waitForProcessCompletion("ndnpingserver", 10)
+ self.killProcess("ndnping")
+ self.killProcess("ndnpingserver")
+ self.killNfd()
+ if self.hasProcessCompleted("ndnping"):
+ if self.getProcessReturnCode("ndnping") != 0:
+ print self.getProcessError("ndnping")
+ self.fail(">> TEST FAILED - received non-zero return code from ndnping")
+ else:
+ self.fail(">> TEST FAILED - ndnping failed to complete")
+ if self.hasProcessCompleted("ndnpingserver"):
+ if self.getProcessReturnCode("ndnpingserver") != 0:
+ print self.getProcessError("ndnpingserver")
+ self.fail(">> TEST FAILED - received non-zero return code from ndnpingserver")
+ else:
+ self.fail(">> TEST FAILED - ndnpingserver failed to complete")
+ print ">> TEST SUCCESSFUL"