[Gambas-user] JIT crash

Jussi Lahtinen jussi.lahtinen at gmail.com
Fri Jan 11 00:19:37 CET 2019


The idea behind the tester is in quick implementation. Every test should be
created and left alone without need for maintenance (unless Gambas itself
is intentionally changed in syntax, behaviour or so).
Don't delete anything in it, just add what you need. It is mess, but mess
is good way to catch bugs. When everything is "normal" and good, you will
not catch the exceptions that trigger most of the bugs.

Some one (I don't remember) here implemented some unit tester framework,
which ran each test in separated process and thus preventing the tester
from crashing if some test crashes. I initially thought that's neat and
clever, but when thinking about it, it's really not good idea. What if some
test causes side effects? How you catch them, if all tests are run in
different instance? A mess catches them much better.

What you suggest would multiply the amount of code at least by three. I
agree that it would make it clean, but what for? If that would help you
with the debugging, then I think it is good idea, otherwise I'm not at
least yet convinced.

If other people want to contribute, it's easy. Just download the code
(0.10.17 or newer if there is) and add your test to end of the DoTests
function in mTest module.
Just make sure in case of error line "Errors.Add(System.Backtrace[0])" is
executed. If you need variables, classes, etc for your test, create your
own and add them to the project. This way there are no conflicts /
interference with other tests. Just more of the "beautiful" mess.

However, make sure your test is valid to avoid false positives.

I attached my script to run the tests (it itself is run by compiling
script).


Jussi



On Fri, Jan 11, 2019 at 12:02 AM Benoît Minisini <g4mba5 at gmail.com> wrote:

> Le 10/01/2019 à 20:57, Jussi Lahtinen a écrit :
> > OK, I didn't get that far. I got to "mTest.Ploo2.0: #6: Type mismatch:
> > wanted Stream, got Void instead".
> > At mTest.2454 there must be some remains of some tests... I fixed it,
> > but I noticed that something has changed in the interpreter.
> > One test fails (function called TheLoop), because essentially for next
> > loop from 10 to 1 (step -1) continues with value 0.
> >
> > See attachment.
> >
> >
> > Jussi
> >
>
> It would be cool and really useful if you could rewrite your test
> project and make it clean.
>
> I suggest that:
>
> - Each test must be written in a public function named TestXXXX in a
> module. This function must return a Boolean to tell if the test is OK.
>
> - East test method must start by printing which test is done.
>
> - You can have several tests stored in different modules. It will be
> pratical as some tests will have to share some private code.
>
> - The main function will browse the symbols of all modules, and call all
> public methods whose name starts with "Test" in natural order
> (Test1...Test9, Test 10...). Then the return value of each method is
> tested. Then you can break immediately if the test fails, or just print
> a warning message and continues.
>
> - At the end of the program, you write how many tests failes.
>
> That way several people will be able to add tests to the project easily.
>
> What do you think?
>
> --
> Benoît Minisini
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190111/fc2e5483/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestGambas.sh
Type: application/x-shellscript
Size: 748 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190111/fc2e5483/attachment-0001.bin>


More information about the User mailing list