git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: git@vger.kernel.org
Subject: Test suite fails if temporary space is mounted noexec
Date: Mon, 25 Nov 2013 16:10:59 +0100	[thread overview]
Message-ID: <52936883.7060400@alum.mit.edu> (raw)

Hi,

tl;dr: The filesystem used as temporary space for the Git test suite
must not be mounted "noexec".

It took me a while to figure out why many tests in the Git test suite
were failing on my new notebook computer.  The failures started right in
test t0000:

    [15:06:31] t0000-basic.sh .....................................
    Dubious, test returned 1 (wstat 256, 0x100)
    Failed 10/59 subtests
            (less 5 skipped subtests: 44 okay)

and maybe 5% of the other test scripts were failing, too.

The reason is that I was using the tmpfs (RAM filesystem) at /run/shm as
temporary space for running the tests.  That speeds the tests up quite a
bit relative to using a hard disk as temp space.  I had options like the
following in config.mak:

    DEFAULT_TEST_TARGET = prove
    GIT_TEST_OPTS = -q --root=/run/shm --tee
    GIT_PROVE_OPTS = --timer --jobs 5 --state=fresh,hot,slow,save

This used to work, but my new notebook is running Debian testing, which
mounts /run/shm with the "noexec" option.  Since some of the tests in
the test suite write temporary scripts to the temporary space then try
to execute them, they were failing on this filesystem.


In fact, my old setup was deficient in several ways:

* /run/shm isn't really meant to be used as temporary disk space in the
first place

* Lots of temporary directories were being created directly in the
top-level /run/shm directory rather than being tucked in a subdirectory

* It was unreliable to run the test suite in different working copies
simultaneously (because they might clobber each others temporary files)


To fix these problems, I am now doing the following:

1. Have Debian mount a tmpfs at /tmp rather than using an on-disk /tmp
directory.  To do this, I added a file /etc/fstab.d/tmp.fstab containing
the following line (see tmpfs(5) for more information):

    tmpfs     /tmp tmpfs     nodev,nosuid,size=25%,mode=1777    0    0

2. Change the above lines in config.mak to the following:

    TMP := /tmp/git-tests-$(shell git rev-parse --show-toplevel |
sha1sum | head -c10)
    DEFAULT_TEST_TARGET = prove
    GIT_TEST_OPTS = -q --root=$(TMP) --tee
    GIT_PROVE_OPTS = --timer --jobs 16 --state=fresh,hot,slow,save

The idea is that the path of the working copy is encoded in the name of
the directory used for temporary space, so test suites for multiple
working copies can be run simultaneously.  The test suite creates this
directory automatically if it doesn't already exist (however, it doesn't
remove it when the tests are over).

I also boosted the parallelism of prove from 5 to 16.  With these
settings, the test suite completes in about 33 seconds for me, including
the cvsimport tests but not the svn or p4 tests.

I hope that is useful to somebody,
Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

                 reply	other threads:[~2013-11-25 15:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52936883.7060400@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).