-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from JuliaDebug/teh/juliatests
Add test harness for running all of Julia's tests
- Loading branch information
Showing
2 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using JuliaInterpreter | ||
using Test | ||
|
||
if !isdefined(Main, :read_and_parse) | ||
include("utils.jl") | ||
end | ||
|
||
const juliadir = dirname(dirname(Sys.BINDIR)) | ||
const testdir = joinpath(juliadir, "test") | ||
if isdir(testdir) | ||
include(joinpath(testdir, "choosetests.jl")) | ||
else | ||
@warn "Julia's test/ directory not found, skipping Julia tests" | ||
end | ||
|
||
module JuliaTests end | ||
|
||
@testset "Julia tests" begin | ||
stack = JuliaStackFrame[] | ||
function runtest(frame) | ||
empty!(stack) | ||
empty!(JuliaInterpreter.framedict) | ||
empty!(JuliaInterpreter.genframedict) | ||
return JuliaInterpreter.finish_and_return!(stack, frame, true) | ||
end | ||
function dotest!(failed, test) | ||
println("Working on ", test, "...") | ||
ex = read_and_parse(joinpath(testdir, test)*".jl") | ||
if isexpr(ex, :error) | ||
@warn "error parsing $test: $ex" | ||
else | ||
ex = Expr(:toplevel, :(using Test), ex) | ||
try | ||
lower_incrementally(runtest, JuliaTests, ex) | ||
println("Succeeded on ", test) | ||
catch err | ||
@show test err | ||
push!(failed, (test, err)) | ||
end | ||
end | ||
end | ||
if isdir(testdir) | ||
tests, _ = choosetests() | ||
delayed = [] | ||
failed = [] | ||
for test in tests | ||
if startswith(test, "compiler") | ||
push!(delayed, test) | ||
else | ||
dotest!(failed, test) | ||
end | ||
end | ||
for test in delayed | ||
dotest!(failed, test) | ||
end | ||
@show failed | ||
@test isempty(failed) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters