]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Meta/Make: optionally use ramdisk while running tests
authorJunio C Hamano <gitster@pobox.com>
Mon, 29 Jun 2015 21:25:11 +0000 (14:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Jun 2015 21:25:11 +0000 (14:25 -0700)
Make

diff --git a/Make b/Make
index 0272b9787b3711720a7c50ac19732dab0b750c81..fbdc6bfd9b9e82353aff2f68eccdf28508652e11 100755 (executable)
--- 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=