root icon indicating copy to clipboard operation
root copied to clipboard

Enable http/webgui/eve7 tutorials as tests

Open linev opened this issue 5 years ago • 4 comments

Currently http/webgui/eve7 tutorials are vetoed because of many reasons But main reason - such tutorials designed so that THttpServer should runs forever that user can test them in the web browsers.

This can be changed. All tutorials used in ROOT testing started with arguments root -b -l -q tutorial_name.C In tutorials itself one could detect that using something like:

bool test_mode = gApplication->Argn() > 3 &&
                 !strcmp(gApplication->Argv(1),"-b") && 
                 !strcmp(gApplication->Argv(2),"-l") && 
                 !strcmp(gApplication->Argv(3),"-q");

Especially -q argument is clear sign that macro should not be running forever.

Alternatively, one can set special environment variable and test it inside tutorials with:

bool test_mode = gSystem->Getenv("ROOT_TESTING") != nullptr;

But this requires that ROOT_TESTING environment variable should be set before

In any case - if such test_mode detected, macro should behaves differently:

  1. Do not start real http server while it most probably will conflict with other tutorials running in parallel.
  2. Run macro for only limited number of loops for ~3 seconds.
  3. Check production of png images - for most of these tutorials THttpServer or RCanvas or REve can generate image

linev avatar Oct 16 '20 06:10 linev

@linev could we perhaps test eve by producing svgs, verifying that they look as expected, make them the ref file, re-produce them in roottest in batch to then check identity?

dpiparo avatar Feb 02 '24 08:02 dpiparo

Neither svg no png/jpeg images can be produced by eve. With some efforts one could try to implement png support - but in my mind it is not necessary.

This issue was created to let run different tutorials in special testing mode - and simply checks that tutorials are still valid.

Also there are several tutorials with loop like:

while (gSystem->ProcessEvents()) {
   // do something
   // update canvas
}

In special testing mode one could limit this loop by several seconds.

linev avatar Feb 02 '24 08:02 linev

@linev, @DuesselbergAdrian can we provide a PR for fixing this item or close it for good?

dpiparo avatar Apr 24 '24 12:04 dpiparo

As stayed in description, there is no easy way to enable http/webgui tutorials usage for testing.

Every single macro need to be considered new and adjusted - if possible. As first step - one need to have global "TESING_MODE" flag which can be used in such tutorials to perform only minimal checks and exit - while normally these tutorials are interactive ones and runs forever.

linev avatar Apr 24 '24 12:04 linev