diff options
| author | 童宗振 <[email protected]> | 2024-01-17 02:44:24 +0000 |
|---|---|---|
| committer | 陆秋文 <[email protected]> | 2024-01-17 02:44:24 +0000 |
| commit | e0433fc974a91a2ec7a6939325a47a74b01f450e (patch) | |
| tree | c530a6d0147f4cb733211558becb60988ca409d9 /test | |
| parent | 4b061783cf6771a47b39fd34443c81cd0ea7fe14 (diff) | |
refactor ci
Diffstat (limited to 'test')
26 files changed, 357 insertions, 120 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 58ec534..f048460 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,119 +1,7 @@ -include_directories(${CMAKE_SOURCE_DIR}/include) -include_directories(${CMAKE_SOURCE_DIR}/include/extern) -include_directories(${CMAKE_SOURCE_DIR}/include/internal) -include_directories(${CMAKE_SOURCE_DIR}) - -# Create veth -execute_process( - COMMAND /bin/bash ${CMAKE_SOURCE_DIR}/test/create_veth.sh create 24 - RESULT_VARIABLE VETH_RESULT - OUTPUT_VARIABLE VETH_OUTPUT - ERROR_VARIABLE VETH_ERROR - OUTPUT_STRIP_TRAILING_WHITESPACE -) - -# Check veth create -if(VETH_RESULT) -message(FATAL_ERROR "${CMAKE_SOURCE_DIR}/test/create_veth.sh create 24") - message(FATAL_ERROR "Failed to create veth: ${VETH_ERROR}") +if(ENABLE_PTF_TEST) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ptf_test) endif() -# Create veth for msgpack -execute_process( - COMMAND /bin/bash ${CMAKE_SOURCE_DIR}/test/create_veth.sh create msgpack - RESULT_VARIABLE VETH_RESULT - OUTPUT_VARIABLE VETH_OUTPUT - ERROR_VARIABLE VETH_ERROR - OUTPUT_STRIP_TRAILING_WHITESPACE -) - -# Check veth create for msgpack -if(VETH_RESULT) -message(FATAL_ERROR "${CMAKE_SOURCE_DIR}/test/create_veth.sh create msgpack") - message(FATAL_ERROR "Failed to create veth: ${VETH_ERROR}") +if(ENABLE_FUZZING_TEST) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/fuzzing) endif() - -# Script for generating "--interface" -# for i in range(0, 24): -# print(f"--interface {i}@veth{i}-ptf{i}", end=" ") - -# Add vwire test -add_test( - NAME vwire_test - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 --interface 3@veth3-ptf3 --interface 4@veth4-ptf4 --interface 5@veth5-ptf5 --interface 6@veth6-ptf6 --interface 7@veth7-ptf7 --interface 8@veth8-ptf8 --interface 9@veth9-ptf9 --interface 10@veth10-ptf10 --interface 11@veth11-ptf11 --interface 12@veth12-ptf12 --interface 13@veth13-ptf13 --interface 14@veth14-ptf14 --interface 15@veth15-ptf15 --interface 16@veth16-ptf16 --interface 17@veth17-ptf17 --interface 18@veth18-ptf18 --interface 19@veth19-ptf19 --interface 20@veth20-ptf20 --interface 21@veth21-ptf21 --interface 22@veth22-ptf22 --interface 23@veth23-ptf23 - vwire_test id_non_contiguous_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - -# Add bfd test -add_test( - NAME bfd_test - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 - bfd_test_for_etherfabric bfd_test_for_bfdd --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - -# Add bridge test -add_test( - NAME bridge_test - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 --interface 3@veth3-ptf3 - bridge_test_unicast bridge_test_broadcast bridge_test_master_device --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - - -# Add classifier test -add_test( - NAME classifier_test - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 --interface 3@veth3-ptf3 --interface 4@veth4-ptf4 --interface 5@veth5-ptf5 - classifier_test_base full_field_match_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - -# Add etherfabric test -add_test( - NAME etherfabric_test - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 - virtual_wire_mode tap_mode ef_route_ctx_test ef_adapter_id_non_contiguous_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - -# Add health_check test -add_test( - NAME health_check - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 - health_check_base_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - -# Add load_balance test -add_test( - NAME load_balance - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 --interface 3@veth3-ptf3 --interface 4@veth4-ptf4 - lb_base_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - -# Add msgpack test -add_test( - NAME msgpack_test - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 - msgpack_serialize_test msgpack_deserialize_test msgpack_serialize_and_deserialize_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - -# Add endpoint dev test -add_test( - NAME endpoint_dev_test - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 - icmp_reply_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) - -# Add tera test -add_test( - NAME tera_test - COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test - --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 - tera_base_test tera_mpack_test tera_nf_test tera_route_ctx_test tera_adapter_id_non_contiguous_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'" -) diff --git a/test/fuzzing/CMakeLists.txt b/test/fuzzing/CMakeLists.txt new file mode 100644 index 0000000..3f1b8c6 --- /dev/null +++ b/test/fuzzing/CMakeLists.txt @@ -0,0 +1,18 @@ +# Override top-level settings +set(CMAKE_CXX_FLAGS "-fsanitize=address,fuzzer ${COVERAGE_FLAGS}") +set(CMAKE_C_FLAGS "-fsanitize=address,fuzzer ${COVERAGE_FLAGS}") + +add_executable(FuzzingPktParser FuzzingPktParser.cc) + +# If you do not use CMAKE_CXX_FLAGS but use target_compile_options, it will result in the inability to link to clang's asan library. +# target_compile_options(FuzzingPktParser PRIVATE -fsanitize=address,fuzzer) + +target_link_libraries(FuzzingPktParser PRIVATE infra z elf ibverbs mlx5 ${SYSTEMD_LIBRARIES} ${PCAP_LIBRARY} ${DPDK_LIBRARY}) + +add_custom_command( + TARGET FuzzingPktParser + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/seeds ${CMAKE_CURRENT_BINARY_DIR}/seeds + COMMENT "Copying seeds to ${CMAKE_CURRENT_BINARY_DIR}" +) + diff --git a/test/fuzzing/FuzzingPktParser.cc b/test/fuzzing/FuzzingPktParser.cc new file mode 100644 index 0000000..5ed1074 --- /dev/null +++ b/test/fuzzing/FuzzingPktParser.cc @@ -0,0 +1,44 @@ +extern "C" +{ +#include <arpa/inet.h> +#include <ldbc.h> +#include <rte_ip.h> +#include <rte_mbuf.h> +#include <rte_tcp.h> +#include <rte_udp.h> +} + +#include <memory> +#include <stddef.h> +#include <stdint.h> + +std::unique_ptr<struct rte_mbuf> mock_rte_mbuf_create(const char * pkt, unsigned int pktlen) +{ + auto mock_mbuf = std::unique_ptr<struct rte_mbuf>(new struct rte_mbuf); + mock_mbuf->buf_addr = (void *)pkt; + mock_mbuf->buf_len = pktlen; + mock_mbuf->data_off = 0; + mock_mbuf->data_len = pktlen; + mock_mbuf->pkt_len = pktlen; + mock_mbuf->nb_segs = 1; + mock_mbuf->next = nullptr; + + return mock_mbuf; +} + +void pkt_parser_test(const uint8_t * data, size_t size, enum complex_layer_type_mask expect_layer_type, + unsigned int nr_expect_results) +{ + struct pkt_parser _pk_handler; + struct pkt_parser_result _pkt_result; + + auto mock_mbuf_ptr = mock_rte_mbuf_create((const char *)data, size); + pkt_parser_init(&_pk_handler, &_pkt_result, expect_layer_type, nr_expect_results); + pkt_parser_exec(&_pk_handler, mock_mbuf_ptr.get()); +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size) +{ + pkt_parser_test(data, size, LAYER_TYPE_ALL, 8); + return 0; +}
\ No newline at end of file diff --git a/test/fuzzing/seeds/10.23.160.163_to_129.226.103.217_gtp_u_in_vxlan b/test/fuzzing/seeds/10.23.160.163_to_129.226.103.217_gtp_u_in_vxlan Binary files differnew file mode 100644 index 0000000..54b6081 --- /dev/null +++ b/test/fuzzing/seeds/10.23.160.163_to_129.226.103.217_gtp_u_in_vxlan diff --git a/test/fuzzing/seeds/10.33.60.116_to_217.76.77.34_GTP_DNS b/test/fuzzing/seeds/10.33.60.116_to_217.76.77.34_GTP_DNS Binary files differnew file mode 100644 index 0000000..9fa74ff --- /dev/null +++ b/test/fuzzing/seeds/10.33.60.116_to_217.76.77.34_GTP_DNS diff --git a/test/fuzzing/seeds/100_95_37_122_to_149_3_200_32_gtpv1_u b/test/fuzzing/seeds/100_95_37_122_to_149_3_200_32_gtpv1_u Binary files differnew file mode 100644 index 0000000..47448dd --- /dev/null +++ b/test/fuzzing/seeds/100_95_37_122_to_149_3_200_32_gtpv1_u diff --git a/test/fuzzing/seeds/178.89.4.221_to_31.13.70.49_asym_mpls_ipv4 b/test/fuzzing/seeds/178.89.4.221_to_31.13.70.49_asym_mpls_ipv4 Binary files differnew file mode 100644 index 0000000..a57e978 --- /dev/null +++ b/test/fuzzing/seeds/178.89.4.221_to_31.13.70.49_asym_mpls_ipv4 diff --git a/test/fuzzing/seeds/178.89.4.221_to_31.13.70.49_mpls_ipv4 b/test/fuzzing/seeds/178.89.4.221_to_31.13.70.49_mpls_ipv4 Binary files differnew file mode 100644 index 0000000..4f8d2d6 --- /dev/null +++ b/test/fuzzing/seeds/178.89.4.221_to_31.13.70.49_mpls_ipv4 diff --git a/test/fuzzing/seeds/178_89_4_219_to_117_122_217_89_ipv4 b/test/fuzzing/seeds/178_89_4_219_to_117_122_217_89_ipv4 Binary files differnew file mode 100644 index 0000000..1e6e60a --- /dev/null +++ b/test/fuzzing/seeds/178_89_4_219_to_117_122_217_89_ipv4 diff --git a/test/fuzzing/seeds/178_89_4_219_to_117_122_217_89_mpls_vxlan_inner b/test/fuzzing/seeds/178_89_4_219_to_117_122_217_89_mpls_vxlan_inner Binary files differnew file mode 100644 index 0000000..fb32228 --- /dev/null +++ b/test/fuzzing/seeds/178_89_4_219_to_117_122_217_89_mpls_vxlan_inner diff --git a/test/fuzzing/seeds/81.211.157.203_to_10.160.72.52_mpls_ipv4_UDP b/test/fuzzing/seeds/81.211.157.203_to_10.160.72.52_mpls_ipv4_UDP Binary files differnew file mode 100644 index 0000000..c57c758 --- /dev/null +++ b/test/fuzzing/seeds/81.211.157.203_to_10.160.72.52_mpls_ipv4_UDP diff --git a/test/post_install_test/package_content_test.py b/test/post_install_test/package_content_test.py new file mode 100644 index 0000000..3e0623e --- /dev/null +++ b/test/post_install_test/package_content_test.py @@ -0,0 +1,168 @@ +import os +import subprocess +import sys +# import magic + +class tools: + def __init__(self): + pass + + def is_package_installed(self, package_name): + query_package_cmd = "rpm -qa | grep " + package_name + # capture_output requires Python version 3.7 or higher + # result = subprocess.run(query_package_cmd, shell=True, capture_output=True, text=True) + result = subprocess.run(query_package_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if result.returncode != 0: + print(f"query {package_name} fail. error: {result.stderr.decode('utf-8')}") + return False + print(result.stdout.decode('utf-8')) + return package_name in result.stdout.decode('utf-8') + + def check_path_exists(self, path): + # Existing path returns True. + # Returns False for broken symbolic links. + if os.path.exists(path): + if os.path.islink(path): + real_path = os.path.realpath(path) + if os.path.exists(real_path): + print(f"The final path for {path} is {real_path}") + else: + print(f"{real_path} not exists") + return False + else: + print(f"{path} exists") + return True + else: + print(f"{path} not exists") + return False + + # def is_elf_file(self, file_path): + # mime = magic.Magic() + # file_type = mime.from_file(file_path) + # print(f"{file_path} file type: {file_type}") + # return "ELF" in file_type + + def check_symbol_exists(self, binary_name): + check_symbol_cmd = "eu-unstrip -n -e " + binary_name + result = subprocess.run(check_symbol_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if result.returncode != 0: + print(f"error: {result.stderr.decode('utf-8')}") + return False + symbol_info = result.stdout.decode('utf-8').split() + if len(symbol_info) < 4: + return False + print(f"{binary_name} symbol path is: {symbol_info[3]}") + return self.check_path_exists(symbol_info[3]) + +class package_content_test: + def __init__(self): + self.install_path = "/opt/tsg/mrzcpd" + + self.package_conf_files = [ + "/etc/ld.so.conf.d/mrzcpd.conf", + "/etc/profile.d/mrzcpd.sh", + "/etc/sysconfig/mrzcpd" + ] + + self.package_etc_files = [ + self.install_path + "/etc", + self.install_path + "/etc/mrapm.conf", + self.install_path + "/etc/mrglobal.conf", + self.install_path + "/etc/mrtunnat.conf" + ] + + self.package_bin_files = [ + self.install_path + "/bin", + self.install_path + "/bin/devbind.py", + self.install_path + "/bin/dpdk-devbind.py", + self.install_path + "/bin/dpdk-hugepages.py", + self.install_path + "/bin/monit_device", + self.install_path + "/bin/monit_obp", + self.install_path + "/bin/monit_stream", + self.install_path + "/bin/mrmarch", + self.install_path + "/bin/mrpdump", + self.install_path + "/bin/mrtools-pinfo", + self.install_path + "/bin/mrzcpd" + ] + + self.package_include_files = [ + self.install_path + "/include", + self.install_path + "/include/libpag.h", + self.install_path + "/include/marsio.h", + self.install_path + "/include/mrtunnat.h", + ] + + self.package_lib_files = [ + self.install_path + "/lib", + self.install_path + "/lib/libmarsio.so", + self.install_path + "/lib/libpag.so", + self.install_path + "/lib/librte_common_mlx5_glue.so", + # self.install_path + "/lib/librte_net_mlx4_glue.so", + self.install_path + "/lib/pkgconfig/mrzcpd.pc", + ] + + self.package_altdir_files = [ + self.install_path + "/altdir/devbind.py", + self.install_path + "/altdir/dpdk-devbind.py", + self.install_path + "/altdir/dpdk-hugepages.py", + self.install_path + "/altdir/include", + self.install_path + "/altdir/lib", + self.install_path + "/altdir/monit_device", + self.install_path + "/altdir/monit_obp", + self.install_path + "/altdir/monit_stream", + self.install_path + "/altdir/mrapm_device.service", + self.install_path + "/altdir/mrapm_obp.service", + self.install_path + "/altdir/mrapm_stream.service", + self.install_path + "/altdir/mrmarch", + self.install_path + "/altdir/mrpdump", + self.install_path + "/altdir/mrtools-pinfo", + self.install_path + "/altdir/mrtunnat.service", + self.install_path + "/altdir/mrzcpd", + self.install_path + "/altdir/mrzcpd.service", + self.install_path + "/altdir/mrzcpd_hugepages_setup.service", + self.install_path + "/altdir/mrzcpd_hwdb_setup.service" + ] + + self.system_service_files = [ + "/usr/lib/systemd/system/mrapm_device.service", + "/usr/lib/systemd/system/mrapm_stream.service", + "/usr/lib/systemd/system/mrapm_obp.service", + "/usr/lib/systemd/system/mrtunnat.service", + "/usr/lib/systemd/system/mrzcpd_hugepages_setup.service", + "/usr/lib/systemd/system/mrzcpd_hwdb_setup.service", + "/usr/lib/systemd/system/mrzcpd.service" + ] + + self.package_files = (self.package_conf_files + self.package_etc_files + self.package_bin_files + + self.package_include_files + self.package_lib_files + self.package_altdir_files + + self.system_service_files) + + # monit_device no symbol + # self.binary_files = self.package_bin_files + self.package_lib_files + + self.symbol_check_files = [ + self.install_path + "/bin/mrzcpd", + self.install_path + "/lib/libmarsio.so", + ] + + self.tools = tools() + + def start(self): + if self.tools.is_package_installed("mrzcpd") == False: + return False + for file in self.package_files: + if self.tools.check_path_exists(file) == False: + return False + for file in self.symbol_check_files: + real_path = os.path.realpath(file) + # if self.tools.is_elf_file(real_path) == False: + # continue + if self.tools.check_symbol_exists(real_path) == False: + return False + return True + +if __name__ == "__main__": + test = package_content_test() + if test.start() == False: + sys.exit(1) + diff --git a/test/ptf_test/CMakeLists.txt b/test/ptf_test/CMakeLists.txt new file mode 100644 index 0000000..3a1890e --- /dev/null +++ b/test/ptf_test/CMakeLists.txt @@ -0,0 +1,119 @@ +include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_SOURCE_DIR}/include/extern) +include_directories(${CMAKE_SOURCE_DIR}/include/internal) +include_directories(${CMAKE_SOURCE_DIR}) + +# Create veth +execute_process( + COMMAND /bin/bash ${CMAKE_CURRENT_SOURCE_DIR}/create_veth.sh create 24 + RESULT_VARIABLE VETH_RESULT + OUTPUT_VARIABLE VETH_OUTPUT + ERROR_VARIABLE VETH_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +# Check veth create +if(VETH_RESULT) +message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/create_veth.sh create 24") + message(FATAL_ERROR "Failed to create veth: ${VETH_ERROR}") +endif() + +# Create veth for msgpack +execute_process( + COMMAND /bin/bash ${CMAKE_CURRENT_SOURCE_DIR}/create_veth.sh create msgpack + RESULT_VARIABLE VETH_RESULT + OUTPUT_VARIABLE VETH_OUTPUT + ERROR_VARIABLE VETH_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +# Check veth create for msgpack +if(VETH_RESULT) +message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/create_veth.sh create msgpack") + message(FATAL_ERROR "Failed to create veth: ${VETH_ERROR}") +endif() + +# Script for generating "--interface" +# for i in range(0, 24): +# print(f"--interface {i}@veth{i}-ptf{i}", end=" ") + +# Add vwire test +add_test( + NAME vwire_test + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 --interface 3@veth3-ptf3 --interface 4@veth4-ptf4 --interface 5@veth5-ptf5 --interface 6@veth6-ptf6 --interface 7@veth7-ptf7 --interface 8@veth8-ptf8 --interface 9@veth9-ptf9 --interface 10@veth10-ptf10 --interface 11@veth11-ptf11 --interface 12@veth12-ptf12 --interface 13@veth13-ptf13 --interface 14@veth14-ptf14 --interface 15@veth15-ptf15 --interface 16@veth16-ptf16 --interface 17@veth17-ptf17 --interface 18@veth18-ptf18 --interface 19@veth19-ptf19 --interface 20@veth20-ptf20 --interface 21@veth21-ptf21 --interface 22@veth22-ptf22 --interface 23@veth23-ptf23 + vwire_test id_non_contiguous_test --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + +# Add bfd test +add_test( + NAME bfd_test + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 + bfd_test_for_etherfabric bfd_test_for_bfdd --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + +# Add bridge test +add_test( + NAME bridge_test + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 --interface 3@veth3-ptf3 + bridge_test_unicast bridge_test_broadcast bridge_test_master_device --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + + +# Add classifier test +add_test( + NAME classifier_test + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 --interface 3@veth3-ptf3 --interface 4@veth4-ptf4 --interface 5@veth5-ptf5 + classifier_test_base full_field_match_test --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + +# Add etherfabric test +add_test( + NAME etherfabric_test + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 + virtual_wire_mode tap_mode ef_route_ctx_test ef_adapter_id_non_contiguous_test --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + +# Add health_check test +add_test( + NAME health_check + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 + health_check_base_test --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + +# Add load_balance test +add_test( + NAME load_balance + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 --interface 3@veth3-ptf3 --interface 4@veth4-ptf4 + lb_base_test --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + +# Add msgpack test +add_test( + NAME msgpack_test + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 --interface 2@veth2-ptf2 + msgpack_serialize_test msgpack_deserialize_test msgpack_serialize_and_deserialize_test --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + +# Add endpoint dev test +add_test( + NAME endpoint_dev_test + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 + icmp_reply_test --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) + +# Add tera test +add_test( + NAME tera_test + COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_CURRENT_SOURCE_DIR} + --interface 0@veth0-ptf0 --interface 1@veth1-ptf1 + tera_base_test tera_mpack_test tera_nf_test tera_route_ctx_test tera_adapter_id_non_contiguous_test --test-params "source_dir='${CMAKE_BINARY_DIR}'" +) diff --git a/test/bfd_test.py b/test/ptf_test/bfd_test.py index 06ec56f..06ec56f 100644 --- a/test/bfd_test.py +++ b/test/ptf_test/bfd_test.py diff --git a/test/bridge_test.py b/test/ptf_test/bridge_test.py index bf1dfff..bf1dfff 100644 --- a/test/bridge_test.py +++ b/test/ptf_test/bridge_test.py diff --git a/test/classifier_test.py b/test/ptf_test/classifier_test.py index 82e525c..82e525c 100644 --- a/test/classifier_test.py +++ b/test/ptf_test/classifier_test.py diff --git a/test/common_pkt.py b/test/ptf_test/common_pkt.py index a21758f..a21758f 100644 --- a/test/common_pkt.py +++ b/test/ptf_test/common_pkt.py diff --git a/test/create_veth.sh b/test/ptf_test/create_veth.sh index ed00dd6..ed00dd6 100644 --- a/test/create_veth.sh +++ b/test/ptf_test/create_veth.sh diff --git a/test/endpoint_dev_test.py b/test/ptf_test/endpoint_dev_test.py index fa46b44..fa46b44 100644 --- a/test/endpoint_dev_test.py +++ b/test/ptf_test/endpoint_dev_test.py diff --git a/test/etherfabric_test.py b/test/ptf_test/etherfabric_test.py index 61f2e17..61f2e17 100644 --- a/test/etherfabric_test.py +++ b/test/ptf_test/etherfabric_test.py diff --git a/test/health_check_test.py b/test/ptf_test/health_check_test.py index 71a48d9..71a48d9 100644 --- a/test/health_check_test.py +++ b/test/ptf_test/health_check_test.py diff --git a/test/load_balance_test.py b/test/ptf_test/load_balance_test.py index f762214..f762214 100644 --- a/test/load_balance_test.py +++ b/test/ptf_test/load_balance_test.py diff --git a/test/mrzcpd.py b/test/ptf_test/mrzcpd.py index 90c216e..b0fd8fa 100644 --- a/test/mrzcpd.py +++ b/test/ptf_test/mrzcpd.py @@ -9,17 +9,17 @@ mrzcpd_run_dir = "/var/run/mrzcpd" class Mrzcpd: - def __init__(self, conf_start,conf_dynamic): + def __init__(self, conf_start, conf_dynamic): self.mrzcpd_path = ptf.testutils.test_param_get( - "source_dir") + "/build/service/mrzcpd" + "source_dir") + "/service/mrzcpd" self.conf_start = str(conf_start) self.conf_path_start = ptf.testutils.test_param_get( - "source_dir") + "/test/mrglobal.conf" + "source_dir") + "/test/ptf_test/mrglobal.conf" self.conf_dynamic = str(conf_dynamic) self.conf_path_dynamic = ptf.testutils.test_param_get( - "source_dir") + "/test/mrglobal.dynamic.conf" + "source_dir") + "/test/ptf_test/mrglobal.dynamic.conf" self.file_start = open(self.conf_path_start, 'w') self.file_start.write(self.conf_start) diff --git a/test/msgpack_test.py b/test/ptf_test/msgpack_test.py index a92b6ff..a92b6ff 100644 --- a/test/msgpack_test.py +++ b/test/ptf_test/msgpack_test.py diff --git a/test/tera_test.py b/test/ptf_test/tera_test.py index 56b58f3..56b58f3 100644 --- a/test/tera_test.py +++ b/test/ptf_test/tera_test.py diff --git a/test/vwire_test.py b/test/ptf_test/vwire_test.py index 3d8e7b8..3d8e7b8 100644 --- a/test/vwire_test.py +++ b/test/ptf_test/vwire_test.py |
