-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
help wantedIndicates that a maintainer wants help on an issue or pull requestIndicates that a maintainer wants help on an issue or pull requesttestThis change adds or pertains to unit testsThis change adds or pertains to unit tests
Description
Updated Feb 23, 2015.
This would make a whole bunch of good "first contribution" projects, and does not require deep insider knowledge of the language.
The basic idea is to expand the test suite to make sure that julia's base code works as promised. Here is one recommended way to contribute toward this goal:
The easy way
- Go visit https://coveralls.io/r/JuliaLang/julia. (At the time of this writing, coverage numbers are in the 70s%. If you see numbers that are much lower than this, don't trust the reports; there is likely a problem in measuring coverage.)
- Browse through the source files and find some untested functionality (highlighted in red) that you think you might be able to write a test for.
- Write a test that exercises this functionality---you can add your test to one of the existing files, or start a new one, whichever seems most appropriate to you. If you're adding a new test file, make sure you include it in the list of tests in
test/runtests.jl. http://julia.readthedocs.org/en/latest/stdlib/test/ may be helpful in explaining how the testing infrastructure works. Submit the test as a pull request (see CONTRIBUTING.md).
The manual method
- Make sure you have an up-to-date git checkout and are on the
masterbranch. Build julia withmake - Copy/paste the following script into an editor window and save it. Here I'll use the filename
/tmp/coverage_tests.jl:
using Base.Test
testnames = ["core", "keywordargs", "numbers", "strings", "dates",
"hashing", "remote", "iobuffer", "staged", "arrayops",
"subarray", "reduce", "reducedim", "random", "intfuncs",
"simdloop", "blas", "fft", "dsp", "sparse", "bitarray", "copy", "math",
"functional", "bigint", "sorting", "statistics", "spawn",
"backtrace", "priorityqueue", "arpack", "file", "suitesparse", "version",
"pollfd", "mpfr", "broadcast", "complex", "socket",
"floatapprox", "readdlm", "reflection", "regex", "float16", "combinatorics",
"sysinfo", "rounding", "ranges", "mod2pi", "euler", "show",
"lineedit", "replcompletions", "repl", "test", "goto",
"llvmcall", "grisu", "nullable", "meta", "profile",
"libgit2", "docs", "base64", "pkg", "linalg1", "linalg2",
"linalg3", "linalg4", "linalg/lapack", "linalg/triangular", "linalg/tridiag",
"linalg/pinv", "linalg/cholmod", "linalg/umfpack", "linalg/givens"
]
for tst in testnames
println(tst)
include(joinpath(JULIA_HOME,Base.DATAROOTDIR,"julia","test","$tst.jl"))
end(This is the list of tests currently in test/runtests.jl, with 3 omissions (resolve, reflection, and meta) and one addition (pkg). The omitted tests explicitly test inlining, which we're going to disable, or are problematic when inlining is disabled.)
- From the top-level directory, type
rm usr/lib/julia/sys.so. Deletingsys.sowill prevent julia from using any pre-compiled functions, increasing the accuracy of the results. (This also makes startup a bit slower, but that's fine for this test---and once you're done, simply typingmakewill cause this file to be rebuilt). - Via the command prompt, navigate to julia's
test/directory. - Start julia with
julia --code-coverage=all --inline=no. This turns on code-coverage and prevents inlining (inlining makes it difficult to accurately assess whether a function has been tested). - At the julia prompt, type
include("/tmp/coverage_tests.jl"). - Once the tests complete successfully, quit julia
- Navigate to the
base/directory. - Browse through the *.jl.cov files, and look for functions (or branches within functions) that either have
0in front of them (indicating that they were run 0 times), or have-in front of them (indicating that they were never compiled). - Write a test that exercises some function that is not adequately covered---you can add your test to one of the existing files, or start a new one, whichever seems most appropriate to you. If you're adding a new test file, make sure you include it in the list of tests in
test/runtests.jl. http://julia.readthedocs.org/en/latest/stdlib/test/ may be helpful in explaining how the testing infrastructure works. Submit the test as a pull request (see CONTRIBUTING.md).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedIndicates that a maintainer wants help on an issue or pull requestIndicates that a maintainer wants help on an issue or pull requesttestThis change adds or pertains to unit testsThis change adds or pertains to unit tests