Yi Huang | 2d9ec55 | 2014-04-26 03:41:26 -0700 | [diff] [blame] | 1 | #!/usr/bin/python2 |
| 2 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 3 | # |
| 4 | # Copyright (C) 2014 University of Arizona |
| 5 | # Author: Yi Huang <ltr120@email.arizona.edu> |
| 6 | # See COPYING for copyright and distribution information. |
| 7 | # |
| 8 | |
| 9 | import os |
| 10 | import unittest |
| 11 | import subprocess |
| 12 | |
| 13 | class test_nrd(unittest.TestCase): |
| 14 | """Test case for NRD""" |
| 15 | |
| 16 | def setUp(self): |
| 17 | print "\nTesting NRD" |
| 18 | print "***********" |
| 19 | os.chdir("test_nrd") |
| 20 | |
| 21 | def tearDown(self): |
| 22 | print "***********" |
| 23 | os.chdir("..") |
| 24 | |
| 25 | def test_nrd(self): |
| 26 | ret = subprocess.call(["./nrd-test.sh"], shell=True) |
| 27 | print "Test script return value:", ret |
| 28 | errormsg = { |
| 29 | 1 : "the name '/test-nrd/A' already exists before ndn-traffic-server starts", |
| 30 | 2 : "the name '/test-nrd/B' already exists before ndn-traffic-server starts", |
| 31 | 3 : "the name '/test-nrd/A' does not exists after ndn-traffic-server starts", |
| 32 | 4 : "the name '/test-nrd/B' does not exists after ndn-traffic-server starts", |
| 33 | 5 : "the name '/test-nrd/A' still exists after ndn-traffic-server exit", |
| 34 | 6 : "the name '/test-nrd/B' still exists after ndn-traffic-server exit", |
| 35 | } |
| 36 | if (ret != 0): |
| 37 | self.fail(errormsg[ret]) |