Skip to content

Commit

Permalink
Add a PTF test CI pipeline for p4c-dpdk on the DPDK SoftNIC
Browse files Browse the repository at this point in the history
Ccache Added

Moved PTF tests into CMake; Shell scrips cleaned

Fix CMake

Fix CI

Add sudo to cmd

No Hugepage test

Rearrange compilation

Cleaned

Ccache Added

Moved PTF tests into CMake; Shell scrips cleaned

Fix CMake

Fix CI

Add sudo to cmd

No Hugepage test

Rearrange compilatin

Main branch update

Renamed test with ptf prefix

Test final

added outputs

IPDK recipe updated

Renamed test; ipdk_recipe repo changed

Deleted old test and outputs

Added test outputs

IPDK update

Test ld_lib

Cleaned code

CI to main

Changed comments

Minor fixes

Ccache Added

Moved PTF tests into CMake; Shell scrips cleaned

Fix CMake

Fix CI

Add sudo to cmd

No Hugepage test

Rearrange compilation

Cleaned

Moved PTF tests into CMake; Shell scrips cleaned

Fix CMake

Fix CI

Add sudo to cmd

No Hugepage test

Rearrange compilatin

Main branch update

Renamed test with ptf prefix

Test final

added outputs

IPDK recipe updated

Renamed test; ipdk_recipe repo changed

Deleted old test and outputs

Added test outputs

IPDK update

Test ld_lib

Cleaned code

Changed comments

Fix redundence

Minor mods

Rearrange p4c and recipe

Test protoc version

Deps updated

Fix

test

Changed Dep_install

Changed Dep_install to /usr/local

Wrap up
  • Loading branch information
Hoooao committed Aug 2, 2023
1 parent b6ad725 commit 33d2099
Show file tree
Hide file tree
Showing 14 changed files with 2,044 additions and 3 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/ci-dpdk-ptf-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: "p4c-dpdk-ptf-tests"

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
# if workflow for PR or push is already running stop it, and start new one
group: p4c_dpdk_ptf_ci-${{ github.ref }}
cancel-in-progress: true

# Envs for infrap4d and dpdk libs
# DEPEND_INSTALL is put to a default searching directory for
# visibility of different libs like libprotobuf
env:
SDE: ${{ github.workspace }}
P4C_DIR: ${{ github.workspace }}/p4c
SDE_INSTALL: ${{ github.workspace }}/sde_install
IPDK_RECIPE: ${{ github.workspace }}/ipdk.recipe
DEPEND_INSTALL: /usr/local

jobs:
build_p4dpdk_ubuntu:
runs-on: ubuntu-22.04
steps:
- name: 'ccache'
uses: hendrikmuhs/ccache-action@v1
with:
key: ptf-${{ runner.os }}-test
max-size: 1000M

- name: 'Checkout DPDK-target'
uses: actions/checkout@v3
with:
repository: p4lang/p4-dpdk-target
path: p4sde
submodules: 'recursive'

- name: 'Checkout ipdk-recipe'
uses: actions/checkout@v3
with:
repository: ipdk-io/networking-recipe
path: ipdk.recipe
submodules: 'recursive'

- name: checkout P4C
uses: actions/checkout@v3
with:
path: p4c
submodules: recursive

- name: 'Install DPDK dependencies'
working-directory: p4sde/tools/setup
run: |
sudo apt update -y
python install_dep.py
- name: 'Compile p4sde dpdk target'
working-directory: p4sde
run: |
mkdir ${GITHUB_WORKSPACE}/install
./autogen.sh
./configure --prefix=$SDE_INSTALL
make
make install
- name: 'Build infrap4d dependencies'
working-directory: ipdk.recipe
run: |
echo "Install infrap4d dependencies"
sudo apt install libatomic1 libnl-route-3-dev openssl
sudo pip3 install -r requirements.txt
cd $IPDK_RECIPE/setup
echo "Build infrap4d dependencies"
cmake -B build -DCMAKE_INSTALL_PREFIX="$DEPEND_INSTALL" -DUSE_SUDO=ON
cmake --build build
- name: 'Build infrap4d'
working-directory: ipdk.recipe
run: |
sudo ./make-all.sh --target=dpdk --no-krnlmon --no-ovs -S $SDE_INSTALL -D $DEPEND_INSTALL
- name: Build p4c with only the DPDK backend
working-directory: p4c
run: |
sudo -E tools/dpdk-ci-build.sh $P4C_DIR $IPDK_RECIPE $SDE_INSTALL $DEPEND_INSTALL
- name: 'Run DPDK PTF tests'
working-directory: p4c/build
run: |
sudo $IPDK_RECIPE/install/sbin/copy_config_files.sh $IPDK_RECIPE/install $SDE_INSTALL
sudo $IPDK_RECIPE/install/sbin/set_hugepages.sh
sudo -E ctest --output-on-failure --schedule-random -R dpdk-ptf*
30 changes: 27 additions & 3 deletions backends/dpdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ add_custom_target(linkp4cdpdk

add_dependencies(p4c_driver linkp4cdpdk)


# Tests
set(DPDK_PTF_DRIVER "${CMAKE_CURRENT_SOURCE_DIR}/run-dpdk-ptf-test.py")
set(DPDK_COMPILER_DRIVER "${CMAKE_CURRENT_SOURCE_DIR}/run-dpdk-test.py")

set (P4_16_SUITES
Expand All @@ -122,6 +125,27 @@ set (P4_16_SUITES
"${P4C_SOURCE_DIR}/testdata/p4_16_psa_errors/*.p4"
"${P4C_SOURCE_DIR}/testdata/p4_16_dpdk_errors/*.p4"
"${P4C_SOURCE_DIR}/testdata/p4_16_pna_errors/*.p4")
p4c_add_tests("dpdk" ${DPDK_COMPILER_DRIVER} "${P4_16_SUITES}" "" "--bfrt")

include(DpdkXfail.cmake)
p4c_add_tests("dpdk" ${DPDK_COMPILER_DRIVER} "${P4_16_SUITES}" "" "--bfrt")


# PTF tests for DPDK is only enabled if infrap4d and dpdk-target are installed.
# Add PTF tests for these files.
set (DPDK_PTF_TEST_SUITES
"${P4C_SOURCE_DIR}/testdata/p4_16_samples/pna-dpdk-add_on_miss0.p4"
)

# check for infrap4d
find_program (INFRAP4D infrap4d
PATHS $ENV{IPDK_RECIPE} )
# SDE_INSTALL is the path to the dpdk-target install directory
if (INFRAP4D AND DEFINED ENV{SDE_INSTALL})
p4c_add_tests("dpdk-ptf" ${DPDK_PTF_DRIVER} "${DPDK_PTF_TEST_SUITES}" "" "--ipdk-recipe=$ENV{IPDK_RECIPE} \
--sde-install=$ENV{SDE_INSTALL} \
--ld-library-path=$ENV{LD_LIBRARY_PATH} \
-ll=DEBUG ")
else()
MESSAGE(WARNING "Infrap4d or dpdk-target is not available(Or required Env Vars Not Defined), not adding DPDK PTF tests")
endif()


include(DpdkXfail.cmake)
Loading

0 comments on commit 33d2099

Please sign in to comment.