Skip to content

Commit

Permalink
List the compilers in require.progs when needed
Browse files Browse the repository at this point in the history
Make the build and header test cases list the C and C++ compilers in
their require.progs metadata property.

Fixes #31.
  • Loading branch information
jmmv committed Jul 22, 2017
1 parent b8afb54 commit b74133c
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 14 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ DON'T FORGET TO BUMP THE -version-info PRE-RELEASE IF NECESSARY!
* Issue #23: Fix double-free triggered by atf_map_insert in low memory
scenarios, caused by an overlook in the atf_list code.

* Issue #31: Added require.progs metadata properties to the tests that
need a compiler to run.


Changes in version 0.21
***********************
Expand Down
27 changes: 21 additions & 6 deletions atf-c++/Makefile.am.inc
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,29 @@ tests_atf_c___DATA = atf-c++/Kyuafile \
tests_atf_c__dir = $(pkgtestsdir)/atf-c++
EXTRA_DIST += $(tests_atf_c___DATA)

ATF_CXX_TEST_HELPERS_CPPFLAGS = "-DATF_BUILD_CXX=\"$(ATF_BUILD_CXX)\""
ATF_CXX_TEST_HELPERS_LDADD = atf-c++/detail/libtest_helpers.la

tests_atf_c___PROGRAMS = atf-c++/atf_c++_test
atf_c___atf_c___test_SOURCES = atf-c++/atf_c++_test.cpp
atf_c___atf_c___test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
atf_c___atf_c___test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS)
atf_c___atf_c___test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS)

tests_atf_c___PROGRAMS += atf-c++/build_test
atf_c___build_test_SOURCES = atf-c++/build_test.cpp atf-c/h_build.h
atf_c___build_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
atf_c___build_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS)
atf_c___build_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS)

tests_atf_c___PROGRAMS += atf-c++/check_test
atf_c___check_test_SOURCES = atf-c++/check_test.cpp
atf_c___check_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
atf_c___check_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS)
atf_c___check_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS)

tests_atf_c___PROGRAMS += atf-c++/macros_test
atf_c___macros_test_SOURCES = atf-c++/macros_test.cpp
atf_c___macros_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
atf_c___macros_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS)
atf_c___macros_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS)

tests_atf_c___SCRIPTS = atf-c++/pkg_config_test
CLEANFILES += atf-c++/pkg_config_test
EXTRA_DIST += atf-c++/pkg_config_test.sh
Expand All @@ -91,10 +102,14 @@ atf-c++/pkg_config_test: $(srcdir)/atf-c++/pkg_config_test.sh

tests_atf_c___PROGRAMS += atf-c++/tests_test
atf_c___tests_test_SOURCES = atf-c++/tests_test.cpp
atf_c___tests_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
atf_c___tests_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS)
atf_c___tests_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS)

tests_atf_c___PROGRAMS += atf-c++/utils_test
atf_c___utils_test_SOURCES = atf-c++/utils_test.cpp
atf_c___utils_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
atf_c___utils_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS)
atf_c___utils_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS)

include atf-c++/detail/Makefile.am.inc

# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8
5 changes: 5 additions & 0 deletions atf-c++/detail/test_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include <atf-c++.hpp>

#include <atf-c++/detail/env.hpp>
#include <atf-c++/detail/process.hpp>

#define HEADER_TC(name, hdrname) \
Expand All @@ -44,6 +45,8 @@
{ \
set_md_var("descr", "Tests that the " hdrname " file can be " \
"included on its own, without any prerequisites"); \
const std::string cxx = atf::env::get("ATF_BUILD_CXX", ATF_BUILD_CXX); \
set_md_var("require.progs", cxx); \
} \
ATF_TEST_CASE_BODY(name) \
{ \
Expand All @@ -55,6 +58,8 @@
ATF_TEST_CASE_HEAD(name) \
{ \
set_md_var("descr", descr); \
const std::string cxx = atf::env::get("ATF_BUILD_CXX", ATF_BUILD_CXX); \
set_md_var("require.progs", cxx); \
} \
ATF_TEST_CASE_BODY(name) \
{ \
Expand Down
27 changes: 19 additions & 8 deletions atf-c/Makefile.am.inc
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,33 @@ tests_atf_c_DATA = atf-c/Kyuafile \
tests_atf_cdir = $(pkgtestsdir)/atf-c
EXTRA_DIST += $(tests_atf_c_DATA)

ATF_C_TEST_HELPERS_CPPFLAGS = "-DATF_BUILD_CC=\"$(ATF_BUILD_CC)\""
ATF_C_TEST_HELPERS_LDADD = atf-c/detail/libtest_helpers.la

tests_atf_c_PROGRAMS = atf-c/atf_c_test
atf_c_atf_c_test_SOURCES = atf-c/atf_c_test.c
atf_c_atf_c_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
atf_c_atf_c_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS)
atf_c_atf_c_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la

tests_atf_c_PROGRAMS += atf-c/build_test
atf_c_build_test_SOURCES = atf-c/build_test.c atf-c/h_build.h
atf_c_build_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
atf_c_build_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS)
atf_c_build_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la

tests_atf_c_PROGRAMS += atf-c/check_test
atf_c_check_test_SOURCES = atf-c/check_test.c
atf_c_check_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
atf_c_check_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS)
atf_c_check_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la

tests_atf_c_PROGRAMS += atf-c/error_test
atf_c_error_test_SOURCES = atf-c/error_test.c
atf_c_error_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
atf_c_error_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS)
atf_c_error_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la

tests_atf_c_PROGRAMS += atf-c/macros_test
atf_c_macros_test_SOURCES = atf-c/macros_test.c
atf_c_macros_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
atf_c_macros_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS)
atf_c_macros_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la

tests_atf_c_SCRIPTS = atf-c/pkg_config_test
CLEANFILES += atf-c/pkg_config_test
Expand All @@ -112,15 +120,18 @@ atf-c/pkg_config_test: $(srcdir)/atf-c/pkg_config_test.sh

tests_atf_c_PROGRAMS += atf-c/tc_test
atf_c_tc_test_SOURCES = atf-c/tc_test.c
atf_c_tc_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
atf_c_tc_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS)
atf_c_tc_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la

tests_atf_c_PROGRAMS += atf-c/tp_test
atf_c_tp_test_SOURCES = atf-c/tp_test.c
atf_c_tp_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
atf_c_tp_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS)
atf_c_tp_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la

tests_atf_c_PROGRAMS += atf-c/utils_test
atf_c_utils_test_SOURCES = atf-c/utils_test.c atf-c/h_build.h
atf_c_utils_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
atf_c_utils_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS)
atf_c_utils_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la

include atf-c/detail/Makefile.am.inc

Expand Down
7 changes: 7 additions & 0 deletions atf-c/detail/test_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include <atf-c.h>

#include <atf-c/detail/env.h>
#include <atf-c/error_fwd.h>
#include <atf-c/tc.h>

Expand All @@ -46,8 +47,11 @@ struct atf_fs_path;
ATF_TC(name); \
ATF_TC_HEAD(name, tc) \
{ \
const char *cc; \
atf_tc_set_md_var(tc, "descr", "Tests that the " hdrname " file can " \
"be included on its own, without any prerequisites"); \
cc = atf_env_get_with_default("ATF_BUILD_CC", ATF_BUILD_CC); \
atf_tc_set_md_var(tc, "require.progs", cc); \
} \
ATF_TC_BODY(name, tc) \
{ \
Expand All @@ -58,7 +62,10 @@ struct atf_fs_path;
ATF_TC(name); \
ATF_TC_HEAD(name, tc) \
{ \
const char *cc; \
atf_tc_set_md_var(tc, "descr", descr); \
cc = atf_env_get_with_default("ATF_BUILD_CC", ATF_BUILD_CC); \
atf_tc_set_md_var(tc, "require.progs", cc); \
} \
ATF_TC_BODY(name, tc) \
{ \
Expand Down

0 comments on commit b74133c

Please sign in to comment.