diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2020-11-26 10:58:08 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2020-11-30 09:09:31 +1000 |
commit | 1ab907827f782c71aed7a09c4e3e867977885e39 (patch) | |
tree | d17f7f5bab6fb19833eac470af73e8587d70415b | |
parent | 3627b194c43dc4c07445f7007db9d0ef3783892a (diff) |
test: sub the builddir path for the helpers
When building with srcdir != builddir, the resulting file won't be in the
source directory.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/process-test.cpp | 10 | ||||
-rw-r--r-- | test/xserver-test.cpp | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 13485ab..cdb262d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -38,7 +38,9 @@ GTEST_CPPFLAGS=-I$(top_srcdir)/gtest/include -I$(top_srcdir)/gtest AM_CPPFLAGS = $(GTEST_CPPFLAGS) $(BASE_CPPFLAGS) AM_CXXFLAGS = $(BASE_CXXFLAGS) $(BASE_CPPFLAGS) \ - -DTEST_ROOT_DIR=\"$(abs_top_srcdir)/test/\" + -DTEST_ROOT_DIR=\"$(abs_top_srcdir)/test/\" \ + -DTEST_BUILD_DIR=\"$(abs_builddir)/\" \ + $(NULL) tests_libraries = \ libgtest.a \ diff --git a/test/process-test.cpp b/test/process-test.cpp index db13d0d..700069a 100644 --- a/test/process-test.cpp +++ b/test/process-test.cpp @@ -125,7 +125,7 @@ TEST(Process, TerminationFailure) sigaddset(&sig_mask, SIGUSR1); Process p; - p.Start(TEST_ROOT_DIR "process-test-helper", nullptr); + p.Start(TEST_BUILD_DIR "process-test-helper", nullptr); /* don't check error here, the helper may have sent the signal before we get here */ sigtimedwait(&sig_mask, nullptr, &sig_timeout); @@ -143,7 +143,7 @@ TEST(Process, KillExitStatus) XORG_TESTCASE("a child process killed must have a state of\n" "FINISHED_FAILURE"); Process p; - p.Start(TEST_ROOT_DIR "process-test-helper", nullptr); + p.Start(TEST_BUILD_DIR "process-test-helper", nullptr); p.Kill(1000); ASSERT_EQ(p.GetState(), Process::FINISHED_FAILURE); } @@ -195,7 +195,7 @@ TEST(Process, DoubleStart) /* job that must be killed, followed by job */ sigemptyset(&sig_mask); sigaddset(&sig_mask, SIGUSR1); - p.Start(TEST_ROOT_DIR "process-test-helper", nullptr); + p.Start(TEST_BUILD_DIR "process-test-helper", nullptr); sigtimedwait(&sig_mask, nullptr, &sig_timeout); ASSERT_EQ(p.GetState(), Process::RUNNING); p.Kill(100); @@ -215,7 +215,7 @@ TEST(Process, DoubleStart) /* job that fails to terminate, starting another one must fail */ sigemptyset(&sig_mask); sigaddset(&sig_mask, SIGUSR1); - p.Start(TEST_ROOT_DIR "process-test-helper", nullptr); + p.Start(TEST_BUILD_DIR "process-test-helper", nullptr); sigtimedwait(&sig_mask, nullptr, &sig_timeout); ASSERT_EQ(p.GetState(), Process::RUNNING); ASSERT_FALSE(p.Terminate(100)); @@ -338,7 +338,7 @@ TEST_P(ProcessValgrindArgsWrapper, ValgrindWrapperWithArgs) /* now set the env and fire up valgrind */ setenv("XORG_GTEST_USE_VALGRIND", vargs.c_str(), 1); Process p; - p.Start(TEST_ROOT_DIR "process-test-helper", nullptr); + p.Start(TEST_BUILD_DIR "process-test-helper", nullptr); unsetenv("XORG_GTEST_USE_VALGRIND"); ASSERT_EQ(p.GetState(), Process::RUNNING); diff --git a/test/xserver-test.cpp b/test/xserver-test.cpp index 45e47f0..66c6d9f 100644 --- a/test/xserver-test.cpp +++ b/test/xserver-test.cpp @@ -368,7 +368,7 @@ TEST(XServer, RemoveOption) XServer server; server.SetOption("-fail", "yes"); server.SetOption("-logfile", LOGFILE_DIR "/Xorg-remove-option.log"); - server.Start(TEST_ROOT_DIR "/xserver-test-helper"); + server.Start(TEST_BUILD_DIR "/xserver-test-helper"); while(i++ < 10 && server.GetState() == Process::RUNNING) usleep(50000); @@ -376,7 +376,7 @@ TEST(XServer, RemoveOption) ASSERT_EQ(server.GetState(), Process::FINISHED_FAILURE); server.RemoveOption("-fail"); - server.Start(TEST_ROOT_DIR "/xserver-test-helper"); + server.Start(TEST_BUILD_DIR "/xserver-test-helper"); ASSERT_EQ(server.GetState(), Process::FINISHED_SUCCESS); } |