diff options
author | midipix <writeonce@midipix.org> | 2021-04-25 00:31:34 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2021-04-25 12:14:42 +0000 |
commit | dbacce68e21596226cc84c19185662fb80004636 (patch) | |
tree | 869490e931a2f1a9107a6c8e55e1d9d833a349bf | |
parent | e9d7b2bd668d0450ad1c04262dd2f22a4a5011e9 (diff) | |
download | sbmake-dbacce68e21596226cc84c19185662fb80004636.tar.bz2 sbmake-dbacce68e21596226cc84c19185662fb80004636.tar.xz |
project: config-time tests: initial implementation.
-rw-r--r-- | project/config/cfgdefs.in | 0 | ||||
-rw-r--r-- | project/config/cfgdefs.sh | 97 |
2 files changed, 97 insertions, 0 deletions
diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/project/config/cfgdefs.in 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 |