runtests
run the test files in a specific directory and path.
Jive.runtests — Functionruntests(dir::String ;
failfast::Bool = false,
targets::Union{AbstractString, Vector{<: AbstractString}} = String[],
skip::Union{Vector{Any}, Vector{<: AbstractString}} = String[],
testset::Union{Nothing, AbstractString, Vector{<: AbstractString}, Regex, Base.Callable} = nothing,
context::Union{Nothing, Module} = nothing,
enable_distributed::Bool = true,
node1::Union{Vector{Any}, Vector{<: AbstractString}} = String[],
verbose::Bool = true)::Totalrun the test files from the specific directory.
dir: the root directory to traverse.failfast: aborting on the first failure. be overridden when theENVvariableJULIA_TEST_FAILFASThas set.targets: filter targets and start.(space) separatedStringor aVector{String}. be overridden whenARGSare not empty.skip: files or directories to skip. be overridden when theENVvariableJIVE_SKIPhas set.,(comma) separated.testset: filter testset. default isnothing.context: module that to be used inBase.include.nothingmeans to be safe that using anonymous module for every test file.enable_distributed: option for distributed. be overridden when theENVvariableJIVE_PROCShas set.node1: run on node 1 during for the distributed tests.verbose: print details of test execution
suppose you have some test files in the test/ directory for your package. now let's make your test/runtests.jl with
using Jive
runtests(@__DIR__)for the runtests.jl, ARGS are used to filter the targets and to set the start offset of the tests.
~/.julia/dev/Jive/test $ julia runtests.jl jive/s start=3
1/4 jive/skip/skip-calls.jl --
2/4 jive/skip/skip-exprs.jl --
3/4 jive/skip/skip-functions.jl
Pass 4 (0.40 seconds)
4/4 jive/skip/skip-modules.jl
Pass 4 (0.01 seconds)
✅ All 8 tests have been completed. (0.62 seconds)in the above example, test files are matched for only have jive/s and jumping up to the 3rd file.
Examples
- run tests
~/.julia/dev/Jive/test $ julia runtests.jl- run tests with target directory.
~/.julia/dev/Jive/test $ julia runtests.jl jive/If- distributed run tests with
-p
~/.julia/dev/Jive/test $ julia -p3 runtests.jl- distributed run tests for
Pkg.test(), usingJIVE_PROCSENV.
~/.julia/dev/Jive $ JIVE_PROCS=2 julia --project=. -e 'using Pkg; Pkg.test()'
~/.julia/dev/Jive $ julia --project=. -e 'ENV["JIVE_PROCS"]="2"; using Pkg; Pkg.test()'TestJive.jl is an example package for using Jive. look at also the test/Project.toml file for your own package.
[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Jive = "ba5e3d4b-8524-549f-bc71-e76ad9e9deed"
[targets]
test = ["Test", "Jive"]
[compat]
Jive = "0.3"See TestJiveRunMoreTests.jl to care the advanced cases.