Skip to content

Commit

Permalink
Merged simplified procedure
Browse files Browse the repository at this point in the history
changed log_dir to default for collection

add_on_miss only

testgen on

Add logs

ci to main
  • Loading branch information
Hoooao authored and fruffy committed Oct 15, 2023
1 parent 7cc74e6 commit 7e34975
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 133 deletions.
111 changes: 0 additions & 111 deletions .github/workflows/PTF-TEST.yml

This file was deleted.

20 changes: 19 additions & 1 deletion .github/workflows/ci-dpdk-ptf-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,22 @@ jobs:
working-directory: p4c/build
run: |
sudo $IPDK_INSTALL_DIR/sbin/set_hugepages.sh
sudo -E ctest --output-on-failure --schedule-random -R dpdk-ptf*
sudo -E ctest --output-on-failure --schedule-random -R testgen-p4c-pna-ptf -V
- name: 'Get ERROR log'
continue-on-error: true
working-directory: /var/log/stratum
run: |
cat *ERROR
- name: 'Get INFO log'
continue-on-error: true
working-directory: /var/log/stratum
run: |
cat *INFO
- name: 'Get WARNING log'
continue-on-error: true
working-directory: /var/log/stratum
run: |
cat *WARNING
40 changes: 25 additions & 15 deletions backends/dpdk/run-dpdk-ptf-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
def is_port_alive(ns, port) -> bool:
command = f"sudo ip netns exec {ns} netstat -tuln"
out, _ = testutils.exec_process(command, timeout=10, capture_output=True)
if not out:
return False
if str(port) in out:
return True
return False
Expand Down Expand Up @@ -202,6 +204,7 @@ def run_infrap4d(
f"{self.options.ipdk_install_dir}/sbin/infrap4d "
f"-grpc_open_insecure_mode={insecure_mode} "
f"-log_dir={log_dir} "
f"-detach=false "
f"-dpdk_sde_install={options.ipdk_install_dir} "
f"-dpdk_infrap4d_cfg={options.ipdk_install_dir}/share/stratum/dpdk/dpdk_skip_p4.conf "
f"-chassis_config_file={options.ipdk_install_dir}/share/stratum/dpdk/dpdk_port_config.pb.txt "
Expand All @@ -214,6 +217,18 @@ def run_infrap4d(
cnt += 1
testutils.log.info("Cannot connect to Infrap4d: " + str(cnt) + " try")
if not is_port_alive(self.bridge.ns_name, GRPC_PORT):
# Print the log files.
error_file = log_dir.joinpath("infrap4d.ERROR")
if error_file.exists():
testutils.log.error("######## Infrap4d Error ######## \n%s", error_file.read_text())
info_file = log_dir.joinpath("infrap4d.INFO")
if info_file.exists():
testutils.log.error("######## Infrap4d Info ######## \n%s", info_file.read_text())
warning_file = log_dir.joinpath("infrap4d.WARNING")
if warning_file.exists():
testutils.log.error(
"######## Infrap4d Warning ######## \n%s", warning_file.read_text()
)
return testutils.FAILURE
return self.switch_proc

Expand All @@ -235,16 +250,16 @@ def build_and_load_pipeline(
# Load pipeline.
# NOTE: in generated PTF tests, the pipelines are loaded in individual test cases.
# This should be commented when working with Testgen.
command = (
f"{self.options.ipdk_install_dir}/bin/p4rt-ctl "
"set-pipe br0 "
f"{conf_bin} "
f"{info_name} "
)
returncode = self.bridge.ns_exec(command, timeout=30)
if returncode != testutils.SUCCESS:
testutils.log.error("Failed to load pipeline")
return returncode
# command = (
# f"{self.options.ipdk_install_dir}/bin/p4rt-ctl "
# "set-pipe br0 "
# f"{conf_bin} "
# f"{info_name} "
# )
# returncode = self.bridge.ns_exec(command, timeout=30)
# if returncode != testutils.SUCCESS:
# testutils.log.error("Failed to load pipeline")
# return returncode
return testutils.SUCCESS

def run_ptf(self, grpc_port: int, info_name, conf_bin) -> int:
Expand Down Expand Up @@ -276,11 +291,6 @@ def run_test(options: Options) -> int:
proc_env_vars["LD_LIBRARY_PATH"] += f"{options.ld_library_path}"
else:
proc_env_vars["LD_LIBRARY_PATH"] = f"{options.ld_library_path}"
if "PATH" in proc_env_vars:
proc_env_vars["PATH"] += f"{options.ipdk_install_dir}/bin"
else:
proc_env_vars["PATH"] = f"{options.ipdk_install_dir}/bin"
proc_env_vars["PATH"] += f"{options.ipdk_install_dir}/sbin"
proc_env_vars["SDE_INSTALL"] = f"{options.ipdk_install_dir}"

# Define the test environment and compile the P4 target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ set(P4C_PNA_TEST_SUITES_P416 ${PNA_TESTS} ${CUSTOM_PNA_TESTS})
option(P4TOOLS_TESTGEN_PNA_TEST_METADATA "Run tests on the Metadata test back end" OFF)

# check for infrap4d
find_program (INFRAP4D infrap4d
PATHS $ENV{IPDK_RECIPE} )
find_program(INFRAP4D infrap4d PATHS ${IPDK_INSTALL_DIR}/sbin)
# SDE_INSTALL is the path to the dpdk-target install directory
if(TRUE AND INFRAP4D AND DEFINED ENV{SDE_INSTALL})
if(INFRAP4D AND EXISTS ${IPDK_INSTALL_DIR})
set(DPDK_ENV_SETUP TRUE)
else()
set(DPDK_ENV_SETUP FALSE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ macro(check_pna_with_ptf testfile testfolder p4test)
file(APPEND ${testfile} "do\n")
file(APPEND ${testfile} "\techo \"Found \${item}\"\n")
file(APPEND ${testfile} "\t python3 ${__dpdk_runner} -tf \${item} ${P4C_SOURCE_DIR} \
--ipdk-recipe=$ENV{IPDK_RECIPE} \
--sde-install=$ENV{SDE_INSTALL} \
--ld-library-path=$ENV{LD_LIBRARY_PATH} \
--ipdk-install-dir=${IPDK_INSTALL_DIR} \
-ll=DEBUG ${p4test}\n")
file(APPEND ${testfile} "done\n")
endmacro(check_pna_with_ptf)
Expand Down

0 comments on commit 7e34975

Please sign in to comment.