Пример #1
0
 def tearDown(self):
     #######################################################################
     # Simulate regular resource shutdown
     self.comp.releaseObject()
     
     self.comp.stop()
     sb.reset()
     sb.stop()
     ossie.utils.testing.ScaComponentTestCase.tearDown(self);
Пример #2
0
    def tearDown(self):
        #######################################################################
        # Simulate regular resource shutdown
        self.comp.releaseObject()

        self.comp.stop()
        sb.reset()
        sb.stop()
        ossie.utils.testing.ScaComponentTestCase.tearDown(self)
Пример #3
0
    def tearDown(self):
        """ Stops unit test - run after every method that starts with test """
        #######################################################################
        # Simulate regular resource shutdown
        self.comp.releaseObject()

        # stops everything
        self.comp.stop()
        sb.reset()
        sb.stop()
        ossie.utils.testing.ScaComponentTestCase.tearDown(self)
Пример #4
0
    def tearDown(self):
        """ Stops unit test - run after every method that starts with test """
        #######################################################################
        # Simulate regular resource shutdown
        self.comp.releaseObject()

        # stops everything
        self.comp.stop()
        sb.reset()
        sb.stop()
        ossie.utils.testing.ScaComponentTestCase.tearDown(self)
Пример #5
0
	def run(self):
		print 'starting benchmark'
		sb.start()
		
		#first sample recorded should be a couple away from the start of BenchmarkGen
		#due to the high output rate to fill up the queue
		lastTP = self.bc.packets_per_time_avg*self.samplesAway
		
		#loop counter
		loopCount = 0
		#run until less than 1%
		while 1:
			timer = 0
			#run until time for benchmark runs out
			while timer <= self.bmTime: 
				#run until next value can be collected
				while self.bc.totalPackets <= lastTP: 
					sleep(.1)
					timer = timer + .1;
				#collect data from benchmark component
				self.samples.append(float(timer + loopCount*self.bmTime))
				self.outputRates.append(float(self.bc.avg_output_rate))
				self.times.append(float(self.bc.time))
				lastTP = lastTP + self.bc.packets_per_time_avg
			#calculating statistics
			N = len(self.samples)
			s = numpy.std(self.outputRates)
			x = numpy.mean(self.outputRates)
			value = 1.96*(s/numpy.sqrt(N))
			lower = x - value
			upper = x + value
			percent = (value / x) * 100
			
			#debug
			if self.debug==1:
				print 'N is: ' + str(int(N))
				print 's is: ' + str(float(s))
				print 'x is: ' + str(float(x))
				print 'value is: ' + str(float(value))
				print '95% confidence level: ' + str(float(lower)) + ' - ' + str(float(upper))
				print 'percent away is: ' + str(float(percent))
			loopCount = loopCount + 1
			if(percent <= 1):
				break;
		
		self.printStats()
		if self.showPlot==1:
			self.plot()
		
		sb.reset()
		sb.stop()
Пример #6
0
import unittest
import ossie.utils.testing
import os
from omniORB import any
from ossie.utils import sb
import time
import filecmp
import os
import hashlib

case1 = True

case1_pass = False
if case1:
    print "executing case 1"
    sb.reset()
    decoder = sb.launch("ADSBdecoder_MR")
    reader = sb.launch("FileReader")

    #####configure the properties####
    reader.configure({
        'sample_rate':
        '2Msps',
        'file_format':
        'SCALAR OCTET (8o)',
        'source_uri':
        '/home/redhawk/git/ADSBdecoder_MR/tests/testfiles/modes1.bin'
    })
    decoder.configure({'InteractiveMode': 1, 'StatsMode': 1, 'NetMode': 0})

    ####do the connections
    def test_simpleComp(self):       
        comp = sb.Component(self.test_comp)
        comp.api()
        
        # Check the init values
        self.initValues(comp)
        
        # Change values
        comp.my_bool_true = False
        comp.my_bool_false = True
        comp.my_long = 22
        comp.my_str = "new"
        comp.my_struct.bool_true = False
        comp.my_struct.bool_false = True
        comp.my_struct.long_s = 33
        comp.my_seq_bool[0] = False
        comp.my_seq_bool[1] = True
        comp.my_seq_str[0] = "1"
        comp.my_seq_str[1] = "2"
        comp.my_seq_str[2] = "3"
        self.assertEquals(comp.my_bool_true, False)
        self.assertEquals(comp.my_bool_false, True)
        self.assertEquals(comp.my_long, 22)
        self.assertEquals(comp.my_str, "new")
        self.assertEquals(comp.my_struct.bool_true, False)
        self.assertEquals(comp.my_struct.bool_false, True)
        self.assertEquals(comp.my_struct.long_s, 33)
        self.assertEquals(comp.my_seq_bool[0], False)
        self.assertEquals(comp.my_seq_bool[1], True)
        self.assertEquals(comp.my_seq_str[0], "1")
        self.assertEquals(comp.my_seq_str[1], "2")
        self.assertEquals(comp.my_seq_str[2], "3")

        # Checks invalid simple enumeration changes
        comp.my_long_enum = 10
        comp.my_long_enum = "one"
        comp.my_long_enum = "3"
        comp.my_long_enum = 11.1
        comp.my_long_enum = False
        self.assertEquals(comp.my_long_enum, None)
        comp.my_str_enum = 10
        comp.my_str_enum = "one"
        comp.my_str_enum = 11.1
        comp.my_str_enum = False
        # TODO Bug #131 self.assertEquals(comp.my_str_enum, None)
        comp.my_bool_enum = 10
        comp.my_bool_enum = "one"
        comp.my_bool_enum = 11.1
        comp.my_bool_enum = "invalid"
        self.assertEquals(comp.my_bool_enum, None)
        
        # Checks invalid struct enumeration changes
        comp.my_struct.enum_long = 10
        comp.my_struct.enum_long = "one"
        comp.my_struct.enum_long = "3"
        comp.my_struct.enum_long = 11.1
        comp.my_struct.enum_long = False
        self.assertEquals(comp.my_struct.enum_long, None)
        comp.my_struct.enum_str = 10
        comp.my_struct.enum_str = "one"
        comp.my_struct.enum_str = 11.1
        comp.my_struct.enum_str = False
        #TODO Bug #131 self.assertEquals(comp.my_struct.enum_str, None)
        comp.my_struct.enum_bool = 10
        comp.my_struct.enum_bool = "one"
        comp.my_struct.enum_bool = 11.1
        comp.my_struct.enum_bool = "valid"
        self.assertEquals(comp.my_struct.enum_bool, None)
        
        # Checks changes to simple enumerations
        comp.my_long_enum = "ONE"
        self.assertEquals(comp.my_long_enum, 11)
        comp.my_long_enum = "Two"
        self.assertEquals(comp.my_long_enum, 11)
        comp.my_long_enum = 33
        self.assertEquals(comp.my_long_enum, 33)
        comp.my_long_enum = 34
        self.assertEquals(comp.my_long_enum, 33)
     
        comp.my_str_enum = "ONE"
        self.assertEquals(comp.my_str_enum, "FIRST")
        comp.my_str_enum = "two"
        self.assertEquals(comp.my_str_enum, "FIRST")
        comp.my_str_enum = "SECOND"
        self.assertEquals(comp.my_str_enum, "SECOND")
        comp.my_str_enum = "third"
        self.assertEquals(comp.my_str_enum, "SECOND")
        
        comp.my_bool_enum = "VALID"
        self.assertEquals(comp.my_bool_enum, True)
        comp.my_bool_enum = "false"
        self.assertEquals(comp.my_bool_enum, True)
        comp.my_bool_enum = False
        self.assertEquals(comp.my_bool_enum, False)
        comp.my_bool_enum = True
        self.assertEquals(comp.my_bool_enum, True)
        comp.my_bool_enum = "INVALID"
        self.assertEquals(comp.my_bool_enum, False)
        
        # Checks changes to struct enumerations
        comp.my_struct.enum_long = "ONE"
        self.assertEquals(comp.my_struct.enum_long, 1)
        comp.my_struct.enum_long = "Two"
        self.assertEquals(comp.my_struct.enum_long, 1)
        comp.my_struct.enum_long = 3
        self.assertEquals(comp.my_struct.enum_long, 3)
        comp.my_struct.enum_long = 4
        self.assertEquals(comp.my_struct.enum_long, 3)
        
        comp.my_struct.enum_str = "ONE"
        self.assertEquals(comp.my_struct.enum_str, "first")
        comp.my_struct.enum_str = "two"
        self.assertEquals(comp.my_struct.enum_str, "first")
        comp.my_struct.enum_str = "second"
        self.assertEquals(comp.my_struct.enum_str, "second")
        comp.my_struct.enum_str = "THIRD"
        self.assertEquals(comp.my_struct.enum_str, "second")
        
        comp.my_struct.enum_bool = "VALID"
        self.assertEquals(comp.my_struct.enum_bool, True)
        comp.my_struct.enum_bool = "false"
        self.assertEquals(comp.my_struct.enum_bool, True)
        comp.my_struct.enum_bool = False
        self.assertEquals(comp.my_struct.enum_bool, False)
        comp.my_struct.enum_bool = True
        self.assertEquals(comp.my_struct.enum_bool, True)
        comp.my_struct.enum_bool = "INVALID"
        self.assertEquals(comp.my_struct.enum_bool, False)
        
        
        # Make sure reset works properly
        sb.reset()
        self.initValues(comp)
Пример #8
0
    def test_simpleComp(self):
        comp = sb.launch(self.test_comp)
        comp.api()

        # Check the init values
        self.initValues(comp)

        # Change values
        comp.my_bool_true = False
        comp.my_bool_false = True
        comp.my_long = 22
        comp.my_str = "new"
        comp.my_struct.bool_true = False
        comp.my_struct.bool_false = True
        comp.my_struct.long_s = 33
        comp.my_seq_bool[0] = False
        comp.my_seq_bool[1] = True
        comp.my_seq_str[0] = "1"
        comp.my_seq_str[1] = "2"
        comp.my_seq_str[2] = "3"
        self.assertEquals(comp.my_bool_true, False)
        self.assertEquals(comp.my_bool_false, True)
        self.assertEquals(comp.my_long, 22)
        self.assertEquals(comp.my_str, "new")
        self.assertEquals(comp.my_struct.bool_true, False)
        self.assertEquals(comp.my_struct.bool_false, True)
        self.assertEquals(comp.my_struct.long_s, 33)
        self.assertEquals(comp.my_seq_bool[0], False)
        self.assertEquals(comp.my_seq_bool[1], True)
        self.assertEquals(comp.my_seq_str[0], "1")
        self.assertEquals(comp.my_seq_str[1], "2")
        self.assertEquals(comp.my_seq_str[2], "3")

        # Checks invalid simple enumeration changes
        comp.my_long_enum = 10
        comp.my_long_enum = "one"
        comp.my_long_enum = "3"
        comp.my_long_enum = 11.1
        comp.my_long_enum = False
        self.assertEquals(comp.my_long_enum, None)
        comp.my_str_enum = 10
        comp.my_str_enum = "one"
        comp.my_str_enum = 11.1
        comp.my_str_enum = False
        self.assertEquals(comp.my_str_enum, None)
        comp.my_bool_enum = 10
        comp.my_bool_enum = "one"
        comp.my_bool_enum = 11.1
        comp.my_bool_enum = "invalid"
        self.assertEquals(comp.my_bool_enum, None)

        # Checks invalid struct enumeration changes
        comp.my_struct.enum_long = 10
        comp.my_struct.enum_long = "one"
        comp.my_struct.enum_long = "3"
        comp.my_struct.enum_long = 11.1
        comp.my_struct.enum_long = False
        self.assertEquals(comp.my_struct.enum_long, None)
        comp.my_struct.enum_str = 10
        comp.my_struct.enum_str = "one"
        comp.my_struct.enum_str = 11.1
        comp.my_struct.enum_str = False
        self.assertEquals(comp.my_struct.enum_str, None)
        comp.my_struct.enum_bool = 10
        comp.my_struct.enum_bool = "one"
        comp.my_struct.enum_bool = 11.1
        comp.my_struct.enum_bool = "valid"
        self.assertEquals(comp.my_struct.enum_bool, None)

        # Checks changes to simple enumerations
        comp.my_long_enum = "ONE"
        self.assertEquals(comp.my_long_enum, 11)
        comp.my_long_enum = "Two"
        self.assertEquals(comp.my_long_enum, 11)
        comp.my_long_enum = 33
        self.assertEquals(comp.my_long_enum, 33)
        comp.my_long_enum = 34
        self.assertEquals(comp.my_long_enum, 33)

        comp.my_str_enum = "ONE"
        self.assertEquals(comp.my_str_enum, "FIRST")
        comp.my_str_enum = "two"
        self.assertEquals(comp.my_str_enum, "FIRST")
        comp.my_str_enum = "SECOND"
        self.assertEquals(comp.my_str_enum, "SECOND")
        comp.my_str_enum = "third"
        self.assertEquals(comp.my_str_enum, "SECOND")

        comp.my_bool_enum = "VALID"
        self.assertEquals(comp.my_bool_enum, True)
        comp.my_bool_enum = "false"
        self.assertEquals(comp.my_bool_enum, True)
        comp.my_bool_enum = False
        self.assertEquals(comp.my_bool_enum, False)
        comp.my_bool_enum = True
        self.assertEquals(comp.my_bool_enum, True)
        comp.my_bool_enum = "INVALID"
        self.assertEquals(comp.my_bool_enum, False)

        # Checks changes to struct enumerations
        comp.my_struct.enum_long = "ONE"
        self.assertEquals(comp.my_struct.enum_long, 1)
        comp.my_struct.enum_long = "Two"
        self.assertEquals(comp.my_struct.enum_long, 1)
        comp.my_struct.enum_long = 3
        self.assertEquals(comp.my_struct.enum_long, 3)
        comp.my_struct.enum_long = 4
        self.assertEquals(comp.my_struct.enum_long, 3)

        comp.my_struct.enum_str = "ONE"
        self.assertEquals(comp.my_struct.enum_str, "first")
        comp.my_struct.enum_str = "two"
        self.assertEquals(comp.my_struct.enum_str, "first")
        comp.my_struct.enum_str = "second"
        self.assertEquals(comp.my_struct.enum_str, "second")
        comp.my_struct.enum_str = "THIRD"
        self.assertEquals(comp.my_struct.enum_str, "second")

        comp.my_struct.enum_bool = "VALID"
        self.assertEquals(comp.my_struct.enum_bool, True)
        comp.my_struct.enum_bool = "false"
        self.assertEquals(comp.my_struct.enum_bool, True)
        comp.my_struct.enum_bool = False
        self.assertEquals(comp.my_struct.enum_bool, False)
        comp.my_struct.enum_bool = True
        self.assertEquals(comp.my_struct.enum_bool, True)
        comp.my_struct.enum_bool = "INVALID"
        self.assertEquals(comp.my_struct.enum_bool, False)

        # Make sure reset works properly
        sb.reset()
        self.initValues(comp)