Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ jobs:
- name: "Run Tests"
run: |
make test-integration
make test-memory-benchmark
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ test-integration: ## Run integration tests
@echo "# running integration tests"
VPP_REPO=$(VPP_REPO) ./test/run_integration.sh

.PHONY: test-memory-benchmark
test-memory-benchmark: ## Run memory benchmark tests
@echo "# running memory benchmark tests"
VPP_REPO=$(VPP_REPO) ./test/run_memory_benchmark.sh

.PHONY: lint ## Run code linter
lint:
@golangci-lint run
Expand Down
3 changes: 2 additions & 1 deletion test/memory/memory_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ func BenchmarkAPIMemory(b *testing.B) {
}
}
if !pass {
b.Fatal("one or more memory thresholds was exceeded")
b.Errorf("one or more memory thresholds was exceeded")
b.FailNow()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference?

func (*B) Fatalf

Fatalf is equivalent to Logf followed by FailNow.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say none, I was just trying to see if GA thinks the same
.
The thing is that the github workflow passes even if the test fails, for example

--- FAIL: BenchmarkAPIMemory
    memory_api_test.go:158: one or more memory thresholds was exceeded
    vpptest.go:225: VPP stopped
FAIL
exit status 1
FAIL	go.fd.io/govpp/test/memory	287.375s
FAILED! (exit code: 1)

In https://github.com/FDio/govpp/actions/runs/18878245769/job/53873795524
But the workflow is marked green.

}
}

Expand Down
43 changes: 43 additions & 0 deletions test/run_memory_benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# // Copyright (c) 2025 Cisco and/or its affiliates.
# //
# // Licensed under the Apache License, Version 2.0 (the "License");
# // you may not use this file except in compliance with the License.
# // You may obtain a copy of the License at:
# //
# // http://www.apache.org/licenses/LICENSE-2.0
# //
# // Unless required by applicable law or agreed to in writing, software
# // distributed under the License is distributed on an "AS IS" BASIS,
# // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# // See the License for the specific language governing permissions and
# // limitations under the License.

set -euo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )"
VPP_REPO=${VPP_REPO:-release}
IMGTAG="govpp-integration"

# Build Docker image
docker build -t "$IMGTAG" -f "$SCRIPT_DIR/build/Dockerfile.integration" --build-arg VPP_REPO="$VPP_REPO" "$SCRIPT_DIR/build"

# Get VPP version
VPP_VERSION=$(docker run --rm -i "$IMGTAG" dpkg-query -f '${Version}' -W vpp)

# Display test information
echo "=========================================================================="
echo " GOVPP MEMORY BENCHMARK TEST - $(date) "
echo "=========================================================================="
echo "- VPP_REPO: $VPP_REPO"
echo "- VPP version: $VPP_VERSION"
echo "--------------------------------------------------------------------------"

# Run benchmark tests
if docker run -i --privileged -v "$(cd "$SCRIPT_DIR/.." && pwd)":/src -w /src/test/memory "$IMGTAG" go test -bench=.; then
echo -e "\e[32mPASSED\e[0m (took: ${SECONDS}s)"
exit 0
else
echo -e "\e[31mFAILED!\e[0m (exit code: $?)"
exit $?
fi