git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Test suite fails if temporary space is mounted noexec

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Nov 25, 2013, 15:10 UTC
Message-ID
<52936883.7060400@alum.mit.edu>
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/
Message 1 of 1 in “Test suite fails if temporary space is mounted noexec”
  1. Michael HaggertyNov 25, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.