| #!/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]) |