Skip to content

Commit eeb905c

Browse files
committed
Try a little script before fixing failure.
Signed-off-by: fruffy <[email protected]>
1 parent 2475c42 commit eeb905c

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

.github/workflows/ci-test-ubuntu.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ jobs:
6464
export SDE=`pwd`
6565
export SDE_INSTALL="`pwd`/install"
6666
67-
sudo ${SDE_INSTALL}/bin/veth_setup.sh 128
68-
./run_tofino_model.sh -p tna_counter --arch tofino -q |& sed 's/^/model: /' &
69-
./run_switchd.sh -p tna_counter --arch tofino |& sed 's/^/switchd: /' &
70-
timeout 10800 ./run_p4_tests.sh -p tna_counter --arch tofino |& sed 's/^/tests: /'
67+
# Exit on error and ensure pipelines fail on any command failure
68+
./ci/run-test.sh tna_counter
7169

ci/run-test.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
THIS_DIR=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd )
4+
ROOT_DIR=$(readlink -f ${THIS_DIR}/..)
5+
6+
set -e # Exit on any command failure.
7+
set -o pipefail # Ensure failure in pipes propagates.
8+
9+
if [ $# -ne 1 ]; then
10+
echo "Usage: $0 <P4_PROGRAM>"
11+
exit 1
12+
fi
13+
14+
P4_PROGRAM="$1"
15+
16+
sudo "${SDE_INSTALL}/bin/veth_setup.sh" 128
17+
$ROOT_DIR/run_tofino_model.sh -p "$P4_PROGRAM" --arch tofino -q |& sed 's/^/model: /' &
18+
MODEL_PID=$!
19+
$ROOT_DIR/run_switchd.sh -p "$P4_PROGRAM" --arch tofino |& sed 's/^/switchd: /' &
20+
SWITCHD_PID=$!
21+
timeout 10800 $ROOT_DIR/run_p4_tests.sh -p "$P4_PROGRAM" --arch tofino |& sed 's/^/tests: /'
22+
TESTS_EXIT_CODE=$?
23+
24+
echo "Stopping tofino model and switchd..."
25+
kill $MODEL_PID $SWITCHD_PID || true
26+
wait $MODEL_PID 2>/dev/null || true
27+
wait $SWITCHD_PID 2>/dev/null || true
28+
exit $TESTS_EXIT_CODE

0 commit comments

Comments
 (0)