{"thread":{"id":"35402","subject":"Test suite fails if temporary space is mounted noexec","startedAt":"2013-11-25T15:10:59Z","lastAt":"2013-11-25T15:10:59Z","messageCount":1,"participants":["Michael Haggerty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"231071","messageId":"52936883.7060400@alum.mit.edu","threadId":"35402","inReplyTo":null,"subject":"Test suite fails if temporary space is mounted noexec","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2013-11-25T15:10:59Z","receivedAt":"2013-11-25T15:10:59Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"Hi,\n\ntl;dr: The filesystem used as temporary space for the Git test suite\nmust not be mounted \"noexec\".\n\nIt took me a while to figure out why many tests in the Git test suite\nwere failing on my new notebook computer.  The failures started right in\ntest t0000:\n\n    [15:06:31] t0000-basic.sh .....................................\n    Dubious, test returned 1 (wstat 256, 0x100)\n    Failed 10/59 subtests\n            (less 5 skipped subtests: 44 okay)\n\nand maybe 5% of the other test scripts were failing, too.\n\nThe reason is that I was using the tmpfs (RAM filesystem) at /run/shm as\ntemporary space for running the tests.  That speeds the tests up quite a\nbit relative to using a hard disk as temp space.  I had options like the\nfollowing in config.mak:\n\n    DEFAULT_TEST_TARGET = prove\n    GIT_TEST_OPTS = -q --root=/run/shm --tee\n    GIT_PROVE_OPTS = --timer --jobs 5 --state=fresh,hot,slow,save\n\nThis used to work, but my new notebook is running Debian testing, which\nmounts /run/shm with the \"noexec\" option.  Since some of the tests in\nthe test suite write temporary scripts to the temporary space then try\nto execute them, they were failing on this filesystem.\n\n\nIn fact, my old setup was deficient in several ways:\n\n* /run/shm isn't really meant to be used as temporary disk space in the\nfirst place\n\n* Lots of temporary directories were being created directly in the\ntop-level /run/shm directory rather than being tucked in a subdirectory\n\n* It was unreliable to run the test suite in different working copies\nsimultaneously (because they might clobber each others temporary files)\n\n\nTo fix these problems, I am now doing the following:\n\n1. Have Debian mount a tmpfs at /tmp rather than using an on-disk /tmp\ndirectory.  To do this, I added a file /etc/fstab.d/tmp.fstab containing\nthe following line (see tmpfs(5) for more information):\n\n    tmpfs     /tmp tmpfs     nodev,nosuid,size=25%,mode=1777    0    0\n\n2. Change the above lines in config.mak to the following:\n\n    TMP := /tmp/git-tests-$(shell git rev-parse --show-toplevel |\nsha1sum | head -c10)\n    DEFAULT_TEST_TARGET = prove\n    GIT_TEST_OPTS = -q --root=$(TMP) --tee\n    GIT_PROVE_OPTS = --timer --jobs 16 --state=fresh,hot,slow,save\n\nThe idea is that the path of the working copy is encoded in the name of\nthe directory used for temporary space, so test suites for multiple\nworking copies can be run simultaneously.  The test suite creates this\ndirectory automatically if it doesn't already exist (however, it doesn't\nremove it when the tests are over).\n\nI also boosted the parallelism of prove from 5 to 16.  With these\nsettings, the test suite completes in about 33 seconds for me, including\nthe cvsimport tests but not the svn or p4 tests.\n\nI hope that is useful to somebody,\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"}]}