Skip to content

Commit b02473d

Browse files
committed
Temporary check change
Signed-off-by: Milosz Linkiewicz <[email protected]>
1 parent a24dad6 commit b02473d

File tree

4 files changed

+59
-66
lines changed

4 files changed

+59
-66
lines changed

.github/scripts/run_validation_tests.sh

Lines changed: 42 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,109 +2,95 @@
22

33
set +e
44

5-
VALIDATION_TESTS_1="${1:-$VALIDATION_TESTS_1}"
6-
VALIDATION_TESTS_2="${2:-$VALIDATION_TESTS_2}"
7-
PYTEST_ALIAS="${3:-$PYTEST_ALIAS}"
8-
PYTEST_PARAMS="${4:-$PYTEST_PARAMS}"
9-
export TEST_PORT_P="${5:-$TEST_PORT_P}"
10-
export TEST_PORT_R="${6:-$TEST_PORT_R}"
11-
PYTEST_RETRIES="${PYTEST_RETRIES:-3}"
12-
135
# Function to log messages to GitHub Actions
14-
function LOG_GITHUB_SUMMARY() {
15-
echo "$@" >> "$GITHUB_STEP_SUMMARY"
16-
}
17-
18-
function LOG_GITHUB_CONSOLE() {
19-
echo "$@"
6+
log_to_github() {
7+
echo "$1" >> "$GITHUB_STEP_SUMMARY"
208
}
219

2210
# Function to run a test and handle retries
2311
run_test() {
2412
local test=$1
2513
local retries=$2
26-
local pytest_alias=$3
27-
local pytest_params=$4
28-
local test_port_p=$5
29-
local test_port_r=$6
30-
local PYTEST_START_TIME=""
31-
local PYTEST_END_TIME=""
32-
local PYTEST_DURATION=""
33-
local PYTEST_TASK_STATUS=""
34-
local PYTEST_SUFFIX="[Err]"
35-
36-
LOG_GITHUB_CONSOLE "::group::${test}"
37-
PYTEST_START_TIME=$(date '+%s')
38-
# shellcheck disable=SC2086
39-
${pytest_alias} "${test}" ${pytest_params} --nic="${test_port_p},${test_port_r}" --collect-only -q --no-summary
14+
local test_port_p=$3
15+
local test_port_r=$4
16+
17+
echo "::group::${test}"
18+
local start_time=$(date '+%s')
19+
sudo --preserve-env python3 -m pipenv run pytest "${test}" --media=/mnt/media --build="../.." --nic="${test_port_p},${test_port_r}" --collect-only -q --no-summary
4020

4121
for retry in $(seq 1 "$retries"); do
42-
# shellcheck disable=SC2086
43-
${pytest_alias} "${test}" ${pytest_params} --nic="${test_port_p},${test_port_r}"
22+
echo "sudo --preserve-env python3 -m pipenv run pytest \"${test}\" --media=/mnt/media --build="../.." --nic=\"${test_port_p},${test_port_r}\""
23+
sudo --preserve-env python3 -m pipenv run pytest "${test}" --media=/mnt/media --build="../.." --nic="${test_port_p},${test_port_r}"
4424
local result=$?
45-
LOG_GITHUB_CONSOLE "RETRY: ${retry}"
25+
echo "RETRY: ${retry}"
4626
[[ "$result" == "0" ]] && break
4727
done
4828

49-
PYTEST_END_TIME="$(date '+%s')"
50-
PYTEST_DURATION="$((PYTEST_END_TIME - PYTEST_START_TIME))"
29+
local end_time=$(date '+%s')
30+
local duration=$((end_time - start_time))
31+
local status=""
32+
local suffix="[Err]"
5133

5234
if [[ "$result" == "0" ]]; then
53-
PYTEST_TASK_STATUS=""
54-
PYTEST_SUFFIX="[OK]"
35+
status=""
36+
suffix="[OK]"
5537
TESTS_SUCCESS+=("${test}")
5638
else
5739
TESTS_FAIL+=("${test}")
5840
fi
5941

60-
LOG_GITHUB_SUMMARY "| ${PYTEST_TASK_STATUS} | ${test} | $(date --date=@${PYTEST_START_TIME} '+%d%m%y_%H%M%S') | $(date --date="@${PYTEST_END_TIME}" '+%d%m%y_%H%M%S') | ${PYTEST_DURATION}s | ${PYTEST_SUFFIX} |"
61-
LOG_GITHUB_CONSOLE "::endgroup::"
42+
log_to_github "| ${status} | ${test} | $(date --date=@${start_time} '+%d%m%y_%H%M%S') | $(date --date=@${end_time} '+%d%m%y_%H%M%S') | ${duration}s | ${suffix} |"
43+
echo "::endgroup::"
6244
}
6345

6446
# Main script execution
65-
LOG_GITHUB_CONSOLE "::group::pre-execution-summary"
47+
echo "::group::pre-execution-summary"
48+
49+
# Export environment variables
50+
export TEST_PORT_P="${TEST_PORT_P}"
51+
export TEST_PORT_R="${TEST_PORT_R}"
6652

6753
# Collect tests to be executed
6854
TESTS_INCLUDED_IN_EXECUTION=(
69-
$(grep -v "collected in" <(${PYTEST_ALIAS} "tests/${VALIDATION_TESTS_1}" --collect-only -q --no-summary 2>&1))
55+
$(grep -v "collected in" <(sudo --preserve-env python3 -m pipenv run pytest "tests/${VALIDATION_TESTS_1}" --media=/mnt/media --build="../.." --nic="${TEST_PORT_P},${TEST_PORT_R}" --collect-only -q --no-summary 2>&1))
7056
)
7157
SUMMARY_MAIN_HEADER="Starting tests/${VALIDATION_TESTS_1}"
7258

7359
if [[ -n "${VALIDATION_TESTS_2}" ]]; then
7460
TESTS_INCLUDED_IN_EXECUTION+=(
75-
$(grep -v "collected in" <(${PYTEST_ALIAS} "tests/${VALIDATION_TESTS_2}" --collect-only -q --no-summary 2>&1))
61+
$(grep -v "collected in" <(sudo --preserve-env python3 -m pipenv run pytest "tests/${VALIDATION_TESTS_2}" --media=/mnt/media --build="../.." --nic="${TEST_PORT_P},${TEST_PORT_R}" --collect-only -q --no-summary 2>&1))
7662
)
7763
SUMMARY_MAIN_HEADER="${SUMMARY_MAIN_HEADER}, tests/${VALIDATION_TESTS_2}"
7864
fi
7965

66+
NUMBER_OF_TESTS="${#TESTS_INCLUDED_IN_EXECUTION[@]}"
8067
TESTS_FAIL=()
8168
TESTS_SUCCESS=()
8269

83-
LOG_GITHUB_CONSOLE "${SUMMARY_MAIN_HEADER} tests (total ${NUMBER_OF_TESTS}) :rocket:"
84-
LOG_GITHUB_CONSOLE "----------------------------------"
85-
LOG_GITHUB_CONSOLE "Tests to be executed:"
86-
LOG_GITHUB_CONSOLE "${TESTS_INCLUDED_IN_EXECUTION[@]}"
87-
88-
LOG_GITHUB_SUMMARY "## ${SUMMARY_MAIN_HEADER} tests (total ${NUMBER_OF_TESTS}) :rocket:"
89-
LOG_GITHUB_SUMMARY "| ❌/✅ | Collected Test | Started | Ended | Took (s) | Result |"
90-
LOG_GITHUB_SUMMARY "| --- | --- | --- | --- | --- | --- |"
70+
echo "${SUMMARY_MAIN_HEADER} tests (total ${NUMBER_OF_TESTS}) :rocket:"
71+
echo "----------------------------------"
72+
echo "Tests to be executed:"
73+
echo "${TESTS_INCLUDED_IN_EXECUTION[@]}"
9174

92-
LOG_GITHUB_CONSOLE "::endgroup::"
75+
log_to_github "## ${SUMMARY_MAIN_HEADER} tests (total ${NUMBER_OF_TESTS}) :rocket:"
76+
log_to_github "| ❌/✅ | Collected Test | Started | Ended | Took (s) | Result |"
77+
log_to_github "| --- | --- | --- | --- | --- | --- |"
78+
echo "::endgroup::"
9379

9480
# Execute each test
9581
for test in "${TESTS_INCLUDED_IN_EXECUTION[@]}"; do
96-
run_test "$test" "${PYTEST_RETRIES}" "${PYTEST_ALIAS}" "${PYTEST_PARAMS}" "${TEST_PORT_P}" "${TEST_PORT_R}"
82+
run_test "$test" "$PYTEST_RETRIES" "$TEST_PORT_P" "$TEST_PORT_R"
9783
done
9884

9985
# Summary of test results
100-
LOG_GITHUB_SUMMARY "### Total success ${#TESTS_SUCCESS[@]}/${NUMBER_OF_TESTS}:"
101-
LOG_GITHUB_SUMMARY "${TESTS_SUCCESS[@]}"
102-
LOG_GITHUB_SUMMARY "### Total failed ${#TESTS_FAIL[@]}/${NUMBER_OF_TESTS}:"
103-
LOG_GITHUB_SUMMARY "${TESTS_FAIL[@]}"
86+
log_to_github "### Total success ${#TESTS_SUCCESS[@]}/${NUMBER_OF_TESTS}:"
87+
log_to_github "${TESTS_SUCCESS[@]}"
88+
log_to_github "### Total failed ${#TESTS_FAIL[@]}/${NUMBER_OF_TESTS}:"
89+
log_to_github "${TESTS_FAIL[@]}"
10490

10591
# Determine exit status
10692
if [[ "${#TESTS_FAIL[@]}" == "0" ]] || [[ "${VALIDATION_NO_FAIL_TESTS}" == "true" ]]; then
10793
exit 0
94+
else
95+
exit 1
10896
fi
109-
110-
exit 1

.github/workflows/gtest-bare-metal.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ env:
2727
# Customize the env if
2828
BUILD_TYPE: 'Release'
2929
DPDK_VERSION: '23.11'
30+
DPDK_REBUILD: 'false'
3031
# Bellow ENV variables are required to be defined on runner side:
3132
# TEST_PF_PORT_P: '0000:49:00.0'
3233
# TEST_PF_PORT_R: '0000:49:00.1'
@@ -71,6 +72,7 @@ jobs:
7172
ref: '${{ inputs.branch-to-checkout || github.head_ref || github.ref }}'
7273

7374
- name: Checkout DPDK
75+
if: env.DPDK_REBUILD == 'true'
7476
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7577
with:
7678
repository: 'DPDK/dpdk'
@@ -83,10 +85,12 @@ jobs:
8385
sudo apt-get install -y systemtap-sdt-dev
8486
8587
- name: Apply dpdk patches
88+
if: env.DPDK_REBUILD == 'true'
8689
run: |
8790
patch -d "dpdk" -p1 -i <(cat patches/dpdk/${{ env.DPDK_VERSION }}/*.patch)
8891
8992
- name: Build dpdk
93+
if: env.DPDK_REBUILD == 'true'
9094
run: |
9195
cd dpdk
9296
meson build
@@ -119,8 +123,8 @@ jobs:
119123
- name: Binding network adapter
120124
run: |
121125
sudo ./script/nicctl.sh create_vf "${TEST_PF_PORT_P}" || true
122-
sudo ./dpdk/usertools/dpdk-devbind.py -b vfio-pci "${TEST_DMA_PORT_P}" || true
123-
sudo ./dpdk/usertools/dpdk-devbind.py -b vfio-pci "${TEST_DMA_PORT_R}" || true
126+
sudo dpdk-devbind.py -b vfio-pci "${TEST_DMA_PORT_P}" || true
127+
sudo dpdk-devbind.py -b vfio-pci "${TEST_DMA_PORT_R}" || true
124128
125129
- name: Start MtlManager at background
126130
run: |

.github/workflows/validation-tests.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ on:
111111
env:
112112
BUILD_TYPE: 'Release'
113113
DPDK_VERSION: '23.11'
114+
DPDK_REBUILD: 'false'
114115

115116
permissions:
116117
contents: read
@@ -130,8 +131,8 @@ jobs:
130131
- name: 'preparation: Restore valid repository owner and print env'
131132
if: always()
132133
run: |
133-
sudo chown -R "${USER}" "$(pwd)"
134-
env | grep TEST_
134+
sudo chown -R "${USER}" "$(pwd)" || true
135+
env | grep TEST_ || true
135136
136137
- name: 'preparation: Checkout MTL'
137138
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -140,6 +141,7 @@ jobs:
140141

141142
- name: 'preparation: Checkout DPDK'
142143
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
144+
if: env.DPDK_REBUILD == 'true'
143145
with:
144146
repository: 'DPDK/dpdk'
145147
ref: 'v${{ env.DPDK_VERSION }}'
@@ -163,14 +165,18 @@ jobs:
163165
libsdl2-dev \
164166
libsdl2-ttf-dev \
165167
libssl-dev \
166-
systemtap-sdt-dev
168+
systemtap-sdt-dev \
169+
libbpf-dev \
170+
libelf1
167171
168172
- name: 'configuration: Apply dpdk patches'
173+
if: env.DPDK_REBUILD == 'true'
169174
run: |
170175
patch -d "dpdk" -p1 -i <(cat patches/dpdk/${{ env.DPDK_VERSION }}/*.patch)
171176
172177
- name: 'installation: Build dpdk'
173178
working-directory: dpdk
179+
if: env.DPDK_REBUILD == 'true'
174180
run: |
175181
meson build
176182
ninja -C build
@@ -231,7 +237,6 @@ jobs:
231237
sudo rmmod irdma || true
232238
sudo ./script/nicctl.sh ${{ inputs.validation-iface-binding }} "${TEST_PF_PORT_P}" || true
233239
sudo ./script/nicctl.sh ${{ inputs.validation-iface-binding }} "${TEST_PF_PORT_R}" || true
234-
sudo modprobe irdma || true
235240
236241
- name: 'preparation: Start MtlManager at background'
237242
run: |
@@ -240,12 +245,10 @@ jobs:
240245
- name: 'execution: Run validation-bare-metal tests in pipenv environment'
241246
working-directory: tests/validation
242247
run: |
243-
"${{ github.workspace }}/.github/scripts/run_validation_tests.sh"
248+
. "${{ github.workspace }}/.github/scripts/run_validation_tests.sh"
244249
env:
245250
TEST_PORT_P: ${{ env.TEST_PORT_P }}
246251
TEST_PORT_R: ${{ env.TEST_PORT_R }}
247-
PYTEST_ALIAS: 'sudo --preserve-env python3 -m pipenv run pytest'
248-
PYTEST_PARAMS: '--media=/mnt/media --build="../.."'
249252
PYTEST_RETRIES: '3'
250253
VALIDATION_TESTS_1: ${{ inputs.validation-tests-1 }}
251254
VALIDATION_TESTS_2: ${{ inputs.validation-tests-2 }}
@@ -294,7 +297,6 @@ jobs:
294297
sudo rmmod irdma || true
295298
sudo ./script/nicctl.sh bind_kernel "${TEST_PF_PORT_P}" || true
296299
sudo ./script/nicctl.sh bind_kernel "${TEST_PF_PORT_R}" || true
297-
sudo modprobe irdma || true
298300
299301
- name: 'cleanup: Validation execution logs'
300302
if: always()

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,4 @@ doc/_build
8989
gpu_direct/tests/fff.h
9090
gpu_direct/subprojects/*
9191
!gpu_direct/subprojects/gtest.wrap
92+
_temp*

0 commit comments

Comments
 (0)