diff options
Diffstat (limited to 'tests')
35 files changed, 180 insertions, 59 deletions
diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 3445bd2..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -SHRTOUT = no -NOEXPORT_VARNAMES = MKC_CACHEDIR -EXPORT_VARNAMES = SHRTOUT - -BUILTINSDIR = ${OBJDIR_custom} -.export BUILTINSDIR - -SUBDIR += configure_test -SUBDIR += mkinstall -SUBDIR += ../examples -SUBDIR += mkshlib -SUBDIR += mkstaticlib -SUBDIR += mkpiclib -SUBDIR += mkprofilelib -SUBDIR += mkdll -SUBDIR += pkg_config_0 -SUBDIR += pkg_config_1 -SUBDIR += pkg_config_2 -SUBDIR += lua_dirs -SUBDIR += rec_makefiles -SUBDIR += reqd -SUBDIR += reqd2 -SUBDIR += reqd3 -SUBDIR += reqd4 -SUBDIR += reqd_clean_cache -SUBDIR += intexts_cleantrg -SUBDIR += test_subprj_dash -SUBDIR += test_mkc_vs_PROG -SUBDIR += test_mkc_vs_LIB -SUBDIR += test_mkc_vs_SUBDIR -SUBDIR += test_mkc_vs_SUBPRJ - -.include <mkc.mk> diff --git a/tests/Makefile.inc b/tests/Makefile.inc new file mode 100644 index 0000000..2b0aecf --- /dev/null +++ b/tests/Makefile.inc @@ -0,0 +1 @@ +.include "../examples/Makefile.inc" diff --git a/tests/configure_test/expect.out b/tests/configure_test/expect.out index f7e8ddf..5b8d11b 100644 --- a/tests/configure_test/expect.out +++ b/tests/configure_test/expect.out @@ -31,6 +31,8 @@ HAVE_FUNC5.mkc_test_func.include_mkc_test_h=1 HAVE_VAR.mkc_test_var.include_mkc_test_h=1 HAVE_MEMBER.struct_mkc_test_t_a.include_mkc_test_h=1 HAVE_MEMBER.struct_mkc_test_t_b_c.include_mkc_test_h=1 +HAVE_PROTOTYPE.strcmp_ok=1 +HAVE_PROTOTYPE.strcmp_bad=0 CUSTOM.custom_check1=1 CUSTOM.custom_check2=0 HAVE_PROG.sh=1 @@ -39,8 +41,8 @@ HAVE_PROG.awk=1 PROG.awk=/somewhere/bin/awk HAVE_PROG.megaprog-x34=0 PROG.megaprog-x34= -MKC_AUTO_CFLAGS=-DHAVE_HEADER_SYS_TIME_H=1 -DHAVE_HEADER_STRING_H=1 -DHAVE_HEADER_INCLUDE_MKC_TEST_H=1 -DSIZEOF_INT=n -DSIZEOF_LONG_LONG=n -DSIZEOF_VOIDP=n -DSIZEOF_SIZE_T_STRING_H=n -DHAVE_DEFINE_MKC_TEST_DEFINE_INCLUDE_MKC_TEST_H=1 -DHAVE_TYPE_SIZE_T_STRING_H=1 -DHAVE_VAR_ERRNO_ERRNO_H=1 -DHAVE_VAR_MKC_TEST_VAR_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_TM_TM_ISDST_TIME_H=1 -DHAVE_MEMBER_STRUCT_SOCKADDR_IN_SIN_ADDR_S_ADDR_ARPA_INET_H_NETINET_IN_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_A_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_B_C_INCLUDE_MKC_TEST_H=1 -DHAVE_FUNC2_STRCMP_STRING_H=1 -DHAVE_FUNC5_MKC_TEST_FUNC_INCLUDE_MKC_TEST_H=1 -DCUSTOM_CUSTOM_CHECK1=1 -MKC_AUTO_SRCS=superfunc1.c superfunc2.c +MKC_AUTO_CFLAGS= -DHAVE_HEADER_SYS_TIME_H=1 -DHAVE_HEADER_STRING_H=1 -DHAVE_HEADER_INCLUDE_MKC_TEST_H=1 -DSIZEOF_INT=n -DSIZEOF_LONG_LONG=n -DSIZEOF_VOIDP=n -DSIZEOF_SIZE_T_STRING_H=n -DHAVE_DEFINE_MKC_TEST_DEFINE_INCLUDE_MKC_TEST_H=1 -DHAVE_TYPE_SIZE_T_STRING_H=1 -DHAVE_VAR_ERRNO_ERRNO_H=1 -DHAVE_VAR_MKC_TEST_VAR_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_TM_TM_ISDST_TIME_H=1 -DHAVE_MEMBER_STRUCT_SOCKADDR_IN_SIN_ADDR_S_ADDR_ARPA_INET_H_NETINET_IN_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_A_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_B_C_INCLUDE_MKC_TEST_H=1 -DHAVE_FUNC2_STRCMP_STRING_H=1 -DHAVE_FUNC5_MKC_TEST_FUNC_INCLUDE_MKC_TEST_H=1 -DCUSTOM_CUSTOM_CHECK1=1 -DHAVE_PROTOTYPE_STRCMP_OK=1 +MKC_AUTO_SRCS= superfunc1.c superfunc2.c MKC_AUTO_LDADD= KNOWN_SYSTEM @@ -79,6 +81,8 @@ HAVE_FUNC5.mkc_test_func.include_mkc_test_h=1 HAVE_VAR.mkc_test_var.include_mkc_test_h=2 HAVE_MEMBER.struct_mkc_test_t_a.include_mkc_test_h=1 HAVE_MEMBER.struct_mkc_test_t_b_c.include_mkc_test_h=1 +HAVE_PROTOTYPE.strcmp_ok=0 +HAVE_PROTOTYPE.strcmp_bad=1 CUSTOM.custom_check1=0 CUSTOM.custom_check2=1 HAVE_PROG.sh=1 @@ -87,8 +91,8 @@ HAVE_PROG.awk=0 PROG.awk= HAVE_PROG.megaprog-x34=0 PROG.megaprog-x34=/bad/path -MKC_AUTO_CFLAGS=-DHAVE_HEADER_SYS_TIME_H=2 -DHAVE_HEADER_STRING_H=2 -DHAVE_HEADER_INCLUDE_MKC_TEST_H=1 -DSIZEOF_INT=n -DSIZEOF_LONG_LONG=n -DSIZEOF_VOIDP=n -DSIZEOF_SIZE_T_STRING_H=n -DHAVE_DEFINE___BAD_DEFINE__=1 -DHAVE_DEFINE_MKC_TEST_DEFINE_INCLUDE_MKC_TEST_H=1 -DHAVE_TYPE_SIZE_T_STRING_H=1 -DHAVE_TYPE_BAD_TYPE=1 -DHAVE_VAR_ERRNO_ERRNO_H=1 -DHAVE_VAR_MKC_TEST_VAR_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_TM_TM_ISDST_TIME_H=1 -DHAVE_MEMBER_STRUCT_SOCKADDR_IN_SIN_ADDR_S_ADDR_ARPA_INET_H_NETINET_IN_H=1 -DHAVE_MEMBER_BAD_MEMBER=1 -DHAVE_MEMBER_BAD_MEMBER_STRING_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_A_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_B_C_INCLUDE_MKC_TEST_H=1 -DHAVE_FUNC2_STRCMP_STRING_H=1 -DHAVE_FUNC3_STRCPY=1 -DHAVE_FUNC5_MKC_TEST_FUNC_INCLUDE_MKC_TEST_H=1 -DCUSTOM_CUSTOM_CHECK2=1 -MKC_AUTO_SRCS=superfunc1.c superfunc2.c +MKC_AUTO_CFLAGS= -DHAVE_HEADER_SYS_TIME_H=2 -DHAVE_HEADER_STRING_H=2 -DHAVE_HEADER_INCLUDE_MKC_TEST_H=1 -DSIZEOF_INT=n -DSIZEOF_LONG_LONG=n -DSIZEOF_VOIDP=n -DSIZEOF_SIZE_T_STRING_H=n -DHAVE_DEFINE___BAD_DEFINE__=1 -DHAVE_DEFINE_MKC_TEST_DEFINE_INCLUDE_MKC_TEST_H=1 -DHAVE_TYPE_SIZE_T_STRING_H=1 -DHAVE_TYPE_BAD_TYPE=1 -DHAVE_VAR_ERRNO_ERRNO_H=1 -DHAVE_VAR_MKC_TEST_VAR_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_TM_TM_ISDST_TIME_H=1 -DHAVE_MEMBER_STRUCT_SOCKADDR_IN_SIN_ADDR_S_ADDR_ARPA_INET_H_NETINET_IN_H=1 -DHAVE_MEMBER_BAD_MEMBER=1 -DHAVE_MEMBER_BAD_MEMBER_STRING_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_A_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_B_C_INCLUDE_MKC_TEST_H=1 -DHAVE_FUNC2_STRCMP_STRING_H=1 -DHAVE_FUNC3_STRCPY=1 -DHAVE_FUNC5_MKC_TEST_FUNC_INCLUDE_MKC_TEST_H=1 -DCUSTOM_CUSTOM_CHECK2=1 -DHAVE_PROTOTYPE_STRCMP_BAD=1 +MKC_AUTO_SRCS= superfunc1.c superfunc2.c MKC_AUTO_LDADD= KNOWN_SYSTEM diff --git a/tests/configure_test/mkc_test.mk b/tests/configure_test/mkc_test.mk index ab04982..3a09220 100644 --- a/tests/configure_test/mkc_test.mk +++ b/tests/configure_test/mkc_test.mk @@ -77,6 +77,12 @@ MKC_CUSTOM_FN.custom_check2= my_check2.c MKC_REQUIRE_CUSTOM+= custom_check3 +MKC_CHECK_PROTOTYPES = strcmp_ok strcmp_bad +MKC_PROTOTYPE_FUNC.strcmp_ok = int strcmp(const char*, const char*) +MKC_PROTOTYPE_FUNC.strcmp_bad = int strcmp(const char*, const char*, int lalala) +MKC_PROTOTYPE_HEADERS.strcmp_ok = string.h +MKC_PROTOTYPE_HEADERS.strcmp_bad = string.h + vars+= HAVE_HEADER.sys_time_h HAVE_HEADER.string_h \ HAVE_FUNCLIB.strcpy HAVE_FUNCLIB.sqrt \ HAVE_FUNC2.strcmp.string_h HAVE_FUNC3.strcpy \ @@ -99,6 +105,7 @@ vars+= HAVE_HEADER.sys_time_h HAVE_HEADER.string_h \ HAVE_VAR.mkc_test_var.include_mkc_test_h \ HAVE_MEMBER.struct_mkc_test_t_a.include_mkc_test_h \ HAVE_MEMBER.struct_mkc_test_t_b_c.include_mkc_test_h \ + HAVE_PROTOTYPE.strcmp_ok HAVE_PROTOTYPE.strcmp_bad \ \ CUSTOM.custom_check1 CUSTOM.custom_check2 \ \ @@ -110,10 +117,6 @@ vars+= HAVE_HEADER.sys_time_h HAVE_HEADER.string_h \ .include <mkc.configure.mk> -MKC_AUTO_SRCS:= ${MKC_SRCS} -MKC_AUTO_CFLAGS:= ${MKC_CFLAGS} -MKC_AUTO_LDADD:= ${MKC_LDADD} - HAVE_MEMBER.struct_sockaddr_in_sin_addr_s_addr.netinet_in_h ?= \ ${HAVE_MEMBER.struct_sockaddr_in_sin_addr_s_addr.arpa_inet_h.netinet_in_h} @@ -125,7 +128,8 @@ all: .for i in ${vars} @echo ${i}=${${i}} | \ sed -e 's|\([^ ]*SIZEOF[^ =]*\)=[0-9][0-9]*|\1=n|g' \ - -e 's|\([^ ]*PROG[^ =]*\)=[^ =]*bin/|\1=/somewhere/bin/|g' + -e 's|\([^ ]*PROG[^ =]*\)=[^ =]*bin/|\1=/somewhere/bin/|g' \ + -e '/^MKC_AUTO_SRCS=/ s|/[^ ]*/||g' .endfor @echo '' @printf "%s\n" "${CPPFLAGS}" | \ diff --git a/tests/configure_test/mkc_test_preset.mk b/tests/configure_test/mkc_test_preset.mk index 6e43bb3..ec381a8 100644 --- a/tests/configure_test/mkc_test_preset.mk +++ b/tests/configure_test/mkc_test_preset.mk @@ -20,3 +20,5 @@ CUSTOM.custom_check1=0 CUSTOM.custom_check2=1 PROG.awk= PROG.megaprog-x34=/bad/path +HAVE_PROTOTYPE.strcmp_ok=0 +HAVE_PROTOTYPE.strcmp_bad=1 diff --git a/tests/create_cachedir/Makefile b/tests/create_cachedir/Makefile new file mode 100644 index 0000000..74abaa5 --- /dev/null +++ b/tests/create_cachedir/Makefile @@ -0,0 +1,8 @@ +PROG = hello + +MKC_CHECK_HEADERS = string.h + +CLEANFILES += ${.OBJDIR}/${.CURDIR:T}.test.out + +.include "test.mk" +.include <mkc.prog.mk> diff --git a/tests/create_cachedir/expect.out b/tests/create_cachedir/expect.out new file mode 100644 index 0000000..bfd8cd9 --- /dev/null +++ b/tests/create_cachedir/expect.out @@ -0,0 +1,2 @@ +checking for header string.h... yes +cache file exists diff --git a/tests/create_cachedir/hello.c b/tests/create_cachedir/hello.c new file mode 100644 index 0000000..b8327a7 --- /dev/null +++ b/tests/create_cachedir/hello.c @@ -0,0 +1,5 @@ +int main (int argc, char ** argv) +{ + /* just a test */ + return 0; +} diff --git a/tests/create_cachedir/test.mk b/tests/create_cachedir/test.mk new file mode 100644 index 0000000..cdd989e --- /dev/null +++ b/tests/create_cachedir/test.mk @@ -0,0 +1,22 @@ +TEST_MKC_CACHEDIR = ${.CURDIR}/.cache +CLEANFILES += ${.OBJDIR}/${.CURDIR:T}.test.out ${TEST_MKC_CACHEDIR} +CLEANDIRS += ${TEST_MKC_CACHEDIR} + +.PHONY : test_output +test_output: + @echo 'Testing ${.CURDIR}... ' 1>&2; \ + tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \ + rm -rf $$tmp_out ${TEST_MKC_CACHEDIR}; \ + ${MAKE} ${MAKEFLAGS} errorcheck MKC_CACHEDIR=${TEST_MKC_CACHEDIR} 2>&1 | \ + grep 'checking.*header' ;\ + if test -f ${TEST_MKC_CACHEDIR}/_mkc_header_string_h.c; then \ + echo cache file exists; \ + else \ + echo cache file does not exist; \ + fi \ + ; \ + ${MAKE} ${MAKEFLAGS} cleandir 2>/dev/null 1>&2 + +# rm -rf $$MKC_CACHEDIR; \ + +.include <mkc.minitest.mk> diff --git a/tests/endianess/Makefile b/tests/endianess/Makefile new file mode 100644 index 0000000..958a2e4 --- /dev/null +++ b/tests/endianess/Makefile @@ -0,0 +1,14 @@ +# this is a backward compatibility test for endianess (single n) + +MKC_CHECK_BUILTINS += endianess + +MKC_REQD = 0.12.0 + +.include <mkc.configure.mk> + +.PHONY: showme +showme: + @echo BUILTIN.endianess=${BUILTIN.endianess} + +.include "test.mk" +.include <mkc.prog.mk> diff --git a/tests/endianess/expect.out b/tests/endianess/expect.out new file mode 100644 index 0000000..ab508f5 --- /dev/null +++ b/tests/endianess/expect.out @@ -0,0 +1,3 @@ +=========== all ============ +warning: "endianess test deprecated; use endianness instead" +BUILTIN.endianess=big diff --git a/tests/endianess/test.mk b/tests/endianess/test.mk new file mode 100644 index 0000000..26d9005 --- /dev/null +++ b/tests/endianess/test.mk @@ -0,0 +1,12 @@ +CLEANDIRS += ${.CURDIR}/testdir + +.PHONY : test_output +test_output: + @set -e; \ + \ + echo =========== all ============; \ + ${MAKE} ${MAKEFLAGS} showme 2>&1 | \ + sed -e 's,^.*warning:,warning:,' -e 's,little,big,'; \ + ${MAKE} ${MAKEFLAGS} distclean > /dev/null + +.include <mkc.minitest.mk> diff --git a/tests/mkinstall/test.mk b/tests/mkinstall/test.mk index 4f86b05..d3af118 100644 --- a/tests/mkinstall/test.mk +++ b/tests/mkinstall/test.mk @@ -11,7 +11,7 @@ test_output : \ echo ===== all SHRTOUT=yes ======; \ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \ - env SHRTOUT=YES ${MAKE} ${MAKEFLAGS} all 2>&1 | \ + env ${MAKE} ${MAKEFLAGS} SHRTOUT=YES all 2>&1 | \ mkc_test_helper_paths; \ \ echo ========= installdirs MKINSTALL=no ==========; \ diff --git a/tests/pkg_config_1_1/Makefile b/tests/pkg_config_1_1/Makefile new file mode 100644 index 0000000..203f131 --- /dev/null +++ b/tests/pkg_config_1_1/Makefile @@ -0,0 +1,7 @@ +# The same as pkg_config_1 but with diferent variable +LIB= mkc_fake + +MKC_REQUIRE_PKGCONFIG= mkc_fake-2.0>=2.10 + +.include "test.mk" +.include <mkc.lib.mk> diff --git a/tests/pkg_config_1_1/test.mk b/tests/pkg_config_1_1/test.mk new file mode 100644 index 0000000..6fe834c --- /dev/null +++ b/tests/pkg_config_1_1/test.mk @@ -0,0 +1,14 @@ +test: + @echo 'Testing ${.CURDIR}... ' 1>&2; \ + set -e; cd ${.CURDIR}; \ + tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \ + rm -f $$tmp_out; \ + ${MAKE} ${MAKEFLAGS} all 2>&1 | grep ERROR: > $$tmp_out || true; \ + if test -s $$tmp_out; \ + then echo ' succeeded' 1>&2; \ + else echo ' FAILED' 1>&2; ex=1; \ + fi; \ + ${MAKE} ${MAKEFLAGS} cleandir 2>&1 | grep ERROR: > $$tmp_out || true; \ + exit $$ex + +CLEANFILES += ${.OBJDIR}/${.CURDIR:T}.test.out diff --git a/tests/rec_makefiles/Makefile.rec b/tests/rec_makefiles/Makefile.common index 54e194e..b919dc5 100644 --- a/tests/rec_makefiles/Makefile.rec +++ b/tests/rec_makefiles/Makefile.common @@ -6,3 +6,6 @@ print-values: .endfor A=1 +B=2 +C=3 +D=4 diff --git a/tests/rec_makefiles/expect.out b/tests/rec_makefiles/expect.out index 2690df1..d2f1d8e 100644 --- a/tests/rec_makefiles/expect.out +++ b/tests/rec_makefiles/expect.out @@ -1,15 +1,15 @@ =========== subsubdir1 ============= A=1 -B=333 -C= -D= +B=2 +C=3 +D=4 =========== subsubdir2 ============= A=1 B=2 C=3 -D= +D=4 =========== prj2 ============= A=1 -B= -C= +B=2 +C=3 D=4 diff --git a/tests/rec_makefiles/subdir1/Makefile.rec b/tests/rec_makefiles/subdir1/Makefile.rec deleted file mode 100644 index ac5d589..0000000 --- a/tests/rec_makefiles/subdir1/Makefile.rec +++ /dev/null @@ -1 +0,0 @@ -B=2 diff --git a/tests/rec_makefiles/subdir1/subsubdir1/Makefile.rec b/tests/rec_makefiles/subdir1/subsubdir1/Makefile.rec deleted file mode 100644 index 0ad6340..0000000 --- a/tests/rec_makefiles/subdir1/subsubdir1/Makefile.rec +++ /dev/null @@ -1 +0,0 @@ -B=333 diff --git a/tests/rec_makefiles/subdir1/subsubdir2/Makefile.rec b/tests/rec_makefiles/subdir1/subsubdir2/Makefile.rec deleted file mode 100644 index 40b10c5..0000000 --- a/tests/rec_makefiles/subdir1/subsubdir2/Makefile.rec +++ /dev/null @@ -1 +0,0 @@ -C=3 diff --git a/tests/rec_makefiles/subdir2/Makefile.rec b/tests/rec_makefiles/subdir2/Makefile.rec deleted file mode 100644 index 1d13f5a..0000000 --- a/tests/rec_makefiles/subdir2/Makefile.rec +++ /dev/null @@ -1 +0,0 @@ -D=4 diff --git a/tests/rec_makefiles/test.mk b/tests/rec_makefiles/test.mk index cd3ed8f..a9ff6c8 100644 --- a/tests/rec_makefiles/test.mk +++ b/tests/rec_makefiles/test.mk @@ -1,7 +1,9 @@ .PHONY : test test: - set -e; env VERBOSE_ECHO=: ${MAKE} all >${.OBJDIR}/_output.tmp; \ - if diff ${.CURDIR}/expect.out ${.OBJDIR}/_output.tmp; \ + set -e; \ + env SRCTOP=${.CURDIR} VERBOSE_ECHO=: \ + ${MAKE} ${MAKEFLAGS} all > ${.OBJDIR}/_output.tmp; \ + if cmp ${.CURDIR}/expect.out ${.OBJDIR}/_output.tmp; \ then echo ' succeeded' 1>&2; \ else echo ' FAILED' 1>&2; false; \ fi diff --git a/tests/reqd/expect.out b/tests/reqd/expect.out index 4c34049..c5cf415 100644 --- a/tests/reqd/expect.out +++ b/tests/reqd/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.25.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.26.0 is detected diff --git a/tests/reqd2/expect.out b/tests/reqd2/expect.out index 4c34049..c5cf415 100644 --- a/tests/reqd2/expect.out +++ b/tests/reqd2/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.25.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.26.0 is detected diff --git a/tests/reqd3/expect.out b/tests/reqd3/expect.out index 4c34049..c5cf415 100644 --- a/tests/reqd3/expect.out +++ b/tests/reqd3/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.25.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.26.0 is detected diff --git a/tests/reqd4/expect.out b/tests/reqd4/expect.out index 8df812e..29fe3b6 100644 --- a/tests/reqd4/expect.out +++ b/tests/reqd4/expect.out @@ -1,4 +1,4 @@ -ERROR: We need mk-configure v.999.0.0 while 0.25.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.26.0 is detected "bmake-20110606 or newer is required" =========== all ============ /objdir/Makefile diff --git a/tests/reqd_clean_cache/Makefile b/tests/reqd_clean_cache/Makefile index 04ea2e9..bbbabe2 100644 --- a/tests/reqd_clean_cache/Makefile +++ b/tests/reqd_clean_cache/Makefile @@ -10,5 +10,9 @@ MKC_REQUIRE_FUNCS3 = brbrbr MKC_REQUIRE_CUSTOM = test1 MKC_CUSTOM_FN.test1 = test1.c +MKC_REQUIRE_PROTOTYPES = bad999 +MKC_PROTOTYPE_HEADERS.bad999 = bad_include.h +MKC_PROTOTYPE_FUNC.bad999 = void badfunc999(void) + .include "test.mk" .include <mkc.mk> diff --git a/tests/reqd_clean_cache/expect.out b/tests/reqd_clean_cache/expect.out index 877cecc..bd1e169 100644 --- a/tests/reqd_clean_cache/expect.out +++ b/tests/reqd_clean_cache/expect.out @@ -16,6 +16,7 @@ ERROR: cannot find declaration of function brbrbr ERROR: custom test test1 failed ERROR: cannot find program trtrtr ERROR: cannot find program brbrbr +ERROR: prototype test bad999 failed *** Error code 1 Stop. diff --git a/tests/reqd_clean_cache/test.mk b/tests/reqd_clean_cache/test.mk index e5cea19..92c35c3 100644 --- a/tests/reqd_clean_cache/test.mk +++ b/tests/reqd_clean_cache/test.mk @@ -7,6 +7,7 @@ test_output : echo =========== all ============; \ { ${MAKE} ${MAKEFLAGS} all 2>/dev/null || true; \ find ${.OBJDIR} -type f -o -type l | sort; } | \ + sed 's,bmake\[[0-9]*\],bmake,' | \ env NOSORT=1 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null diff --git a/tests/require_prototype/Makefile b/tests/require_prototype/Makefile new file mode 100644 index 0000000..bdcf340 --- /dev/null +++ b/tests/require_prototype/Makefile @@ -0,0 +1,14 @@ +CLEANFILES += ${.OBJDIR}/${.CURDIR:T}.test.out + +test: + @echo 'Testing ${.CURDIR}... ' 1>&2; \ + set -e; \ + tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \ + rm -f $$tmp_out; \ + ${MAKE} ${MAKEFLAGS} -f ${.CURDIR}/test.mk cleandir >/dev/null 2>&1; \ + ${MAKE} ${MAKEFLAGS} -f ${.CURDIR}/test.mk all > $$tmp_out 2>&1; \ + diff ${.CURDIR}/expect.out $$tmp_out && \ + echo ' succeeded' 1>&2 || \ + { echo ' FAILED' 1>&2; false; } + +.include <mkc.subprj.mk> diff --git a/tests/require_prototype/expect.out b/tests/require_prototype/expect.out new file mode 100644 index 0000000..40bb8b4 --- /dev/null +++ b/tests/require_prototype/expect.out @@ -0,0 +1 @@ +checking for prototype pid_t fork(void) ( unistd.h unistd.h )... yes diff --git a/tests/require_prototype/test.mk b/tests/require_prototype/test.mk new file mode 100644 index 0000000..d8fa02e --- /dev/null +++ b/tests/require_prototype/test.mk @@ -0,0 +1,5 @@ +MKC_REQUIRE_PROTOTYPES = fork +MKC_PROTOTYPE_HEADERS.fork = unistd.h unistd.h # intentionally double! +MKC_PROTOTYPE_FUNC.fork = pid_t fork (void) + +.include <mkc.prog.mk> diff --git a/tests/sys_queue/Makefile b/tests/sys_queue/Makefile new file mode 100644 index 0000000..b50aa77 --- /dev/null +++ b/tests/sys_queue/Makefile @@ -0,0 +1,11 @@ +PROG = hello +SRCS = hello.c + +WARNS = 4 + +MKC_FEATURES = CIRCLEQ LIST SIMPLEQ SLIST STAILQ TAILQ + +MKC_REQD = 0.26.0 + +test: all +.include <mkc.prog.mk> diff --git a/tests/sys_queue/hello.c b/tests/sys_queue/hello.c new file mode 100644 index 0000000..dbdae31 --- /dev/null +++ b/tests/sys_queue/hello.c @@ -0,0 +1,17 @@ +#include <mkc_CIRCLEQ.h> +#include <mkc_LIST.h> +#include <mkc_SIMPLEQ.h> +#include <mkc_SLIST.h> +#include <mkc_STAILQ.h> +#include <mkc_TAILQ.h> + +#if !defined(CIRCLEQ_ENTRY) || !defined(LIST_ENTRY) || \ + !defined(SIMPLEQ_ENTRY) || !defined(SLIST_ENTRY) || \ + !defined(STAILQ_ENTRY) || !defined(TAILQ_ENTRY) +#error "mk-configure bug!!!" +#endif + +int main (int argc, char ** argv) +{ + return 0; +} diff --git a/tests/test_subprj_dash/Makefile b/tests/test_subprj_dash/Makefile index 532832d..f518e28 100644 --- a/tests/test_subprj_dash/Makefile +++ b/tests/test_subprj_dash/Makefile @@ -6,6 +6,7 @@ test: tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \ rm -f $$tmp_out; \ ${MAKE} ${MAKEFLAGS} -f ${.CURDIR}/test.mk all 2>&1 | \ + sed 's,bmake\[[0-9]*\],bmake,' | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}" > $$tmp_out; \ diff ${.CURDIR}/expect.out $$tmp_out && \ echo ' succeeded' 1>&2 || \ |