Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@test failure doesn't provide full stack from a (sub)function #46391

Open
lkovac22 opened this issue Aug 18, 2022 · 2 comments
Open

@test failure doesn't provide full stack from a (sub)function #46391

lkovac22 opened this issue Aug 18, 2022 · 2 comments

Comments

@lkovac22
Copy link

lkovac22 commented Aug 18, 2022

runtests.jl
using Test

function failFunction()
  @test false
end

@time @testset verbose = true "test main level" begin

  @time @testset "failure 1" begin
    @test false
  end

  @time @testset "failure 2" begin
    failFunction()
  end

end

If @test macro failure occurs inside @testset block, full stack is properly printed (e.g. @testset "failure 1").
If @test macro failure occurs inside a function called from within @testset block, only limited stack is printed (e.g. @testset "failure 2"). It is not clear as to where inside @testset block failure originated.

This used to work in julia 1.6.5

versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)```

</details>
@vtjnash
Copy link
Member

vtjnash commented Sep 2, 2022

Fix in #44995

@lkovac22
Copy link
Author

lkovac22 commented Aug 4, 2023

Using julia 1.9.2 this issue does not seem to be fixed.

"failure 1" (code in the original submission) prints out properly full stack:

failure 1: Test Failed at MyTest\test\runtests.jl:10
  Expression: false

Stacktrace:
 [1] macro expansion
   @ julia\stdlib\v1.9\Test\src\Test.jl:478 [inlined]
 [2] macro expansion
   @ MyTest\test\runtests.jl:10 [inlined]
 [3] macro expansion
   @ julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
 [4] macro expansion
   @ MyTest\test\runtests.jl:10 [inlined]
 [5] macro expansion
   @ .\timing.jl:273 [inlined]
 [6] macro expansion
   @ MyTest\test\runtests.jl:9 [inlined]
 [7] macro expansion
   @ julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
 [8] macro expansion
   @ MyTest\test\runtests.jl:9 [inlined]
 [9] top-level scope
   @ .\timing.jl:273

"failure 2" prints out only limited portion of stack:

failure 2: Test Failed at MyTest\test\runtests.jl:4
  Expression: false

Stacktrace:
 [1] macro expansion
   @ julia\stdlib\v1.9\Test\src\Test.jl:478 [inlined]
 [2] failFunction()
   @ Main MyTest\test\runtests.jl:4

@lkovac22 lkovac22 reopened this Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants