-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun-test.sh
executable file
·38 lines (33 loc) · 1.03 KB
/
run-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# SPDX-FileCopyrightText: Copyright 2020-present Open Networking Foundation.
# SPDX-License-Identifier: Apache-2.0
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
IMAGE="stratumproject/testvectors:ptf"
TEST_ARGS=()
mkdir -p "${DIR}/tmp"
while (( "$#" )); do
case "$1" in
# Override the --trex-config parameter since we need to copy the actual config file
# to the container.
--trex-config)
# Copy the Trex config to tmp directory and use it
cp -f "$2" "${DIR}/tmp/"
TEST_ARGS+=("$1" "/tmp/$(basename "$2")")
shift 2
;;
*)
TEST_ARGS+=("$1")
shift 1
;;
esac
done
docker run --rm -it \
-v "${DIR}/trex-scripts:/workspace/trex-scripts" \
-v "${DIR}/tools:/workspace/tools" \
-v "${DIR}/tmp:/tmp" \
-w /workspace/trex-scripts \
--mount "type=bind,source=$PWD/entrypoint.sh,target=/entrypoint.sh" \
--entrypoint /entrypoint.sh \
"${IMAGE}" \
"${TEST_ARGS[@]}"