Re: [PATCH] Re: Bug 774122 - allow the testsuite to run



Hubert Figuière <hub figuiere net> a écrit:

This one fixes the libtool wrapper test.

[...]

Subject: [PATCH] Bug 774122 - Part 4: libtool wrapper test looked in the wrong
 place

        * Makefile.am: (AM_CPPFLAGS) NEMIVER_SRCDIR should be srcdir.
        NEMIVER_BUILDDIR should be .
---
 tests/Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index f7afb43..098c84b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -208,8 +208,8 @@ AM_CPPFLAGS=-I$(top_srcdir)/src \
 -I$(top_srcdir)/src/confmgr \
 -I$(top_srcdir)/src/dbgengine \
 @NEMIVERCOMMON_CFLAGS@ -DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN \
--DNEMIVER_SRCDIR=\"$(top_srcdir)\" \
--DNEMIVER_BUILDDIR=\"$(top_builddir)\"
+-DNEMIVER_SRCDIR=\"$(srcdir)\" \
+-DNEMIVER_BUILDDIR=\".\"

Hmmh, I'd rather not change the Makefile.am because NEMIVER_SRCDIR and
NEMIVER_BUILDDIR are really meant to point to the absolute topmost
source and build directories of the project.

I think the problem rather comes from the source code of the libtool wrapper
test.

In tests/test-libtool-wrapper-detection.cc, test0 and
test_filename_with_dashes wrongly assume that NEMIVER_SRCDIR points to
the directory of tests/test-libtool-wrapper-detection.cc, which is
"$top_srcdir/tests" and that that NEMIVER_BUILDDIR points to the
directory of runtestlibtoolwrapperdetection which is
"$top_builddir/tests/".

So I am rather committing the patch below that changes the source code
tests/test-libtool-wrapper-detection.cc to fix those erroneous
assumptions.

Thank you for looking into this!

Cheers,

From 476f01040a528dba7e41a7bdb6604b37028b3957 Mon Sep 17 00:00:00 2001
From: Dodji Seketeli <dodji seketeli org>
Date: Tue, 22 Nov 2016 10:37:02 +0100
Subject: [PATCH] Refer to the 'tests" sub-directory explicitly

In the test-libtool-wrapper-detection.cc, we assume that the tests are
run from within the "tests" sub-directory of the build directory.
That is, the current directory should be $builddir/tests when the
tests are run.

This is wrong because invoking that test from anywhere should work by
doing:

    make -C <builddir> check TESTS=runtestlibtoolwrapperdetection

So to this this, I am changing the code of the tests to provide an
absolute path to the "tests" directory.

        * tests/test-libtool-wrapper-detection.cc (test0)
        (test_filename_with_dashes): Refer to the "tests" sub-directory
        (of either the source directory or the build directory)
        explicitly.

Signed-off-by: Dodji Seketeli <dodji seketeli org>
---
 tests/test-libtool-wrapper-detection.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/test-libtool-wrapper-detection.cc b/tests/test-libtool-wrapper-detection.cc
index 5c8b507..90628bc 100644
--- a/tests/test-libtool-wrapper-detection.cc
+++ b/tests/test-libtool-wrapper-detection.cc
@@ -18,6 +18,7 @@ BOOST_AUTO_TEST_CASE (test0)
 {
     vector<string> path_elems;
     path_elems.push_back (NEMIVER_BUILDDIR);
+    path_elems.push_back ("tests");
     path_elems.push_back ("runtestcore");
     string path = Glib::build_filename (path_elems);
     BOOST_REQUIRE (Glib::file_test (path, Glib::FILE_TEST_EXISTS));
@@ -28,6 +29,7 @@ BOOST_AUTO_TEST_CASE (test_filename_with_dashes)
 {
     vector<string> path_elems;
     path_elems.push_back (NEMIVER_SRCDIR);
+    path_elems.push_back ("tests");
     path_elems.push_back ("libtool-wrapper-with-dashes");
     string path = Glib::build_filename (path_elems);
     std::cout << "path: '" << path << "'" << std::endl;
-- 
2.10.2



-- 
                Dodji


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