diff options
author | 2016-03-07 12:54:33 +0200 | |
---|---|---|
committer | 2016-03-07 12:54:33 +0200 | |
commit | fadf9cb9e331f70157b90f79d9e2b10a0471013e (patch) | |
tree | f05647626e0446c9f8691659c4a51060a3918805 /scripts/automation/regression/unit_tests/functional_tests | |
parent | 1f6826dda8ffa724f8ba8c3dc4b22883d5c99603 (diff) | |
parent | ea61eabf9f76ef4dea1ad2a4f0cd5cd8f367bd02 (diff) |
Merge scapy remove crypto. for ADS server
Diffstat (limited to 'scripts/automation/regression/unit_tests/functional_tests')
3 files changed, 54 insertions, 56 deletions
diff --git a/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py b/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py index 54ffddb5..c6b477aa 100755 --- a/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py +++ b/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py @@ -53,7 +53,7 @@ class CTRexHltApi_Test(unittest.TestCase): packet: binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGusUAAAAAwAAAAQQAAFAAAAABAAAAAVAAD+U1/QAAISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -109,7 +109,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGrxPAqAEBBQUFBQQAAFAAAAABAAAAAVAAD+UqSwAAISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -168,7 +168,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGusUAAAAAwAAAAQQABNIAAAABAAAAAVAAD+UxewAAISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -246,7 +246,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEARuroAAAAAwAAAAQTSBNIAHsmgISEhISEhISEhISEhISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -307,7 +307,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAuqAAAAAEAGr00AAAAAwAAAAQQAAFAAAAABAAAAAVAAD+UwiwAAISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEh meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -353,7 +353,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAGQAAAAAEARuVwAAAAAwAAAAQQAAFABfCaTISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEh meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -407,7 +407,7 @@ TBD packet: binary: AAAAAAAAAAABAAABgQAwAAgARQAALgAAAABABrrJAAAAAMAAAAEEAABQAAAAAQAAAAFQAA/leEMAACEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -439,7 +439,7 @@ TBD packet: binary: AAAAAAAAAAABAAABgQAwAYEAMAKBADADgQAwBAgARQAARgAAAABABrqxAAAAAMAAAAEEAABQAAAAAQAAAAFQAA/l6p0AACEhISEhISEhISEhISEhISEhISEhISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -471,7 +471,7 @@ TBD packet: binary: AAAAAAAAAAABAAABgQAwAYEAMAKBADPogQAwBIEAMAUIAEUAAEIAAAAAQAa6tQAAAADAAAABBAAAUAAAAAEAAAABUAAP5SzkAAAhISEhISEhISEhISEhISEhISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -553,7 +553,7 @@ TBD packet: binary: AAAAAAAAAAABAAABht1gAAAAAG4GQP6AAAAAAAAAAAAAAAAAABL+gAAAAAAAAAAAAAAAAAAiBAAAUAAAAAEAAAABUAAP5ctLAAAhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISE= meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -583,7 +583,7 @@ TBD packet: binary: AAAAAAAAAAABAAABht1gAAAAAG4RQBERIiIzM0REVVVmZnd3iIgRERERERERERERERERERERBAAAUABucjohISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISE= meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: diff --git a/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py b/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py index 79ef4364..7e2f6271 100644 --- a/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py +++ b/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py @@ -308,18 +308,17 @@ class CTRexPktBuilderSanitySCapy_Test(pkt_bld_general_test.CGeneralPktBld_Test): def test_simple_pkt_loader1(self): - pass; - #pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/udp_590.cap"); - #print "" - #pkt_builder.dump_as_hex() - #r = pkt_builder.pkt_raw - #assert_equal(ord(r[1]),0x50) - #assert_equal(ord(r[0]),0x00) - #assert_equal(ord(r[0x240]),0x16) - #assert_equal(ord(r[0x24d]),0x79) - #assert_equal(len(r),590) - - #print len(r) + pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/udp_590.cap", build_raw = False); + print "" + pkt_builder.dump_as_hex() + r = pkt_builder.pkt_raw + assert_equal(ord(r[1]),0x50) + assert_equal(ord(r[0]),0x00) + assert_equal(ord(r[0x240]),0x16) + assert_equal(ord(r[0x24d]),0x79) + assert_equal(len(r),590) + + print len(r) def test_simple_pkt_loader2(self): diff --git a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py index 88a6983f..cd653895 100644 --- a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py +++ b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py @@ -8,10 +8,12 @@ from nose.tools import nottest from nose.plugins.attrib import attr from unit_tests.trex_general_test import CTRexScenario from dpkt import pcap - +from trex_stl_lib import trex_stl_sim import sys import os import subprocess +import shlex +from threading import Thread @attr('run_on_trex') class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): @@ -36,7 +38,9 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): for k, v in self.profiles.iteritems(): self.verify_exists(v) - self.valgrind_profiles = [ self.profiles['imix_3pkt_vm'], self.profiles['random_size_9k'], self.profiles['imix_tuple_gen']] + self.valgrind_profiles = [ self.profiles['imix_3pkt_vm'], + self.profiles['random_size_9k'], + self.profiles['imix_tuple_gen'] ] self.golden_path = os.path.join(self.test_path,"stl/golden/") @@ -81,39 +85,21 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): - def run_sim (self, yaml, output, options = "", silent = False): + def run_sim (self, yaml, output, options = "", silent = False, obj = None): if output: user_cmd = "-f {0} -o {1} {2}".format(yaml, output, options) else: user_cmd = "-f {0} {1}".format(yaml, options) - cmd = "{0} {1}".format(self.stl_sim, - user_cmd) - if silent: - devnull = open('/dev/null', 'w') - rc = subprocess.call(cmd, shell = True, stdout = devnull) - else: - print cmd - rc = subprocess.call(cmd, shell = True) - - return (rc == 0) + user_cmd += " --silent" + rc = trex_stl_sim.main(args = shlex.split(user_cmd)) + if obj: + obj['rc'] = (rc == 0) - def golden_run (self, testname, profile, options, silent = False): - - output_cap = os.path.join("/tmp/", "{0}_test.cap".format(testname)) - golden_cap = os.path.join(self.test_path, "stl/golden/{0}_golden.cap".format(testname)) - if os.path.exists(output_cap): - os.unlink(output_cap) - try: - rc = self.run_sim(self.profiles[profile], output_cap, options, silent) - assert_equal(rc, True) + return (rc == 0) - self.compare_caps(output_cap, golden_cap) - - finally: - os.unlink(output_cap) def run_py_profile_path (self, profile, options,silent = False, do_no_remove=False,compare =True, test_generated=True): @@ -170,8 +156,8 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): ["udp_inc_len_9k.py","-m 1 -l 100",True], ["udp_1pkt_range_clients.py","-m 1 -l 100",True], ["multi_burst_2st_1000pkt.py","-m 1 -l 100",True], - #["pcap.py", "-m 1", True], - #["pcap_with_vm.py", "-m 1", True], + ["pcap.py", "-m 1", True], + ["pcap_with_vm.py", "-m 1", True], # YAML test ["yaml/burst_1000_pkt.yaml","-m 1 -l 100",True], @@ -202,7 +188,7 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): ["udp_1pkt_simple_test2.py","-m 1 -l 10 ",True], # test split of packet with ip option ["udp_1pkt_simple_test.py","-m 1 -l 10 ",True], ["udp_1pkt_mac_mask5.py","-m 1 -l 30 ",True], - #["udp_1pkt_range_clients_split_garp.py","-m 1 -l 50",True] + ["udp_1pkt_range_clients_split_garp.py","-m 1 -l 50",True] ]; @@ -247,13 +233,26 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): for obj in p: self.run_py_profile_path (obj[0], obj[1], compare =obj[2], do_no_remove=True) - # valgrind tests + # valgrind tests - this runs in multi thread as it safe (no output) def test_valgrind_various_profiles (self): print "\n" + threads = [] for profile in self.valgrind_profiles: - print "\n*** testing profile '{0}' ***\n".format(profile) - rc = self.run_sim(profile, output = None, options = "--cores 8 --limit 20 --valgrind", silent = False) - assert_equal(rc, True) + print "\n*** VALGRIND: testing profile '{0}' ***\n".format(profile) + obj = {'t': None, 'rc': None} + t = Thread(target = self.run_sim, + kwargs = {'obj': obj, 'yaml': profile, 'output':None, 'options': "--cores 8 --limit 20 --valgrind", 'silent': True}) + obj['t'] = t + + threads.append(obj) + t.start() + + for obj in threads: + obj['t'].join() + + for obj in threads: + assert_equal(obj['rc'], True) + |