From: Klement Sekera Date: Wed, 24 Jan 2018 12:41:50 +0000 (+0100) Subject: make test: verify that /dev/shm is big enough X-Git-Tag: v18.04-rc1~442 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=da38715fa9ffaa3f8952738606161066ed2e6a4c;p=vpp.git make test: verify that /dev/shm is big enough Verify that /dev/shm size is >= 512M, which should be enough for `make test' needs. If the verification fails, try to enlarge it automatically. This helps avoid docker vpp/make test crashes (seen as SIGBUS). Change-Id: I4e23d59ff8bf8befc320fa229fb6c9bfeb809a8f Signed-off-by: Klement Sekera --- diff --git a/test/Makefile b/test/Makefile index 4f090a15066..f3b7f5c6d51 100644 --- a/test/Makefile +++ b/test/Makefile @@ -102,6 +102,7 @@ SANITY_RUN_VPP_CMD=source $(PYTHON_VENV_PATH)/bin/activate && python sanity_run_ endif sanity: verify-no-running-vpp + @sys_req/dev_shm_size.sh @bash -c "$(SANITY_IMPORT_VPP_PAPI_CMD) ||\ (echo \"*******************************************************************\" &&\ echo \"* Sanity check failed, cannot import vpp_papi\" &&\ diff --git a/test/sys_req/dev_shm_size.sh b/test/sys_req/dev_shm_size.sh new file mode 100755 index 00000000000..e1a1f2d5bd7 --- /dev/null +++ b/test/sys_req/dev_shm_size.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# this script verifies that /dev/shm is big enough for test purposes +# 512MB seems to be enough with room to spare at the time of writing this test +# (motivation for this check is the default docker /dev/shm size of 64M, which +# was occasionally overrun when running the tests) +req_min_size_megabytes=512 + +cur_size=`df -BM --output=size /dev/shm | awk ' NR==2 { print $1 } ' | cut -f 1 -d 'M'` + +if test "$V" = "2" +then + echo -n "Checking /dev/shm size..." +fi + +if test "$cur_size" -lt "$req_min_size_megabytes" +then + echo "/dev/shm size ${cur_size}M is too small, attempting to enlarge to ${req_min_size_megabytes}M." + sudo mount -o remount /dev/shm -o size=512M + cur_size=`df -BM --output=size /dev/shm | awk ' NR==2 { print $1 } ' | cut -f 1 -d 'M'` + if test "$cur_size" -lt "$req_min_size_megabytes" + then + echo "Couldn't enlarge /dev/shm. Please enlarge it manually so that it's at least ${req_min_size_megabytes}M big." + exit 1 + fi + echo "/dev/shm successfully enlarged." +elif test "$V" = "2" +then + echo "OK (current size: ${cur_size}M, required size: ${req_min_size_megabytes}M)" +fi