From dbacce68e21596226cc84c19185662fb80004636 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 25 Apr 2021 00:31:34 +0000 Subject: project: config-time tests: initial implementation. --- project/config/cfgdefs.in | 0 project/config/cfgdefs.sh | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 project/config/cfgdefs.in (limited to 'project/config') diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in new file mode 100644 index 0000000..e69de29 diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index 8400b6a..22b94c3 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -10,6 +10,11 @@ # finally, cfgdefs.sh may update the contents of the # config-time generated cfgdefs.mk. + +# sofort's config test framework +. "$mb_project_dir/sofort/cfgtest/cfgtest.sh" + + for arg ; do case "$arg" in *) @@ -81,8 +86,100 @@ cfgdefs_bootstrap() cfgdefs_bootstrap_done='yes' } + +cfgdefs_output_custom_defs() +{ + cat "$mb_project_dir/project/config/cfgdefs.in" > cfgdefs.mk +} + + +cfgdefs_perform_utility_tests() +{ + # utility settings + cfgtest_comment 'utility settings' + + mb_cfgtest_makevar='SYS_MK_DIR' + cfgtest_makevar_append '$(DATADIR)/mk' + cfgtest_cflags_append '-D_PATH_DEFSYSPATH=\"$(SYS_MK_DIR)\"' + + cfgtest_newline +} + + +cfgdefs_perform_common_tests() +{ + # interfaces + mb_cfgtest_headers='stdio.h' + cfgtest_interface_presence 'vsnprintf' + + mb_cfgtest_headers='string.h' + cfgtest_interface_presence 'strerror' + + mb_cfgtest_headers='sys/types.h unistd.h' + cfgtest_interface_presence 'setpgid' + + mb_cfgtest_headers='sys/time.h sys/resource.h' + cfgtest_interface_presence 'setrlimit' + + mb_cfgtest_headers='stdlib.h' + cfgtest_interface_presence 'setenv' + + cfgtest_newline +} + + +cfgdefs_perform_native_tests() +{ + # init + cfgtest_newline + cfgtest_native_section + + # common tests + cfgdefs_perform_common_tests + + # pretty cfgdefs.mk + cfgtest_newline +} + +cfgdefs_perform_target_tests() +{ + # init + cfgtest_newline + cfgtest_host_section + + # common tests + cfgdefs_perform_common_tests + + # utility tests + cfgdefs_perform_utility_tests + + # pretty cfgdefs.mk + cfgtest_newline +} + +# cfgdefs.in --> cfgdefs.mk +cfgdefs_output_custom_defs + +# strict: some tests might fail +set +e + +# bootstrapping cflags +cfgdefs_perform_native_tests + +# strict: restore mode +set -e + # bootstrap cfgdefs_bootstrap +# strict: some tests might fail +set +e + +# target-specific tests +cfgdefs_perform_target_tests + +# strict: restore mode +set -e + # all done return 0 -- cgit v1.2.3