blob: 97b7a760025ba3dc4f6ce1fe535f68770fd6341e [file] [log] [blame]
jeraldabraham3a2466e2014-04-09 00:19:45 -07001#!/usr/bin/python2
2# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
3#
Eric Newberryc22afde2018-06-19 01:28:31 -07004# Copyright (C) 2014-2018 Arizona Board of Regents.
jeraldabraham3a2466e2014-04-09 00:19:45 -07005# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
Eric Newberryc22afde2018-06-19 01:28:31 -07006# Author: Eric Newberry <enewberry@cs.arizona.edu>
jeraldabraham3a2466e2014-04-09 00:19:45 -07007# See COPYING for copyright and distribution information.
8#
9
10import os
jeraldabraham3a2466e2014-04-09 00:19:45 -070011import unittest
Eric Newberryc22afde2018-06-19 01:28:31 -070012import subprocess
jeraldabraham3a2466e2014-04-09 00:19:45 -070013
Eric Newberryc22afde2018-06-19 01:28:31 -070014class test_ndntraffic(unittest.TestCase):
15 """Test case for ndn-traffic-generator"""
jeraldabraham3a2466e2014-04-09 00:19:45 -070016
17 def setUp(self):
18 print "\nTesting ndn-traffic-generator"
19 print "*****************************"
Eric Newberryc22afde2018-06-19 01:28:31 -070020 os.chdir("test_ndntraffic")
jeraldabraham3a2466e2014-04-09 00:19:45 -070021
22 def tearDown(self):
Eric Newberryc22afde2018-06-19 01:28:31 -070023 print "*****************************"
24 os.chdir("..")
jeraldabraham3a2466e2014-04-09 00:19:45 -070025
Eric Newberryc22afde2018-06-19 01:28:31 -070026 def test_ndntraffic(self):
27 ret = subprocess.call(["./ndntraffic-test.sh"], shell=True)
28 print "Test script return value:", ret
29 errormsg = {
Davide Pesavento15af8b52019-01-27 14:06:54 -050030 1 : "ndn-traffic-client did not receive a Data satisfying its Interest",
Eric Newberryc22afde2018-06-19 01:28:31 -070031 2 : "ndn-traffic-server did not exit after sending a Data packet",
32 }
33 if (ret != 0):
34 self.fail(errormsg[ret])