90 likes | 98 Views
Learn how to test visualization in batch mode, automate testing with Cdash, and run tests on Cdash without a graphic card using Xvfb library. Compare snapshots for accurate results.
E N D
How to test Vis ? Laurent Garnier OSUR / INSU / CNRS Geant4 Collaboration Meeting – Chicago – 29 September 2015 Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 29 Sept 2015 - Chicago
A set of drivers It is user ’s responsability to test their own example. I’m not takling about testing the user interface (buttons, mouse click…), but only the visualisation frame. • Interactively • Open your favorite User interface and test • Time consuming • difficult to check everything • In batch mode • Possible to automate in Cdash => easy, cdash is working for your Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 29 Sept 2015 - Chicago
Testing vis in batch mode The goal is to : • Run your example • Take snapshots of vis • Compare theses « snapshot » to reference files Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 29 Sept 2015 - Chicago
How to ? • In .cc main() function, add a batch fallback if(argc>1){ // execute an argument macro file if exist G4String fileName = argv[1]; UImanager->ApplyCommand(controlExecute + fileName);} 2. In macro file, open generic OGL viewer • Will goes on OGLSQt or whatever • Will fallinto batch if not /vis/open OGL 3. In macro file, takesnapshot(s) /vis/ogl/export myTestVis.jpg Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 29 Sept 2015 - Chicago
How to ? 4.a Launch application on your computer • No problems, and then compare by hand the output to a referencefolder 4.B Launch application on Cdash • Tests on Cdashrun on computer withoutgraphiccard • Achieve by running visualisation in a frame buffer instead of inside a window, thanks to XVFB library (X With Frame Buffer) Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 29 Sept 2015 - Chicago
How to ? CMakeLists.txt find_package(Xvfb QUIET) if(XVFB_FOUND) message(STATUS "G4 TESTS: found Xvfb --> run test202 ») GEANT4_ADD_TEST(test202-OGLIX COMMAND xvfb.sh ${CMAKE_CURRENT_BINARY_DIR}/test202 OGLIX ENVIRONMENT ${GEANT4_TEST_ENVIRONMENT} DEPENDS test202-build TIMEOUT 1500 ERROR expected_errors.txt) endif() Will Run a test with xvfb.sh script: Xvfb.sh bin_name param => You should have a param.vis macro and param-reference, param-output folders Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 29 Sept 2015 - Chicago
How to ? Quick look on xvfb.sh export DISPLAY_TMP=$DISPLAY XV_CMD="Xvfb :99 -screen 0 1024x768x24 -nolisten tcp » … # Launching export DISPLAY=:99 echo "launching $1 » $1 $2.mac … See test202 example. Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 29 Sept 2015 - Chicago
Testing all examples ? • Nothingdone for the moment • I guess a minimum of 1 test by exampleshouldbedone • Not a big effort Actuallyonly 1 machine on Cdashrunwithxvfblibrary Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 29 Sept 2015 - Chicago
Question ? Laurent Garnier - OSUR / Geant4 Collaboration Meeting - 28 Sept 2015 - Chicago