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

testing_set_any_error() is not executed, when an error occurred prior to the call #13

Open
lboettcherIRAS opened this issue Jan 6, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@lboettcherIRAS
Copy link
Collaborator

There are test cases of the following form:

call initErrorHandler(control="YES", errAction="RETURN", traceback="YES")

<do something that should not throw an error>

if (getLatestError() /= 0) then
  call test%set_any_error(<test name>)
end if

call resetError()

For such kind of setup, the body of the set_any_error() routine is not executed as the check-in procedure through the ENTER_NORMAL_PROCEDURE() macro directly returns, as an error occurred previously.

The direct workaround for the above case then is:

call initErrorHandler(control="YES", errAction="RETURN", traceback="YES")

<do something that should not throw an error>

if (getLatestError() /= 0) then
  call resetError()
  call test%set_any_error(<test name>)
end if

Accordingly, the error has to be reset before calling the set_any_error() routine in order to actually access its main body.

Nevertheless, this hot-fix is not intuitive and easy to oversee for someone, who is not familiar with this behavior. If this sequence (first reset then throw error) is missed, an actual error may remain unrecognised during testing.

There seem to be three possible options to fix this problem:

  1. Not to check-in the set_any_error() routine by deleting the entry and exit macros. This is problematic, as the routine itself can throw an error, if the total number of errors surpasses a specific threshold.
  2. Add a forced entry macro, which does not check whether an error occurred previously. Here, the potential side effects of such forced check-in are unclear.
  3. Replace the call t%log_fatal("Too many errors in test: "//this%test_name) by a simple fatal error, which is not thrown through the slam_tehl_class.
@lboettcherIRAS lboettcherIRAS added the bug Something isn't working label Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant