[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[creduce-dev] C-Reduce Script for an OpenGL program



Hi everyone,

I'm using C-Reduce with an OpenGL program which displays unwanted visual artifacts on some of our workstations. It takes around 30 seconds to compile the relevant preprocessed single compilation unit C++ file (courtesy of cotire). Things appear to run smoothly for the first half hour. Upon returning about 20 hours later though, I see progress around 15% and the terminal has around 20 messages indicating timeout of C-Reduce has kicked in. I can also see that there are 10s of instances of our application still running.

I have included our script below. Basically each a.out executable takes a string argument (the current directory basename) which defines the window name - one second is given to find that window by name. It is then activated, to allow a screenshot to be taken. This is compared with the expected "golden" screenshot, before the window is killed.

I like C-Reduce a lot, though I suspect it isn't ideal for graphical programs. In any case, I'm keen to learn what I can from it.

#!/bin/bash
FILE=gui_CXX_unity_preprocessed.cxx
GUI_ROOT=$HOME/project/gui
APP_NAME=`basename $PWD`

DIFFERENCE=123

function visual_compare()
{
  ./a.out $APP_NAME >/dev/null 2>&1 &
  WINDOW=`timeout 1s xdotool search --sync --name "$APP_NAME"`
  if [ -z "$WINDOW" ]
  then
    return
  fi
  xdotool windowactivate  $WINDOW
  import -screen -window $WINDOW grab.rgba
  xdotool windowkill $WINDOW
  cmp -s grab.rgba $GUI_ROOT/golden.rgba
  DIFFERENCE=$?
}

g++ -std=c++17 ${FILE} -lSDL2 -lSDL2_image -lSDL2_ttf -lGLEW -lGL -L -pthread >/dev/null 2>&1 &&\
visual_compare && exit $DIFFERENCE

Thanks for your time,
Paul


Please consider the environment and think before you print.

The University of the West of Scotland is a registered Scottish charity. Charity number SC002520.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.

Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the University of the West of Scotland.

As a public body, the University of the West of Scotland may be required to make available emails as well as other written forms of information as a result of a request made under the Freedom of Information (Scotland) Act 2002.