nrd-test: Add test case for NRD
Refs: #1381
Change-Id: I1a195552ce93ea43f59831c39d708e6c22455ca8
diff --git a/test_nrd/test_nrd.py b/test_nrd/test_nrd.py
new file mode 100644
index 0000000..b64909b
--- /dev/null
+++ b/test_nrd/test_nrd.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python2
+# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2014 University of Arizona
+# Author: Yi Huang <ltr120@email.arizona.edu>
+# See COPYING for copyright and distribution information.
+#
+
+import os
+import unittest
+import subprocess
+
+class test_nrd(unittest.TestCase):
+ """Test case for NRD"""
+
+ def setUp(self):
+ print "\nTesting NRD"
+ print "***********"
+ os.chdir("test_nrd")
+
+ def tearDown(self):
+ print "***********"
+ os.chdir("..")
+
+ def test_nrd(self):
+ ret = subprocess.call(["./nrd-test.sh"], shell=True)
+ print "Test script return value:", ret
+ errormsg = {
+ 1 : "the name '/test-nrd/A' already exists before ndn-traffic-server starts",
+ 2 : "the name '/test-nrd/B' already exists before ndn-traffic-server starts",
+ 3 : "the name '/test-nrd/A' does not exists after ndn-traffic-server starts",
+ 4 : "the name '/test-nrd/B' does not exists after ndn-traffic-server starts",
+ 5 : "the name '/test-nrd/A' still exists after ndn-traffic-server exit",
+ 6 : "the name '/test-nrd/B' still exists after ndn-traffic-server exit",
+ }
+ if (ret != 0):
+ self.fail(errormsg[ret])