-
Notifications
You must be signed in to change notification settings - Fork 8
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 #43 from jbytecode/main
add example_checker.jl for checking if examples are not broken
- Loading branch information
Showing
4 changed files
with
42 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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
using Comodo | ||
using Comodo.GLMakie | ||
using Comodo.GeometryBasics | ||
using Comodo.Statistics | ||
using FileIO | ||
|
||
#= | ||
|
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,39 @@ | ||
module ExampleChecker | ||
|
||
function load_and_run!(filename::String, problems::Vector{String})::Bool | ||
cmdline = "using Pkg; Pkg.activate(\"./..\"); include(\"$filename\")" | ||
command = `julia -e $cmdline` | ||
try | ||
result = run(command) | ||
if result.exitcode != 0 | ||
push!(problems, filename) | ||
return false | ||
end | ||
return true | ||
catch e | ||
push!(problems, filename) | ||
return false | ||
end | ||
end | ||
|
||
function main() | ||
dircontent = readdir(".") | ||
juliafiles = filter(x -> occursin(r"demo.*\.jl", x), dircontent) | ||
|
||
problems = Vector{String}(undef, 0) | ||
|
||
for file in juliafiles | ||
println("Checking file: $file") | ||
load_and_run!(file, problems) | ||
end | ||
|
||
@info "Here is the list of problematic files:" | ||
display(problems) | ||
end | ||
|
||
function __init__() | ||
@info "Module initialized, running main" | ||
main() | ||
end | ||
|
||
end # end of module |