| #!/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_broadcast(unittest.TestCase): |
| """Test case for broadcast scenario""" |
| |
| def setUp(self): |
| print "\nTesting Broadcast scenario" |
| print "**************************" |
| os.chdir("test_broadcast") |
| |
| def tearDown(self): |
| print "**************************" |
| os.chdir("..") |
| |
| def test_broadcast(self): |
| ret = subprocess.call(["./broadcast-test.sh"], shell=True) |
| print "Test script return value:", ret |
| errormsg = { |
| 1 : "B did not receive at least 80 Interests.", |
| 2 : "C did not receive at least 80 Interests.", |
| 3 : "Incoming Data packets in D exceeded 120.", |
| } |
| if ret != 0: |
| self.fail(errormsg[ret]) |