| #!/usr/bin/python2 |
| # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| # |
| # Copyright (C) 2017 Arizona Board of Regents. |
| # Author: Eric Newberry <enewberry@cs.arizona.edu> |
| # See COPYING for copyright and distribution information. |
| # |
| |
| import os |
| import unittest |
| import subprocess |
| |
| class test_congestionmark(unittest.TestCase): |
| """Test case for CongestionMark field""" |
| |
| def setUp(self): |
| print "\nTesting CongestionMark" |
| print "*****************" |
| os.chdir("test_congestionmark") |
| |
| def tearDown(self): |
| print "*****************" |
| os.chdir("..") |
| |
| def test_congestionmark(self): |
| ret = subprocess.call(["./congestionmark-test.sh"], shell=True) |
| print "Test script return value:", ret |
| errormsg = { |
| 1 : "Failed to create required routes", |
| 2 : "Failed to set CongestionMarkStrategy", |
| 3 : "Interest /arizona/cs timed out, was nacked, or did not contain a congestion mark with a value of 1", |
| 4 : "Interest /ucla/cs timed out, was nacked, or contained a congestion mark", |
| 5 : "Interest /ucsd/caida timed out, was nacked, or did not contain a congestion mark with a value of 3", |
| 6 : "Consumer did not exit with status 0", |
| } |
| if (ret != 0): |
| self.fail(errormsg[ret]) |