summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-10-10test/process-test: prefix TESTCASE with newline in debugging outputPeter Hutterer1-8/+8
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10test/process-test: add test for starting the same process object multiple timesPeter Hutterer1-0/+86
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10test: add test for termination exit statusPeter Hutterer1-0/+10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10process: wait for SIGCHLD instead of busy loopingPeter Hutterer1-16/+31
If for some reason we fail to handle the signals, usleep for the timeout instead. This will slow down the tests, but still behave properly. And if a test fails with the usleep, the SCOPED_TRACE will print out the warnings. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10process: on termination, check if the process exited and set the error codePeter Hutterer2-6/+16
This changes the meaning of Process::TERMINATED to "currently in termination but we're not sure what happened to it" Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10test: add test-case for starting serversPeter Hutterer1-0/+16
With the SIGUSR1 patch, an XOpenDisplay() after XServer::Start() should always succeed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10xserver: don't throw exceptions on failed startupPeter Hutterer1-7/+11
Startup failure can be a valid test-case, avoid throwing exceptions around. Instead, update the process state on SIGCHLD, otherwise continue quietly after the timeout. A test that needs the server to be running, will figure out that it isn't once XOpenDisplay() fails. If the signal handling fails, still throw an exception, that's an actual error case. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10test: add helper program for process termination issuePeter Hutterer3-2/+44
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10test: rename two process testsPeter Hutterer1-2/+2
Termination can have different meaning for a process, rename the test cases to be more explicit Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10process: if termination fails, the state must not be TERMINATEDPeter Hutterer1-4/+7
If a process is hung and doesn't respond to termination, a Kill() call must still try to actually kill the process. In the current code, unsuccessful termination would still set the state, preventing Kill() from actually working Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10Fix up build system to use the googletest import buildPeter Hutterer9-61/+74
Drop the CHECK_GTEST macro, we can assume it's there now. We still build the gtest bits as convenience libraries, leave the various flags in there. Add $includedir/xorg to pgkconfig CPPFLAGS, as we install gtest.h in includedir/xorg/gtest/gtest.h to avoid overwriting or conflicts with a system-installed gtest.h Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10Import googletest's fused-src filesPeter Hutterer4-0/+28702
Files taken from gtest-1.6.0.zip/fused-src, pushed into a directory layout like this: /gtest/include/gtest/gtest.h /gtest/src/gtest*.cc Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-10Bump to 0.5.99Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-04Deprecate WaitForConnections()Daniel Martin3-32/+1
As we already know that the XServer is ready for connections due to it's notification via SIGUSR1, we don't need to poll anymore. This only deprecates the call and warns potential users, it will be removed in a future release. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-04xserver: use SIGUSR1 to wait for XServer startupDaniel Martin1-0/+31
Set the signal handler for SIGUSR1 to SIG_IGN. The XServer will test for this on startup and sends a SIGUSR1 when it's ready for connections. We wait for 1sec to receive this signal from the XServer. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-03include: fix doxygen warningPeter Hutterer1-1/+1
/home/whot/code/xorg-gtest/include/xorg/gtest/evemu/xorg-gtest-device.h:46: warning: the name `xorg-gtest_device.h' supplied as the argument of the \class, \struct, \union, or \include command is not an input file Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-03Drop compat headersPeter Hutterer6-19/+1
These headers were always internal anyway, drop them now that we've had 2 releases with them marked as deprecated. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-02xorg-gtest 0.5.0xorg-gtest-0.5.0Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-09-27process: fix compiler warningPeter Hutterer1-1/+1
../src/process.cpp: In member function ‘bool xorg::testing::Process::WaitForExit(unsigned int)’: ../src/process.cpp:130:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Matt Dew <marcoz@osource.org> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-09-27xserver: don't sleep for a second, 100us is enoughPeter Hutterer1-2/+2
But loop more often. On my machine the average wait time for the server to start up appears to be ~600 us. Play it safe, usleep for 100us only and then try again. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Matt Dew <marcoz@osource.org> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-09-27process: return if waitpid() failsPeter Hutterer1-0/+2
If the Process is forked after Start(), the child to be terminated isn't actually the child and we hang forever. Thus, treat ECHILD as success, after all if the child isn't there it can be seen as terminated. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Matt Dew <marcoz@osource.org> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-09-27process: reduce wait time for process terminationPeter Hutterer1-2/+2
Re-try with a constant 10 us until the timeout is reached instead of a timeout-dependent wait time. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Matt Dew <marcoz@osource.org> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-09-25Remove mention of "dummy" where it's not true anymorePeter Hutterer4-14/+12
These messages are not correct when the server isn't started with the dummy driver. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-29device: use inotify to wait for the device to appearPeter Hutterer5-3/+141
uinput can be too slow, leaving us with GuessDeviceNode() failing and an empty device string. Use inotify to tell us when a /dev/input/event device appeared and then continue. However, even when inotify tells us the device is there, the EVIOCGNAME may still fail on the device, so we need to keep the backup GuessDeviceNode() in place. This leaves us with a race condition - if a different device pops up while we're waiting, then we may still not get the device name. Chance of that happening is tiny. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-29device: if the device node is still empty when we need it, re-guessPeter Hutterer1-2/+5
Sometimes the device is there, but EVIOCGNAME fails on it and we can't guess the device node after creation time. Try again whenever we ask for the node, in the hope that enough time has passed and we may get it this time. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-29device: If we can't open the device, it's not the one we wantPeter Hutterer1-0/+3
well, or at least we're not sure whether it is, so... Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-29device: split device comparison into a helper functionPeter Hutterer1-15/+23
No functional changes, we'll re-use this though. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-29device: only strcmp if EVIOCGNAME succeedsPeter Hutterer1-2/+2
The ioctl may fail under some conditions, causing a erroneous strcmp. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-29device: move "device not found error down"Peter Hutterer1-6/+4
Even if scandir results in success, we may still fail and return an empty device path. Move the error message down, the code in between the old position of this hunk and the new position is not hit if scandir fails anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-29test: add xserver-test to gitignorePeter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-08-28aclocal: set the proper include path for the default source pathPeter Hutterer1-2/+2
If a gtest source path is given, the include path is adjusted accordingly. If we fall back to the default /usr/src/gtest we only set the include path to -I/usr/src/gtest but none of the headers are there. Fix that by appending the right source path. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17test: add xserver test for logfile removalPeter Hutterer2-1/+67
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17process: terminate the child if the parent diesPeter Hutterer2-0/+50
It's annoying to have the forked X server linger around when the test segfaults, so make sure we take it down with us. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17test: add a self-check directoryPeter Hutterer5-1/+135
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17xserver: add RemoveLogFile()Peter Hutterer2-0/+18
Simple unlink() call to the logfile in use. The log file is only removed if the server was started and terminated or finished successfully. If it was never started or the startup failed for some reason, this function does nothing. Behaviour can be overridden by forcing the removal. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17process: add state enum and GetState()Peter Hutterer2-0/+59
Add a set of basic states to Process to allow callers to keep track of which state a process is in (as seen from the library). This simplifies code that needs to happen on certain conditions only, e.g. log file cleanup is only needed if the process was previously started. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17process: require NULL as last argument to Start()Peter Hutterer2-9/+13
And handle empty arguments and NULL_terminated arguments. This is a better API than require the user to pass empty strings, especially since in some cases an empty string may be a valid argument. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17xserver: don't push the program name into the argument listPeter Hutterer1-1/+0
Process:Start() does this for us. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17xserver: if the logfile was created by TestStartup, remove it againPeter Hutterer1-2/+12
If the file didn't exist and we created it by checking whether it is writeable, the file needs to be removed again. Otherwise we have empty logfiles lying around if the server fails to start. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-17xserver: use temporary variable for log file tooPeter Hutterer1-14/+7
And use + for string concatination, the code as-is was a legacy from const char* handling. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-16process: add XORG_GTEST_CHILD_STDOUT environment variablePeter Hutterer2-2/+7
If this variable is set, leave stdout and stderr open for the child process to see potential error messages thrown by that child. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-16Add Red Hat copyright noticesPeter Hutterer8-0/+8
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-14process: document that va_args for Start() must end with zero-length stringPeter Hutterer1-2/+4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-13Drop mentioning of uTouch-Evemu in comments, rename to evemuPeter Hutterer1-4/+4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-13xserver: add destructor to tear down the serverPeter Hutterer2-0/+7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-13xserver: add getters and setters for config and log filePeter Hutterer2-0/+24
A GetOption() call would be more generic here, but for log and config file it's more intuitive to have actual methods instead of having to pass "-config" to a generic GetOption() call. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-13Require gtest-source-path to be absolutePeter Hutterer2-5/+25
We implicitly already require this (examples/ won't build with relative paths), so make it explicit in the macros Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-08xserver: add GetVersion() to retrieve server versionPeter Hutterer2-0/+41
For non-integrated tests, knowing the X server version is important. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-08process: use fork(), not vfork()Peter Hutterer1-1/+1
From the man page: The vfork() function has the same effect as fork(2), except that the behavior is undefined if the process created by vfork() either modifies any data other than a variable of type pid_t used to store the return value from vfork(), or returns from the function in which vfork() was called, or calls any other function before successfully calling _exit(2) or one of the exec(3) family of functions. We modify data and we call functions other than _exit/exec. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-08aclocal: fill AS_IF with noop statementsPeter Hutterer1-2/+2
Expanding this macro fails when used with autoconf < v2.64. It expands to if test <condition>; then fi Empty statements are invalid. Later versions of autoconf have an explicit ':' statement to work around this issue, but for the courtesy of RHEL6 we will add it as well. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>