Test suite fails if temporary space is mounted noexec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx
http://softwareswirl.blogspot.com/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]