2 # NOTE: this Makefile requires GNU make
9 # setup.py will extend sys.path to include our support/lib/... directory
10 # itself. It will also create it in the beginning of the 'develop' command.
12 TAHOE=$(PYTHON) bin/tahoe
13 SOURCES=src/allmydata src/buildtest static misc bin/tahoe-script.template setup.py
15 # This is necessary only if you want to automatically produce a new
16 # _version.py file from the current git history (without doing a build).
19 $(PYTHON) ./setup.py update_version
24 src/allmydata/_version.py:
27 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
28 # since 'setup.py build' always updates the version.
31 $(PYTHON) setup.py build
37 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
38 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
42 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
43 # since 'setup.py test' always updates the version and builds before testing.
46 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
53 quicktest: make-version
54 $(TAHOE) debug trial $(TRIALARGS) $(TEST)
56 # "make tmpfstest" may be a faster way of running tests on Linux. It works best when you have
57 # at least 330 MiB of free physical memory (to run the whole test suite). Since it uses sudo
58 # to mount/unmount the tmpfs filesystem, it might prompt for your password.
61 time make _tmpfstest 'TMPDIR=$(shell mktemp -d --tmpdir=.)'
64 _tmpfstest: make-version
65 sudo mount -t tmpfs -o size=400m tmpfs '$(TMPDIR)'
66 -$(TAHOE) debug trial --rterrors '--temp-directory=$(TMPDIR)/_trial_temp' $(TRIALARGS) $(TEST)
67 sudo umount '$(TMPDIR)'
71 # code coverage: install the "coverage" package from PyPI, do "make test-coverage" to
72 # do a unit test run with coverage-gathering enabled, then use "make coverage-output" to
73 # generate an HTML report. Also see "make .coverage.el" and misc/coding_tools/coverage.el
74 # for Emacs integration.
76 # This might need to be python-coverage on Debian-based distros.
79 COVERAGEARGS=--branch --source=src/allmydata
81 # --include appeared in coverage-3.4
82 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
87 $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST)
89 .PHONY: coverage-output
92 coverage html -i -d coverage-html $(COVERAGE_OMIT)
93 cp .coverage coverage-html/coverage.data
94 @echo "now point your browser at coverage-html/index.html"
96 .coverage.el: .coverage
97 $(PYTHON) misc/coding_tools/coverage2el.py
101 code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
103 .PHONY: version-and-path
105 $(TAHOE) --version-and-path
107 .PHONY: check-interfaces
109 $(TAHOE) @misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
112 .PHONY: check-miscaptures
114 $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
119 @$(PYTHON) -OOu `which pyflakes` $(SOURCES) |sort |uniq
124 $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
129 -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
133 doc-checks: check-rst
137 @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
143 @find src -name '*.py' |grep -v /build/ |wc -l
145 @cat `find src -name '*.py' |grep -v /build/` |wc -l
147 @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
149 @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
154 $(TAHOE) @src/allmydata/test/check_memory.py upload
155 $(TAHOE) @src/allmydata/test/check_memory.py upload-self
156 $(TAHOE) @src/allmydata/test/check_memory.py upload-POST
157 $(TAHOE) @src/allmydata/test/check_memory.py download
158 $(TAHOE) @src/allmydata/test/check_memory.py download-GET
159 $(TAHOE) @src/allmydata/test/check_memory.py download-GET-slow
160 $(TAHOE) @src/allmydata/test/check_memory.py receive
162 .PHONY: check-memory-once
163 check-memory-once: .built
165 $(TAHOE) @src/allmydata/test/check_memory.py $(MODE)
167 # The check-speed target uses a pre-established client node to run a canned
168 # set of performance tests against a test network that is also
169 # pre-established (probably on a remote machine). Provide it with the path to
170 # a local directory where this client node has been created (and populated
171 # with the necessary FURLs of the test network). This target will start that
172 # client with the current code and then run the tests. Afterwards it will
175 # The 'sleep 5' is in there to give the new client a chance to connect to its
176 # storageservers, since check_speed.py has no good way of doing that itself.
180 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
181 @echo "stopping any leftover client code"
182 -$(TAHOE) stop $(TESTCLIENTDIR)
183 $(TAHOE) start $(TESTCLIENTDIR)
185 $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
186 $(TAHOE) stop $(TESTCLIENTDIR)
188 # The check-grid target also uses a pre-established client node, along with a
189 # long-term directory that contains some well-known files. See the docstring
190 # in src/allmydata/test/check_grid.py to see how to set this up.
193 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
194 $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
196 .PHONY: bench-dirnode
197 bench-dirnode: .built
198 $(TAHOE) @src/allmydata/test/bench_dirnode.py
200 # the provisioning tool runs as a stand-alone webapp server
201 .PHONY: run-provisioning-tool
202 run-provisioning-tool: .built
203 $(TAHOE) @misc/operations_helpers/provisioning/run.py
205 # 'make repl' is a simple-to-type command to get a Python interpreter loop
206 # from which you can type 'import allmydata'
211 .PHONY: test-get-ignore
214 $(PYTHON) misc/build_helpers/test-git-ignore.py
218 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
221 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
222 diff allfiles.tmp.old allfiles.tmp.new
224 # It would be nice if 'make clean' deleted any automatically-generated
225 # _version.py too, so that 'make clean; make all' could be useable as a
226 # "what the heck is going on, get me back to a clean state', but we need
227 # 'make clean' to work on non-checkout trees without destroying useful information.
228 # Use 'make distclean' instead to delete all generated files.
231 rm -rf build _trial_temp _test_memory .built
232 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
234 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
236 rm -rf misc/dependencies/build misc/dependencies/temp
237 rm -rf misc/dependencies/tahoe_deps.egg-info
238 rm -f bin/tahoe bin/tahoe.pyscript
242 rm -rf src/allmydata_tahoe.egg-info
243 rm -f src/allmydata/_version.py
244 rm -f src/allmydata/_appname.py
247 .PHONY: find-trailing-spaces
248 find-trailing-spaces:
249 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
252 .PHONY: -find-trailing-spaces
253 -find-trailing-spaces:
254 -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
257 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
258 # does a build, then asserts that the build did not try to download anything
259 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
260 # support/lib/ directory is gone.
262 .PHONY: fetch-and-unpack-deps
263 fetch-and-unpack-deps:
264 test -f tahoe-deps.tar.gz || wget https://tahoe-lafs.org/source/tahoe-lafs/deps/tahoe-lafs-deps.tar.gz
266 tar xzf tahoe-lafs-deps.tar.gz
268 .PHONY: test-desert-island
270 $(MAKE) fetch-and-unpack-deps
271 $(MAKE) 2>&1 | tee make.out
272 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
279 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
280 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
282 .PHONY: upload-tarballs
284 @if [ "X${BB_BRANCH}" = "Xmaster" ] || [ "X${BB_BRANCH}" = "X" ]; then for f in dist/allmydata-tahoe-*; do flappclient --furlfile ~/.tahoe-tarball-upload.furl upload-file $$f; done ; else echo not uploading tarballs because this is not trunk but is branch \"${BB_BRANCH}\" ; fi