[nemiver/better-variable-format: 7/10] Pass full tests file paths to the compiler
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/better-variable-format: 7/10] Pass full tests file paths to the compiler
- Date: Mon, 28 Feb 2011 00:19:18 +0000 (UTC)
commit c08a09513561ee3ff67237fe2615a3f888c7be4f
Author: Dodji Seketeli <dodji seketeli org>
Date: Fri Feb 25 22:46:51 2011 +0100
Pass full tests file paths to the compiler
* tests/Makefile.am: Pass the full path of files to the compiler.
Pass -DNEMIVER_SRCDIR=<full-src-path> and
-DDNEMIVER_BUILDDIR=<build-path> to the compiler on each
compilation unit.
* tests/test-libtool-wrapper-detection.cc: Use the two new macro
passed to this CU to address the files that are either in srcdir
or builddir. This is useful when building in a build dir that is
!= the source dir.
tests/Makefile.am | 77 ++++++++++++++++--------------
tests/test-libtool-wrapper-detection.cc | 21 +++++++--
2 files changed, 58 insertions(+), 40 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 456a1a5..53bf4d2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,3 +1,6 @@
+h=$(abs_srcdir)
+hb=$(abs_builddir)
+
if AUTOTESTS
# 'make check' automatically runs programs listed in the TESTS variable
@@ -28,166 +31,168 @@ pointerderef fooprog templatedvar \
gtkmmtest dostackoverflow bigvar threads \
forkparent forkchild
-runtestgdbmi_SOURCES=test-gdbmi.cc
+runtestgdbmi_SOURCES=$(h)/test-gdbmi.cc
runtestgdbmi_LDADD= @NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libgdbmiparser.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-gtkmmtest_SOURCES=gtkmm-test.cc
+gtkmmtest_SOURCES=$(h)/gtkmm-test.cc
gtkmmtest_CXXFLAGS= @NEMIVERUICOMMON_CFLAGS@
gtkmmtest_LDADD= @NEMIVERUICOMMON_LIBS@
-fooprog_SOURCES=fooprog.cc
+fooprog_SOURCES=$(h)/fooprog.cc
fooprog_LDADD=
-forkparent_SOURCES=fork-parent.cc
+forkparent_SOURCES=$(h)/fork-parent.cc
forkparent_LDADD=
-forkchild_SOURCES=fork-child.cc
+forkchild_SOURCES=$(h)/fork-child.cc
forkchild_LDADD=
-runtestbreakpoint_SOURCES=test-breakpoint.cc
+runtestbreakpoint_SOURCES=$(h)/test-breakpoint.cc
runtestbreakpoint_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestwatchpoint_SOURCES=test-watchpoint.cc
+runtestwatchpoint_SOURCES=$(h)/test-watchpoint.cc
runtestwatchpoint_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestvarpathexpr_SOURCES=test-var-path-expr.cc
+runtestvarpathexpr_SOURCES=$(h)/test-var-path-expr.cc
runtestvarpathexpr_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestvarobjwalker_SOURCES=test-varobj-walker.cc
+runtestvarobjwalker_SOURCES=$(h)/test-varobj-walker.cc
runtestvarobjwalker_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestvariableformat_SOURCES=test-variable-format.cc
+runtestvariableformat_SOURCES=$(h)/test-variable-format.cc
runtestvariableformat_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-#runtestoverloads_SOURCES=test-overloads.cc
+#runtestoverloads_SOURCES=$(h)/test-overloads.cc
#runtestoverloads_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
#$(top_builddir)/src/common/libnemivercommon.la
-runtestcore_SOURCES=test-core.cc
+runtestcore_SOURCES=$(h)/test-core.cc
runtestcore_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la
-runteststdout_SOURCES=test-stdout.cc
+runteststdout_SOURCES=$(h)/test-stdout.cc
runteststdout_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la
-runtestcpptrait_SOURCES=test-cpptrait.cc
+runtestcpptrait_SOURCES=$(h)/test-cpptrait.cc
runtestcpptrait_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestunicode_SOURCES=test-unicode.cc
+runtestunicode_SOURCES=$(h)/test-unicode.cc
runtestunicode_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la
-runtestvars_SOURCES=test-vars.cc
+runtestvars_SOURCES=$(h)/test-vars.cc
runtestvars_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestvarlist_SOURCES=test-var-list.cc
+runtestvarlist_SOURCES=$(h)/test-var-list.cc
runtestvarlist_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestvarwalker_SOURCES=test-var-walker.cc
+runtestvarwalker_SOURCES=$(h)/test-var-walker.cc
runtestvarwalker_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestderef_SOURCES=test-deref.cc
+runtestderef_SOURCES=$(h)/test-deref.cc
runtestderef_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestlocalvarslist_SOURCES=test-local-vars-list.cc
+runtestlocalvarslist_SOURCES=$(h)/test-local-vars-list.cc
runtestlocalvarslist_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-#runtestglobalvariables_SOURCES=test-global-variables.cc
+#runtestglobalvariables_SOURCES=$(h)/test-global-variables.cc
#runtestglobalvariables_LDADD= NEMIVERCOMMON_LIBS@ \
#$(top_builddir)/src/common/libnemivercommon.la
-runtestcpplexer_SOURCES=test-cpp-lexer.cc
+runtestcpplexer_SOURCES=$(h)/test-cpp-lexer.cc
runtestcpplexer_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
$(top_builddir)/src/langs/libnemivercparser.la \
$(top_builddir)/src/common/libnemivercommon.la
-runtestcppparser_SOURCES=test-cpp-parser.cc
+runtestcppparser_SOURCES=$(h)/test-cpp-parser.cc
runtestcppparser_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
$(top_builddir)/src/langs/libnemivercparser.la \
$(top_builddir)/src/common/libnemivercommon.la
-runtestlibtoolwrapperdetection_SOURCES=test-libtool-wrapper-detection.cc
+runtestlibtoolwrapperdetection_SOURCES=$(h)/test-libtool-wrapper-detection.cc
runtestlibtoolwrapperdetection_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
$(top_builddir)/src/langs/libnemivercparser.la \
$(top_builddir)/src/common/libnemivercommon.la
-runtestenv_SOURCES=test-env.cc
+runtestenv_SOURCES=$(h)/test-env.cc
runtestenv_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la
-runtesttypes_SOURCES=test-types.cc
+runtesttypes_SOURCES=$(h)/test-types.cc
runtesttypes_LDADD= NEMIVERCOMMON_LIBS@ \
@BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-runtestdisassemble_SOURCES=test-disassemble.cc
+runtestdisassemble_SOURCES=$(h)/test-disassemble.cc
runtestdisassemble_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la \
$(top_builddir)/src/dbgengine/libdebuggerutils.la
-docore_SOURCES=do-core.cc
+docore_SOURCES=$(h)/do-core.cc
docore_LDADD= NEMIVERCOMMON_LIBS@
-inout_SOURCES=inout.cc
+inout_SOURCES=$(h)/inout.cc
inout_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la
-pointerderef_SOURCES=pointer-deref.cc
+pointerderef_SOURCES=$(h)/pointer-deref.cc
pointerderef_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la
-templatedvar_SOURCES=templated-var.cc
+templatedvar_SOURCES=$(h)/templated-var.cc
templatedvar_LDADD= NEMIVERCOMMON_LIBS@ \
$(top_builddir)/src/common/libnemivercommon.la
-dostackoverflow_SOURCES=do-stack-overflow.cc
+dostackoverflow_SOURCES=$(h)/do-stack-overflow.cc
dostackoverflow_LDADD= NEMIVERCOMMON_LIBS@
-bigvar_SOURCES=big-var.c
+bigvar_SOURCES=$(h)/big-var.c
bigvar_LDADD= NEMIVERCOMMON_LIBS@
-threads_SOURCES=threads.cc
+threads_SOURCES=$(h)/threads.cc
threads_LDADD= NEMIVERCOMMON_LIBS@
INCLUDES=-I$(top_srcdir)/src \
-I$(top_srcdir)/src/confmgr \
-I$(top_srcdir)/src/dbgengine \
- NEMIVERCOMMON_CFLAGS@ -DBOOST_TEST_DYN_LINK
+ NEMIVERCOMMON_CFLAGS@ -DBOOST_TEST_DYN_LINK \
+-DNEMIVER_SRCDIR=\"$(h)\" \
+-DNEMIVER_BUILDDIR=\"$(hb)\"
LDADD=$(top_builddir)/src/common/libnemivercommon.la
-EXTRA_DIST=libtool-wrapper-with-dashes
+EXTRA_DIST=$(h)/libtool-wrapper-with-dashes
diff --git a/tests/test-libtool-wrapper-detection.cc b/tests/test-libtool-wrapper-detection.cc
index 47ea756..0c0503a 100644
--- a/tests/test-libtool-wrapper-detection.cc
+++ b/tests/test-libtool-wrapper-detection.cc
@@ -1,5 +1,6 @@
#include <iostream>
#include <string>
+#include <vector>
#include <boost/test/unit_test.hpp>
#include "common/nmv-exception.h"
#include "common/nmv-initializer.h"
@@ -7,19 +8,31 @@
using namespace nemiver::common;
using boost::unit_test::test_suite;
+using std::vector;
+using std::string;
void
test0 ()
{
- UString real_path;
- BOOST_REQUIRE (is_libtool_executable_wrapper ("./runtestcore"));
+ vector<string> path_elems;
+ path_elems.push_back (NEMIVER_BUILDDIR);
+ path_elems.push_back ("runtestcore");
+ string path = Glib::build_filename (path_elems);
+ BOOST_REQUIRE (Glib::file_test (path, Glib::FILE_TEST_EXISTS));
+ BOOST_REQUIRE (is_libtool_executable_wrapper (path));
}
void
test_filename_with_dashes()
{
- UString real_path;
- BOOST_REQUIRE (is_libtool_executable_wrapper ("./libtool-wrapper-with-dashes"));
+ vector<string> path_elems;
+ path_elems.push_back (NEMIVER_SRCDIR);
+ path_elems.push_back ("libtool-wrapper-with-dashes");
+ string path = Glib::build_filename (path_elems);
+ std::cout << "path: '" << path << "'" << std::endl;
+ BOOST_REQUIRE (Glib::file_test (path, Glib::FILE_TEST_EXISTS));
+ BOOST_REQUIRE (is_libtool_executable_wrapper (path));
+
}
test_suite*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]