| #!/usr/bin/python2 |
| # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| # |
| # Copyright (C) 2014-2018 Arizona Board of Regents. |
| # Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu> |
| # Author: Eric Newberry <enewberry@cs.arizona.edu> |
| # See COPYING for copyright and distribution information. |
| # |
| |
| import os |
| import unittest |
| import subprocess |
| |
| class test_ndnping(unittest.TestCase): |
| """Test case for the ndnping application""" |
| |
| def setUp(self): |
| print "\nTesting ndnping" |
| print "***************" |
| os.chdir("test_ndnping") |
| |
| def tearDown(self): |
| print "***************" |
| os.chdir("..") |
| |
| def test_ndnping(self): |
| ret = subprocess.call(["./ndnping-test.sh"], shell=True) |
| print "Test script return value:", ret |
| errormsg = { |
| 1 : "ndnping did not receive a Data packet satisfying its Interest", |
| 2 : "ndnpingserver did not exit after sending 5 Data packets", |
| 3 : "ndnpingserver did not receive 5 Interests", |
| } |
| if (ret != 0): |
| self.fail(errormsg[ret]) |