jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 1 | #!/usr/bin/python2 |
| 2 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 3 | # |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame^] | 4 | # Copyright (C) 2014-2018 Arizona Board of Regents. |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 5 | # Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu> |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame^] | 6 | # Author: Eric Newberry <enewberry@cs.arizona.edu> |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 7 | # See COPYING for copyright and distribution information. |
| 8 | # |
| 9 | |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame^] | 10 | import os |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 11 | import unittest |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame^] | 12 | import subprocess |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 13 | |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame^] | 14 | class test_ndnping(unittest.TestCase): |
| 15 | """Test case for the ndnping application""" |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 16 | |
| 17 | def setUp(self): |
Eric Newberry | 86b00b9 | 2015-06-07 15:23:51 -0700 | [diff] [blame] | 18 | print "\nTesting ndnping" |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame^] | 19 | print "***************" |
| 20 | os.chdir("test_ndnping") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 21 | |
| 22 | def tearDown(self): |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame^] | 23 | print "***************" |
| 24 | os.chdir("..") |
jeraldabraham | 5d4d735 | 2014-03-28 02:49:04 -0700 | [diff] [blame] | 25 | |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame^] | 26 | def test_ndnping(self): |
| 27 | ret = subprocess.call(["./ndnping-test.sh"], shell=True) |
| 28 | print "Test script return value:", ret |
| 29 | errormsg = { |
| 30 | 1 : "ndnping did not receive a Data packet satisfying its Interest", |
| 31 | 2 : "ndnpingserver did not exit after sending 5 Data packets", |
| 32 | 3 : "ndnpingserver did not receive 5 Interests", |
| 33 | } |
| 34 | if (ret != 0): |
| 35 | self.fail(errormsg[ret]) |