Makefile: add 'make tmpfstest', which uses a tmpfs for _trial_temp.

This probably only works on Linux. It uses sudo to mount and unmount the tmpfs,
which may prompt for a password. refs #20

Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org>
This commit is contained in:
David-Sarah Hopwood 2012-10-25 02:16:21 +01:00
parent b3bf20748f
commit edc1f5f67f
3 changed files with 21 additions and 0 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@
Twisted-*.egg Twisted-*.egg
/_trial_temp* /_trial_temp*
/tmp*
/dist/ /dist/
/twisted/plugins/dropin.cache /twisted/plugins/dropin.cache
/tahoe-deps/ /tahoe-deps/

View File

@ -75,6 +75,18 @@ test-coverage: build
quicktest: quicktest:
$(TAHOE) debug trial $(TRIALARGS) $(TEST) $(TAHOE) debug trial $(TRIALARGS) $(TEST)
# "make tmpfstest" may be a faster way of running tests on Linux. It works best when you have
# at least 330 MiB of free physical memory (to run the whole test suite). Since it uses sudo
# to mount/unmount the tmpfs filesystem, it might prompt for your password.
tmpfstest:
time make _tmpfstest 'TMPDIR=$(shell mktemp -d --tmpdir=.)'
_tmpfstest:
sudo mount -t tmpfs -o size=330m tmpfs '$(TMPDIR)'
-$(TAHOE) debug trial --rterrors '--temp-directory=$(TMPDIR)/_trial_temp' $(TRIALARGS) $(TEST)
sudo umount '$(TMPDIR)'
rmdir '$(TMPDIR)'
# code-coverage: install the "coverage" package from PyPI, do "make # code-coverage: install the "coverage" package from PyPI, do "make
# quicktest-coverage" to do a unit test run with coverage-gathering enabled, # quicktest-coverage" to do a unit test run with coverage-gathering enabled,
# then use "make coverate-output-text" for a brief report, or "make # then use "make coverate-output-text" for a brief report, or "make

View File

@ -88,6 +88,10 @@ class BinTahoe(common_util.SignalMixin, unittest.TestCase, RunBinTahoeMixin):
if os.path.basename(root_from_cwd) == 'src': if os.path.basename(root_from_cwd) == 'src':
root_from_cwd = os.path.dirname(root_from_cwd) root_from_cwd = os.path.dirname(root_from_cwd)
# This is needed if we are running in a temporary directory created by 'make tmpfstest'.
if os.path.basename(root_from_cwd).startswith('tmp'):
root_from_cwd = os.path.dirname(root_from_cwd)
same = (root_from_cwd == root_to_check) same = (root_from_cwd == root_to_check)
if not same: if not same:
try: try:
@ -105,6 +109,10 @@ class BinTahoe(common_util.SignalMixin, unittest.TestCase, RunBinTahoeMixin):
if os.path.basename(root_from_cwdu) == u'src': if os.path.basename(root_from_cwdu) == u'src':
root_from_cwdu = os.path.dirname(root_from_cwdu) root_from_cwdu = os.path.dirname(root_from_cwdu)
# This is needed if we are running in a temporary directory created by 'make tmpfstest'.
if os.path.basename(root_from_cwdu).startswith(u'tmp'):
root_from_cwdu = os.path.dirname(root_from_cwdu)
if not isinstance(root_from_cwd, unicode) and root_from_cwd.decode(get_filesystem_encoding(), 'replace') != root_from_cwdu: if not isinstance(root_from_cwd, unicode) and root_from_cwd.decode(get_filesystem_encoding(), 'replace') != root_from_cwdu:
msg += ("However, this may be a false alarm because the current directory path\n" msg += ("However, this may be a false alarm because the current directory path\n"
"is not representable in the filesystem encoding. Please run the tests\n" "is not representable in the filesystem encoding. Please run the tests\n"