summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2018-10-17 19:56:26 +0200
committerChristian Franke <chris@opensourcerouting.org>2018-11-29 16:51:27 +0100
commit04c63c05b5ab1b81e10f9a3cf94742558913f95a (patch)
treea3f2c487af42278917e6a7ec957248c7bbe766b9 /tests
parentdocker: Run container with its own network namespace (diff)
downloadfrr-04c63c05b5ab1b81e10f9a3cf94742558913f95a.tar.xz
frr-04c63c05b5ab1b81e10f9a3cf94742558913f95a.zip
docker: reindent shell scripts
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/topotests/docker/compile_frr.sh72
-rwxr-xr-xtests/topotests/docker/docker.sh16
-rwxr-xr-xtests/topotests/docker/entrypoint.sh20
-rwxr-xr-xtests/topotests/docker/funcs.sh32
4 files changed, 70 insertions, 70 deletions
diff --git a/tests/topotests/docker/compile_frr.sh b/tests/topotests/docker/compile_frr.sh
index 44b87405e..d9d27b670 100755
--- a/tests/topotests/docker/compile_frr.sh
+++ b/tests/topotests/docker/compile_frr.sh
@@ -30,70 +30,70 @@ CDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Script begin
#
if [ ! -f .sync_source -o $SYNC_SOURCE -ne 0 ]; then
- log_info "Syncing FRR source with host..."
- mkdir -p $FRR_BUILD_DIR >/dev/null 2>&1
- rsync -a --info=progress2 --chown root:root $FRR_DIR/. $FRR_BUILD_DIR/
- touch .sync_source
+ log_info "Syncing FRR source with host..."
+ mkdir -p $FRR_BUILD_DIR >/dev/null 2>&1
+ rsync -a --info=progress2 --chown root:root $FRR_DIR/. $FRR_BUILD_DIR/
+ touch .sync_source
fi
log_info "Building FRR..."
cd $FRR_BUILD_DIR || \
- log_fatal "failed to find frr directory"
+ log_fatal "failed to find frr directory"
if [ $CLEAN -ne 0 ]; then
- make distclean >/dev/null 2>&1
- rm -f Makefile configure
+ make distclean >/dev/null 2>&1
+ rm -f Makefile configure
fi
if [ ! -f configure ]; then
- bash bootstrap.sh || \
- log_fatal "failed to bootstrap configuration"
+ bash bootstrap.sh || \
+ log_fatal "failed to bootstrap configuration"
fi
if [ $DOC -ne 0 ]; then
- EXTRA_CONFIGURE+=" --enable-doc "
+ EXTRA_CONFIGURE+=" --enable-doc "
else
- EXTRA_CONFIGURE+=" --disable-doc "
+ EXTRA_CONFIGURE+=" --disable-doc "
fi
if [ ! -f Makefile ]; then
- if [ $SANITIZER -ne 0 ]; then
- export CC="gcc"
- export CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer"
- export LD="gcc"
- export LDFLAGS="-g -fsanitize=address -ldl"
- EXTRA_CONFIGURE+=" --enable-shared=no "
- touch .address_sanitizer
- else
- rm -f .address_sanitizer
- fi
+ if [ $SANITIZER -ne 0 ]; then
+ export CC="gcc"
+ export CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer"
+ export LD="gcc"
+ export LDFLAGS="-g -fsanitize=address -ldl"
+ EXTRA_CONFIGURE+=" --enable-shared=no "
+ touch .address_sanitizer
+ else
+ rm -f .address_sanitizer
+ fi
- bash configure >/dev/null \
- --enable-multipath=64 \
- --prefix=/usr \
- --localstatedir=/var/run/frr \
- --sbindir=/usr/lib/frr \
- --sysconfdir=/etc/frr \
- $EXTRA_CONFIGURE \
- --with-pkg-extra-version=-topotests \
- || log_fatal "failed to configure the sources"
+ bash configure >/dev/null \
+ --enable-multipath=64 \
+ --prefix=/usr \
+ --localstatedir=/var/run/frr \
+ --sbindir=/usr/lib/frr \
+ --sysconfdir=/etc/frr \
+ $EXTRA_CONFIGURE \
+ --with-pkg-extra-version=-topotests \
+ || log_fatal "failed to configure the sources"
fi
# if '.address_sanitizer' file exists it means we are using address sanitizer.
if [ -f .address_sanitizer ]; then
- make -C lib CFLAGS="-g -O2" LDFLAGS="-g" clippy
+ make -C lib CFLAGS="-g -O2" LDFLAGS="-g" clippy
fi
if [ $VERBOSE -ne 0 ]; then
- make -j$(cpu_count) || \
- log_fatal "failed to build the sources"
+ make -j$(cpu_count) || \
+ log_fatal "failed to build the sources"
else
- make -j$(cpu_count) >/dev/null || \
- log_fatal "failed to build the sources"
+ make -j$(cpu_count) >/dev/null || \
+ log_fatal "failed to build the sources"
fi
make install >/dev/null || \
- log_fatal "failed to install frr"
+ log_fatal "failed to install frr"
exit 0
diff --git a/tests/topotests/docker/docker.sh b/tests/topotests/docker/docker.sh
index c312e5820..ac40e6c5a 100755
--- a/tests/topotests/docker/docker.sh
+++ b/tests/topotests/docker/docker.sh
@@ -31,19 +31,19 @@ CDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
#
OLD_IMAGE_SHA=$( \
- docker images | \
- egrep "^topotests" | \
- sed -r "s/( )+/ /g" | \
- cut -d " " -f 3 \
+ docker images | \
+ egrep "^topotests" | \
+ sed -r "s/( )+/ /g" | \
+ cut -d " " -f 3 \
)
docker build --force-rm --pull --compress -t topotests . || \
- log_fatal "failed to generate topotest docker image"
+ log_fatal "failed to generate topotest docker image"
if [ ! -z "$OLD_IMAGE_SHA" ]; then
- log_info "Removing old topotest image"
- docker rmi $OLD_IMAGE_SHA || \
- log_warning "failed to remove old image"
+ log_info "Removing old topotest image"
+ docker rmi $OLD_IMAGE_SHA || \
+ log_warning "failed to remove old image"
fi
exit 0
diff --git a/tests/topotests/docker/entrypoint.sh b/tests/topotests/docker/entrypoint.sh
index f62fa41b8..d9defb424 100755
--- a/tests/topotests/docker/entrypoint.sh
+++ b/tests/topotests/docker/entrypoint.sh
@@ -34,11 +34,11 @@ log_info "Configuring OpenvSwitch...."
# Configure OpenvSwitch so we are able to run mininet
mkdir -p /var/run/openvswitch
ovsdb-tool create /etc/openvswitch/conf.db \
- /usr/share/openvswitch/vswitch.ovsschema
+ /usr/share/openvswitch/vswitch.ovsschema
ovsdb-server /etc/openvswitch/conf.db \
- --remote=punix:/var/run/openvswitch/db.sock \
- --remote=ptcp:6640 --pidfile=ovsdb-server.pid >/dev/null 2>/dev/null & \
- disown
+ --remote=punix:/var/run/openvswitch/db.sock \
+ --remote=ptcp:6640 --pidfile=ovsdb-server.pid >/dev/null 2>/dev/null & \
+ disown
ovs-vswitchd >/dev/null 2>/dev/null & disown
sleep 2
@@ -46,22 +46,22 @@ sleep 2
ovs-vsctl --no-wait -- init
ovs_version=$(ovs-vsctl -V | grep ovs-vsctl | awk '{print $4}')
ovs_db_version=$(\
- ovsdb-tool schema-version /usr/share/openvswitch/vswitch.ovsschema)
+ ovsdb-tool schema-version /usr/share/openvswitch/vswitch.ovsschema)
ovs-vsctl --no-wait -- set Open_vSwitch . db-version="${ovs_db_version}"
ovs-vsctl --no-wait -- set Open_vSwitch . ovs-version="${ovs_version}"
ovs-vsctl --no-wait -- set Open_vSwitch . system-type="docker-ovs"
ovs-vsctl --no-wait -- set Open_vSwitch . system-version="0.1"
ovs-vsctl --no-wait -- \
- set Open_vSwitch . external-ids:system-id=`cat /proc/sys/kernel/random/uuid`
+ set Open_vSwitch . external-ids:system-id=`cat /proc/sys/kernel/random/uuid`
ovs-vsctl --no-wait -- set-manager ptcp:6640
ovs-appctl -t ovsdb-server \
- ovsdb-server/add-remote db:Open_vSwitch,Open_vSwitch,manager_options
+ ovsdb-server/add-remote db:Open_vSwitch,Open_vSwitch,manager_options
# Build FRR
env \
- CLEAN=1 \
- VERBOSE=0 \
- bash /opt/topotests/compile_frr.sh
+ CLEAN=1 \
+ VERBOSE=0 \
+ bash /opt/topotests/compile_frr.sh
log_info "Setting permissions on /tmp so we can generate logs"
chmod -v 1777 /tmp
diff --git a/tests/topotests/docker/funcs.sh b/tests/topotests/docker/funcs.sh
index 8c46c8dcb..78640d324 100755
--- a/tests/topotests/docker/funcs.sh
+++ b/tests/topotests/docker/funcs.sh
@@ -33,38 +33,38 @@ TOPOTESTS_DIR=/root/topotests
[ -z $SYNC_SOURCE ] && SYNC_SOURCE=0
log_info() {
- local msg=$1
+ local msg=$1
- echo -e "=> $msg"
+ echo -e "=> $msg"
}
log_error() {
- local msg=$1
+ local msg=$1
- echo -e "E: $msg" 2>&1
+ echo -e "E: $msg" 2>&1
}
log_warning() {
- local msg=$1
+ local msg=$1
- echo -e "W: $msg" 2>&1
+ echo -e "W: $msg" 2>&1
}
log_fatal() {
- local msg=$1
+ local msg=$1
- echo -e "F: $msg" 2>&1
+ echo -e "F: $msg" 2>&1
- exit 1
+ exit 1
}
cpu_count() {
- local cpu_count
+ local cpu_count
- cpu_count=$(cat /proc/cpuinfo | grep -w processor | wc -l)
- if [ $? -eq 0 ]; then
- echo -n $cpu_count
- else
- echo -n 2
- fi
+ cpu_count=$(cat /proc/cpuinfo | grep -w processor | wc -l)
+ if [ $? -eq 0 ]; then
+ echo -n $cpu_count
+ else
+ echo -n 2
+ fi
}