summaryrefslogtreecommitdiffstats
path: root/tests/topotests
diff options
context:
space:
mode:
authorfamfo <famfo@famfo.xyz>2024-11-26 19:42:03 +0100
committerfamfo <famfo@famfo.xyz>2024-11-28 14:59:29 +0100
commitd87ec38dfdfdf8f4ac4c3f6843b58b1170137630 (patch)
tree93fd11930e1f4a1b8adb198860b7b32be12b888a /tests/topotests
parentMerge pull request #17483 from chiragshah6/evpn_dev4 (diff)
downloadfrr-d87ec38dfdfdf8f4ac4c3f6843b58b1170137630.tar.xz
frr-d87ec38dfdfdf8f4ac4c3f6843b58b1170137630.zip
topotests: Allow runing under both docker and podman
Signed-off-by: famfo <famfo@famfo.xyz>
Diffstat (limited to 'tests/topotests')
-rwxr-xr-xtests/topotests/docker/build.sh4
-rwxr-xr-xtests/topotests/docker/frr-topotests.sh10
2 files changed, 8 insertions, 6 deletions
diff --git a/tests/topotests/docker/build.sh b/tests/topotests/docker/build.sh
index aec20587b..20d08e497 100755
--- a/tests/topotests/docker/build.sh
+++ b/tests/topotests/docker/build.sh
@@ -1,11 +1,11 @@
-#!/bin/bash
+#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
#
# Copyright 2018 Network Device Education Foundation, Inc. ("NetDEF")
cd "$(dirname "$0")"/..
-exec docker build --pull \
+exec $(command -v docker || command -v podman) build --pull \
--compress \
-t frrouting/topotests:latest \
.
diff --git a/tests/topotests/docker/frr-topotests.sh b/tests/topotests/docker/frr-topotests.sh
index bd3705514..8de8e7b1f 100755
--- a/tests/topotests/docker/frr-topotests.sh
+++ b/tests/topotests/docker/frr-topotests.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
#
# Copyright 2018 Network Device Education Foundation, Inc. ("NetDEF")
@@ -113,10 +113,12 @@ if [ -z "$TOPOTEST_FRR" ]; then
git -C "$TOPOTEST_FRR" ls-files -z > "${TOPOTEST_LOGS}/git-ls-files"
fi
+cmd="$(command -v docker || command -v podman)"
+
if [ -z "$TOPOTEST_BUILDCACHE" ]; then
TOPOTEST_BUILDCACHE=topotest-buildcache
- docker volume inspect "${TOPOTEST_BUILDCACHE}" &> /dev/null \
- || docker volume create "${TOPOTEST_BUILDCACHE}"
+ "${cmd}" volume inspect "${TOPOTEST_BUILDCACHE}" &> /dev/null \
+ || "${cmd}" volume create "${TOPOTEST_BUILDCACHE}"
fi
if [[ -n "$TMUX" ]]; then
@@ -145,4 +147,4 @@ if [ -t 0 ]; then
set -- -t "$@"
fi
-exec docker run "$@"
+exec "${cmd}" run "$@"