Eric Newberry | 608211e | 2017-11-27 21:59:37 -0700 | [diff] [blame^] | 1 | #!/usr/bin/python2 |
| 2 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 3 | # |
| 4 | # Copyright (C) 2017 The University of Arizona |
| 5 | # Author: Eric Newberry <enewberry@cs.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_congestionmark(unittest.TestCase): |
| 14 | """Test case for CongestionMark field""" |
| 15 | |
| 16 | def setUp(self): |
| 17 | print "\nTesting CongestionMark" |
| 18 | print "*****************" |
| 19 | os.chdir("test_congestionmark") |
| 20 | |
| 21 | def tearDown(self): |
| 22 | print "*****************" |
| 23 | os.chdir("..") |
| 24 | |
| 25 | def test_congestionmark(self): |
| 26 | ret = subprocess.call(["./congestionmark-test.sh"], shell=True) |
| 27 | print "Test script return value:", ret |
| 28 | errormsg = { |
| 29 | 1 : "Failed to create required routes", |
| 30 | 2 : "Failed to set CongestionMarkStrategy", |
| 31 | 3 : "Interest /arizona/cs timed out, was nacked, or did not contain a congestion mark with a value of 1", |
| 32 | 4 : "Interest /ucla/cs timed out, was nacked, or contained a congestion mark", |
| 33 | 5 : "Interest /ucsd/caida timed out, was nacked, or did not contain a congestion mark with a value of 3", |
| 34 | 6 : "Consumer did not exit with status 0", |
| 35 | } |
| 36 | if (ret != 0): |
| 37 | self.fail(errormsg[ret]) |