Opened 10 years ago

Closed 7 years ago

#3235 closed defect (wontfix)

Fix test cases with error messages that include line numbers from the compiler

Reported by: Per Östlund Owned by: somebody
Priority: high Milestone: Future
Component: *unknown* Version: trunk
Keywords: Cc: Lennart Ochel, Willi Braun, Volker Waurich

Description (last modified by Per Östlund)

I have disabled some test cases that have error messages in them which include line numbers from the compiler. This means that the test cases needs to be updated every time the corresponding source files are changed in the compiler, which is not acceptable. Internal errors should really only be used for things which shouldn't fail, and not used as failtraces.

So either the compiler needs to be fixed so it doesn't print out internal errors for these models, or the models needs to be fixed. The models are:

simulation/modelica/indexreduction/ImplicitStateCoupling.mos
simulation/libraries/3rdParty/MathematicalAspects/01_AlgebraicLoopBoolean.mos
openmodelica/typed-API/SolveLinearSystem.mos
simulation/modelica/algorithms_functions/algorithms.mos
openmodelica/modelicaML/watchdog.mos

Change History (10)

comment:1 by Per Östlund, 10 years ago

Also, the following pattern is often used in the front end:

function foo
  ...
protected
  Integer err_count = Error.getNumErrorMessages();
algorithm
  try
    // Something which can fail.
  else
    if err_count == Error.getNumErrorMessages() then
      Error.addInternalError(...);
    end if;
  end try;
end foo;

I.e. only print an internal error if the called code fails without printing an error of its own. This is probably a pattern which should be used more in the backend, considering that getNumErrorMessages is used five times in the whole backend, while internal errors are used in ~250 places.

comment:2 by Volker Waurich, 10 years ago

Thanks for adressing this issue. I appreciate these recommendation to get a more consistent coding style. Could you add this to the style guide?

comment:3 by Martin Sjölund, 10 years ago

I will just note that a lot of the addInternalError calls were added by me; they were often replacing print statements (which is worse than just failtrace).

in reply to:  2 comment:4 by Per Östlund, 10 years ago

Replying to vwaurich:

Could you add this to the style guide?

Done.

comment:5 by Per Östlund, 10 years ago

Description: modified (diff)

algorithms.mos added to the list.

comment:6 by Per Östlund, 10 years ago

Description: modified (diff)

Added watchdog.mos too.

comment:7 by Adrian Pop, 10 years ago

This could be easily fixed: for flag --running-testsuite *do not show the line numbers*
for the errors added with Error.addInternalError.

Last edited 10 years ago by Adrian Pop (previous) (diff)

in reply to:  7 comment:8 by Per Östlund, 10 years ago

Replying to adrpo:

This could be easily fixed: for flag --running-testsuite *do not show the line numbers*
for the errors added with Error.addInternalError.

Sure, but that's just a workaround. I don't think we should be using internal errors as failtraces, it causes the actual error messages to be buried beneath all the other errors that are of no consequence to the users.

comment:9 by Adrian Pop, 10 years ago

Of course. What I mean is that we could fix the problem until somebody has time to look at all the internal errors and make them proper errors instead.

comment:10 by Francesco Casella, 7 years ago

Resolution: wontfix
Status: newclosed

It seems like this ticket is totally obsolete

Note: See TracTickets for help on using tickets.