summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-10-11 11:20:46 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-10-17 12:55:03 +1000
commitfc6c443a397d86f2dbad946b18a93a2322a7cd89 (patch)
treec244ec14f6ae23c0a2d4b710310b5c65e2230d9d
parent2c846c344c0c7f9af86d69025dcbf4fa0d9763a8 (diff)
include: add XORG_TESTCASE() macro for standardised printing of descriptions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--include/xorg/gtest/xorg-gtest.h6
-rw-r--r--test/device-test.cpp6
-rw-r--r--test/process-test.cpp22
-rw-r--r--test/xserver-test.cpp6
4 files changed, 23 insertions, 17 deletions
diff --git a/include/xorg/gtest/xorg-gtest.h b/include/xorg/gtest/xorg-gtest.h
index 6a621bd..a61bc35 100644
--- a/include/xorg/gtest/xorg-gtest.h
+++ b/include/xorg/gtest/xorg-gtest.h
@@ -33,3 +33,9 @@
#ifdef HAVE_EVEMU
#include "evemu/xorg-gtest-device.h"
#endif
+
+#define XORG_TESTCASE(message) \
+ SCOPED_TRACE("\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n" \
+ "TESTCASE:\n" \
+ message \
+ "\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n");
diff --git a/test/device-test.cpp b/test/device-test.cpp
index 56ec676..ff5aaec 100644
--- a/test/device-test.cpp
+++ b/test/device-test.cpp
@@ -7,7 +7,7 @@ using namespace xorg::testing;
TEST(DEVICE, DeviceNode)
{
- SCOPED_TRACE("TESTCASE: Device node is /dev/input/eventX");
+ XORG_TESTCASE("Device node is /dev/input/eventX");
xorg::testing::evemu::Device d(TEST_ROOT_DIR "PIXART-USB-OPTICAL-MOUSE.desc");
@@ -16,8 +16,8 @@ TEST(DEVICE, DeviceNode)
TEST(Device, InotifyWait)
{
- SCOPED_TRACE("TESTCASE: device node can never be empty.\n"
- "This test may show false positives");
+ XORG_TESTCASE("device node can never be empty.\n"
+ "This test may show false positives");
xorg::testing::evemu::Device d(TEST_ROOT_DIR "PIXART-USB-OPTICAL-MOUSE.desc");
diff --git a/test/process-test.cpp b/test/process-test.cpp
index 392aff1..725663b 100644
--- a/test/process-test.cpp
+++ b/test/process-test.cpp
@@ -12,7 +12,7 @@ using namespace xorg::testing;
TEST(Process, StartWithNULLArg)
{
- SCOPED_TRACE("\nTESTCASE: invocation of 'ls' with no arguments");
+ XORG_TESTCASE("invocation of 'ls' with no arguments");
Process p;
p.Start("ls", NULL);
ASSERT_GT(p.Pid(), 0);
@@ -20,7 +20,7 @@ TEST(Process, StartWithNULLArg)
TEST(Process, StartWithNULLTerminatedArg)
{
- SCOPED_TRACE("\nTESTCASE: invocation of 'ls' with NULL-terminated argument list");
+ XORG_TESTCASE("invocation of 'ls' with NULL-terminated argument list");
Process p;
p.Start("ls", "-l", NULL);
@@ -29,7 +29,7 @@ TEST(Process, StartWithNULLTerminatedArg)
TEST(Process, ExitCodeSuccess)
{
- SCOPED_TRACE("\nTESTCASE: invocation of 'echo -n', check for success exit status");
+ XORG_TESTCASE("invocation of 'echo -n', check for success exit status");
Process p;
ASSERT_EQ(p.GetState(), Process::NONE);
@@ -49,7 +49,7 @@ TEST(Process, ExitCodeSuccess)
TEST(Process, ExitCodeFailure)
{
- SCOPED_TRACE("\nTESTCASE: an invalid invocation of 'ls', check for error exit status");
+ XORG_TESTCASE("an invalid invocation of 'ls', check for error exit status");
Process p;
ASSERT_EQ(p.GetState(), Process::NONE);
@@ -69,7 +69,7 @@ TEST(Process, ExitCodeFailure)
TEST(Process, ChildTearDown)
{
- SCOPED_TRACE("\nTESTCASE: ensure child process dies when parent does");
+ XORG_TESTCASE("ensure child process dies when parent does");
int pipefd[2];
ASSERT_NE(pipe(pipefd), -1);
@@ -112,8 +112,8 @@ TEST(Process, ChildTearDown)
TEST(Process, TerminationFailure)
{
- SCOPED_TRACE("\nTESTCASE: if Process::Terminate() fails to terminate the \n"
- "child process, kill must terminate it it instead");
+ XORG_TESTCASE("if Process::Terminate() fails to terminate the \n"
+ "child process, kill must terminate it it instead");
sigset_t sig_mask;
struct timespec sig_timeout = {0, 5000000L};
@@ -137,8 +137,8 @@ TEST(Process, TerminationFailure)
TEST(Process, KillExitStatus)
{
- SCOPED_TRACE("\nTESTCASE: a child process killed must have a state of\n"
- "FINISHED_FAILURE");
+ XORG_TESTCASE("a child process killed must have a state of\n"
+ "FINISHED_FAILURE");
Process p;
p.Start(TEST_ROOT_DIR "process-test-helper", NULL);
p.Kill(1000);
@@ -149,8 +149,8 @@ TEST(Process, DoubleStart)
{
struct timespec sig_timeout = {0, 5000000L};
- SCOPED_TRACE("\nTESTCASE: starting a process after it has been started\n"
- "fails. Re-starting a process succeeds\n");
+ XORG_TESTCASE("starting a process after it has been started\n"
+ "fails. Re-starting a process succeeds\n");
/* Process double-started must fail */
Process p;
diff --git a/test/xserver-test.cpp b/test/xserver-test.cpp
index d73364e..5faa6ca 100644
--- a/test/xserver-test.cpp
+++ b/test/xserver-test.cpp
@@ -10,7 +10,7 @@ using namespace xorg::testing;
TEST(XServer, LogRemoval)
{
- SCOPED_TRACE("TESTCASE: X server startup and log file removal on success and error");
+ XORG_TESTCASE("X server startup and log file removal on success and error");
std::string logfile = "/tmp/xorg-testing-xserver_____________.log";
/* make sure a previous failed test didn't leave it around */
@@ -56,8 +56,8 @@ TEST(XServer, LogRemoval)
TEST(XServer, WaitForSIGUSR1)
{
- SCOPED_TRACE("TESTCASE: XOpenDisplay() following server.Start() must\n"
- "succeed as we wait for the SIGUSR1 signal\n");
+ XORG_TESTCASE("XOpenDisplay() following server.Start() must\n"
+ "succeed as we wait for the SIGUSR1 signal\n");
for (int i = 0; i < 20; i++) {
XServer server;
server.SetOption("-logfile", "/tmp/xorg-testing-xserver-sigusr1.log");