From: Junio C Hamano Date: Mon, 29 Jun 2015 21:25:11 +0000 (-0700) Subject: Meta/Make: optionally use ramdisk while running tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3135db2b4e7cf18d4aaff0bc3f9e6a5697fe071d;p=thirdparty%2Fgit.git Meta/Make: optionally use ramdisk while running tests --- diff --git a/Make b/Make index 0272b9787b..fbdc6bfd9b 100755 --- a/Make +++ b/Make @@ -111,6 +111,7 @@ case "$NO_PEDANTIC" in ;; esac +testpen= while case $# in 0) break ;; esac do case "$1" in @@ -129,6 +130,12 @@ do -loose | --loose) PEDANT= Wall= ;; + --memtrash) + testpen=testpen.$$ + ;; + --memtrash=*) + testpen=testpen.${1#--memtrash=} + ;; --locale=*) LANG=${1#*=} ;; @@ -158,6 +165,23 @@ do esac shift done + +if test -n "$testpen" +then + for TRASH in /dev/shm /tmp "" + do + if test -n "$TRASH" && + mkdir -p "$TRASH/$testpen" 2>/dev/null && + test -w "$TRASH/$testpen" + then + TRASH="--root=$(cd "$TRASH/$testpen" && /bin/pwd)" + break + fi + done + GIT_TEST_OPTS="$TRASH${GIT_TEST_OPTS+" $GIT_TEST_OPTS"}" + export GIT_TEST_OPTS +fi + O="${PEDANT}${PEDANT:+ }$O" test -f /bin/dash || with_dash=