tlienart / Franklin.jl

(yet another) static site generator. Simple, customisable, fast, maths with KaTeX, code evaluation, optional pre-rendering, in Julia.
https://franklinjl.org
MIT License
959 stars 112 forks source link

Eval test failing, `throw_complex_domainerror` not found in `run_code` error message. #830

Closed adigitoleo closed 3 years ago

adigitoleo commented 3 years ago

One test is failing for me on Julia 1.6.1 (Arch Linux), I'll investigate more as time permits. Any pointers will be appreciated.

Julia versioninfo:

julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44* (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.0 (ORCJIT, skylake)
Test log: ``` (@v1.6) pkg> test Franklin Testing Franklin Status `/tmp/jl_Wfe9Gg/Project.toml` [a93c6f00] DataFrames v1.1.1 [864edb3b] DataStructures v0.18.9 [ffbed154] DocStringExtensions v0.8.5 [e2ba6199] ExprTools v0.1.3 [713c75ef] Franklin v0.10.37 [3a985190] FranklinTemplates v0.8.16 [cd3eb016] HTTP v0.8.19 [98b081ad] Literate v2.8.1 [16fef848] LiveServer v0.6.6 [2bd173c7] NodeJS v1.3.0 [bac558e1] OrderedCollections v1.4.1 [fd094767] Suppressor v0.2.0 [ade2ca70] Dates `@stdlib/Dates` [8bb1440f] DelimitedFiles `@stdlib/DelimitedFiles` [37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra` [56ddb016] Logging `@stdlib/Logging` [d6f4376e] Markdown `@stdlib/Markdown` [44cfe95a] Pkg `@stdlib/Pkg` [3fa0cd96] REPL `@stdlib/REPL` [9a3f8284] Random `@stdlib/Random` [8dfed614] Test `@stdlib/Test` Status `/tmp/jl_Wfe9Gg/Manifest.toml` [34da2185] Compat v3.30.0 [a8cc5b0e] Crayons v4.0.4 [9a962f9c] DataAPI v1.6.0 [a93c6f00] DataFrames v1.1.1 [864edb3b] DataStructures v0.18.9 [e2d170a0] DataValueInterfaces v1.0.0 [ffbed154] DocStringExtensions v0.8.5 [e2ba6199] ExprTools v0.1.3 [59287772] Formatting v0.4.2 [713c75ef] Franklin v0.10.37 [3a985190] FranklinTemplates v0.8.16 [cd3eb016] HTTP v0.8.19 [b5f81e59] IOCapture v0.2.2 [83e8ac13] IniFile v0.5.0 [41ab1584] InvertedIndices v1.0.0 [82899510] IteratorInterfaceExtensions v1.0.0 [682c06a0] JSON v0.21.1 [98b081ad] Literate v2.8.1 [16fef848] LiveServer v0.6.6 [739be429] MbedTLS v1.0.3 [e1d29d7a] Missings v1.0.0 [2bd173c7] NodeJS v1.3.0 [bac558e1] OrderedCollections v1.4.1 [69de0a69] Parsers v1.1.0 [2dfb63ee] PooledArrays v1.2.1 [08abe8d2] PrettyTables v1.1.0 [189a3867] Reexport v1.1.0 [a2af1166] SortingAlgorithms v1.0.0 [fd094767] Suppressor v0.2.0 [3783bdb8] TableTraits v1.0.1 [bd369af6] Tables v1.4.3 [0dad84c5] ArgTools `@stdlib/ArgTools` [56f22d72] Artifacts `@stdlib/Artifacts` [2a0f44e3] Base64 `@stdlib/Base64` [ade2ca70] Dates `@stdlib/Dates` [8bb1440f] DelimitedFiles `@stdlib/DelimitedFiles` [8ba89e20] Distributed `@stdlib/Distributed` [f43a241f] Downloads `@stdlib/Downloads` [7b1f6079] FileWatching `@stdlib/FileWatching` [9fa8497b] Future `@stdlib/Future` [b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils` [b27032c2] LibCURL `@stdlib/LibCURL` [76f85450] LibGit2 `@stdlib/LibGit2` [8f399da3] Libdl `@stdlib/Libdl` [37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra` [56ddb016] Logging `@stdlib/Logging` [d6f4376e] Markdown `@stdlib/Markdown` [a63ad114] Mmap `@stdlib/Mmap` [ca575930] NetworkOptions `@stdlib/NetworkOptions` [44cfe95a] Pkg `@stdlib/Pkg` [de0858da] Printf `@stdlib/Printf` [3fa0cd96] REPL `@stdlib/REPL` [9a3f8284] Random `@stdlib/Random` [ea8e919c] SHA `@stdlib/SHA` [9e88b42a] Serialization `@stdlib/Serialization` [1a1011a3] SharedArrays `@stdlib/SharedArrays` [6462fe0b] Sockets `@stdlib/Sockets` [2f01184e] SparseArrays `@stdlib/SparseArrays` [10745b16] Statistics `@stdlib/Statistics` [fa267f1f] TOML `@stdlib/TOML` [a4e569a6] Tar `@stdlib/Tar` [8dfed614] Test `@stdlib/Test` [cf7118a7] UUIDs `@stdlib/UUIDs` [4ec0a83e] Unicode `@stdlib/Unicode` [deac9b47] LibCURL_jll `@stdlib/LibCURL_jll` [29816b5a] LibSSH2_jll `@stdlib/LibSSH2_jll` [c8ffd9c3] MbedTLS_jll `@stdlib/MbedTLS_jll` [14a3606d] MozillaCACerts_jll `@stdlib/MozillaCACerts_jll` [83775a58] Zlib_jll `@stdlib/Zlib_jll` [8e850ede] nghttp2_jll `@stdlib/nghttp2_jll` [3f19e933] p7zip_jll `@stdlib/p7zip_jll` Precompiling project... 5 dependencies successfully precompiled in 21 seconds (29 already precompiled) Testing Running tests... UTILS-1 Test Summary: | Pass Total set_paths! | 10 10 Test Summary: | Pass Total outp_path | 10 10 Test Summary: | Pass Total Set vars | 4 4 Test Summary: | Pass Total Def+coms | 2 2 UTILS-2 Test Summary: | Pass Total strings | 7 7 Test Summary: | Pass Total ocblock | 2 2 Test Summary: | Pass Total isexactly | 18 18 Test Summary: | Pass Total timeittook | 1 1 Test Summary: | Pass Total refstring | 8 8 Test Summary: | Pass Total misc-html | 8 8 Test Summary: | Pass Total misc-html 2 | 4 4 Test Summary: | Pass Total match_url | 8 8 Test Summary: | Pass Total check_type | 7 7 Test Summary: | Pass Total Date locales | 4 4 Test Summary: | Pass Total dict-inv | 5 5 Test Summary: | Pass Total get_url | 6 6 Test Summary: | Pass Total fd2html#489 | 1 1 Test Summary: | Pass Total context | 6 6 Test Summary: | Pass Total show | 2 2 Test Summary: | Pass Total ocbe | 1 1 Test Summary: | Pass Total lxbe | 7 7 Test Summary: | Pass Total Unfound | 1 1 Test Summary: | Pass Total H-For | 4 4 Test Summary: | Pass Total HToc | 2 2 Test Summary: | Pass Total warn-pv | 3 3 Test Summary: | Pass Total warn-config | 2 2 Test Summary: | Pass Total warn-paginate | 10 10 Test Summary: | Pass Total misc-html | 3 3 Test Summary: | Pass Total misc-html 2 | 4 4 Test Summary: | Pass Total html/hide | 3 3 Test Summary: | Pass Total html_code | 1 1 Test Summary: | Pass Total html_content | 1 1 Test Summary: | Pass Total fd2text | 1 1 Test Summary: | Pass Total latex | 9 9 Test Summary: | Pass Total assign | 2 2 Test Summary: | Pass Total esclink | 13 13 Test Summary: | Pass Total fndef | 1 1 Test Summary: | Pass Total html-ent | 12 12 Test Summary: | Pass Total code | 14 14 Test Summary: | Pass Total hb-if | 6 6 Test Summary: | Pass Total hb-else | 4 4 Test Summary: | Pass Total hb-elseif | 6 6 Test Summary: | Pass Total hb-end | 4 4 Test Summary: | Pass Total hb-isdef | 8 8 Test Summary: | Pass Total hb-isndef | 8 8 Test Summary: | Pass Total hb-ispage | 2 2 Test Summary: | Pass Total hb-isnotpage | 2 2 Test Summary: | Pass Total hb-for | 9 9 Test Summary: | Pass Total hb-fun-0 | 6 6 Test Summary: | Pass Total hb-fun-1 | 6 6 Test Summary: | Pass Total hb-fun-2 | 4 4 Test Summary: | Pass Total ch-for | 5 5 Test Summary: | Pass Total fix_links | 1 1 šŸŗ MANAGER Test Summary: | Pass Total Prep outdir | 3 3 šŸ Testing file tracking...: tracking new file 'blah.md'. tracking new file 'config.md'. tracking new file 'index.html'. tracking new file 'index.md'. tracking new file 'temp.html'. tracking new file 'temp.rnd'. tracking new file 'temp.css'. tracking new file 'foo.js'. Test Summary: | Pass Total Scan dir | 4 4 Test Summary: | Pass Total Config+write | 3 3 Test Summary: | Pass Total Part convert | 4 4 šŸ Testing error message...: Test Summary: | Pass Total Err procfile | 1 1 Test Summary: | Pass Total config | 6 6 Test Summary: | Pass Total i381 | 1 1 Test Summary: | Pass Total ignore/fs2 | 3 3 Test Summary: | Pass Total coverage | 10 10 ā†’ Initial full pass... Test Summary: | Pass Total Scope (#412) | 2 2 ā†’ Initial full pass... ā†’ Initial full pass... Test Summary: | Pass Total Paginate | 12 12 Test Summary: | Pass Total robots | 1 1 Test Summary: | Pass Total rss_prep | 4 4 šŸŗ PARSER/MD+LX Test Summary: | Pass Total P:1:find-tok | 21 21 Test Summary: | Pass Total P:1:ctok | 13 13 Test Summary: | Pass Total P:1:val-fn | 3 3 Test Summary: | Pass Total P:1:val-hd | 6 6 Test Summary: | Pass Total P:1:fib | 22 22 Test Summary: | Pass Total P:2:blk | 5 5 Test Summary: | Pass Total P:2:blk-ind | 7 7 Test Summary: | Pass Total P:2:blk-indF | 7 7 Test Summary: | Pass Total More ind | 1 1 Test Summary: | Pass Total P:2:blk-{} | 4 4 Test Summary: | Pass Total P:2:blk-[] | 6 6 Test Summary: | Pass Total Find Tokens | 6 6 Test Summary: | Pass Total Find blocks | 8 8 Test Summary: | Pass Total Unicode lx | 4 4 Test Summary: | Pass Total Header blocks | 8 8 Test Summary: | Pass Total Line skip | 1 1 Test Summary: | Pass Total Header+lx | 5 5 Test Summary: | Pass Total Bold x* | 2 2 Test Summary: | Pass Total Bold code | 1 1 Test Summary: | Pass Total Tickssss | 16 16 Test Summary: | Pass Total Nested ind | 3 3 Test Summary: | Pass Total Double brace | 2 2 Test Summary: | Pass Total Double brace2 | 1 1 Test Summary: | Pass Total Hz rule | 4 4 Test Summary: | Pass Total mathunicode | 1 1 Test Summary: | Pass Total emoji-basics | 6 6 Test Summary: | Pass Total footnotes | 2 2 Test Summary: | Pass Total Fn in code | 1 1 Test Summary: | Pass Total lx++1 | 1 1 Test Summary: | Pass Total indentation | 11 11 Test Summary: | Pass Total ind+lx | 1 1 Test Summary: | Pass Total Bad cases | 3 3 Test Summary: | Pass Total Script | 1 1 Test Summary: | Pass Total div-dbb | 4 4 Test Summary: | Pass Total iss#502 | 1 1 šŸŗ EVAL Test Summary: | Pass Total utils | 10 10 Test Summary: | Pass Total parse_code | 7 7 run_code: Test Failed at /home/admin/.julia/packages/Franklin/vNQFN/test/eval/run.jl:77 Expression: occursin("throw_complex_domainerror", s) Evaluated: occursin("throw_complex_domainerror", "ā”Œ Franklin Warning: in \nā”‚ There was an error of type 'DomainError' when running a code block.\nā”‚ Checking the output files '/tmp/jl_lYnpI9.(out| res)'\nā”‚ might be helpful to understand and solve the issue.\nā”‚ \nā”‚ Relevant pointers:\nā”‚ - evaluation of Julia code blocks: https://franklinjl.org/code/\nā”‚ \nā”‚ Details:\nā”‚ DomainError with -1.0:\nā”‚ sqrt will onl y return a complex result if called with a complex argument. Try sqrt(Complex(x)).\nā”‚ Stacktrace:\nā”‚ [1] sqrt\nā”‚ @ ./math.jl:582 [inlined]\nā”‚ [2] sqrt(x::Int64)\nā”‚ @ Base.Math ./math.jl:608\nā””\n") Stacktrace: [1] record(ts::Test.DefaultTestSet, t::Union{Test.Error, Test.Fail}) @ Test /build/julia/src/julia-1.6.1/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:809 [2] macro expansion @ ~/.julia/packages/Franklin/vNQFN/test/eval/run.jl:77 [inlined] [3] macro expansion @ /build/julia/src/julia-1.6.1/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined] [4] top-level scope @ ~/.julia/packages/Franklin/vNQFN/test/eval/run.jl:26 Test Summary: | Pass Fail Total run_code | 11 1 12 ERROR: LoadError: LoadError: Some tests did not pass: 11 passed, 1 failed, 0 errored, 0 broken. in expression starting at /home/admin/.julia/packages/Franklin/vNQFN/test/eval/run.jl:25 in expression starting at /home/admin/.julia/packages/Franklin/vNQFN/test/runtests.jl:53 ERROR: Package Franklin errored during testing ```
adigitoleo commented 3 years ago

Minimal sample to reproduce the error:

using Franklin
using Suppressor

const F = Franklin

mod = F.newmodule(F.modulename("foo/path.md"))
junk = tempname()
s = @capture_out F.run_code(mod, "sqrt(-1)", junk)
@assert occursin("throw_complex_domainerror", s)

It seems like an internal error message was modified but the test case has not been updated. Alternatively, this used to be part of a larger stack trace that is no longer being pushed through run_code.

tlienart commented 3 years ago

Thanks a lot for this report @adigitoleo , I'll look into it, should be reasonably easy to fix. (I'm just surprised it didn't show up in the CI logs šŸ¤” )

adigitoleo commented 3 years ago

@tlienart

I'm just surprised it didn't show up in the CI logs

From my quick skim of your yaml I think you are running julia 1.5, maybe the stack trace for the error from sqrt(-1) was different in that version?

Here is the error for 1.6.1:

julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
 [1] sqrt
   @ ./math.jl:582 [inlined]
 [2] sqrt(x::Int64)
   @ Base.Math ./math.jl:608
 [3] top-level scope
   @ REPL[8]:1

If this throw_complex_error thing used to be in the Details: section (i.e. the julia stacktrace), I would suggest just deleting that line: better to only check for messages that you can expect/control, so just the Franklin errors.

To anyone following along at home: this is only an error in the test suite, AFAIK, and should not affect any functionality.