shared=
static=
version=0.6.9
-clang=
+mode_compiler_param="-m"
+mode_compiler_value="gcc"
mode_part=
mode_parameter=
mode_path=
elif [[ ${p} == "--disable-shared" ]] ; then
shared="--disable-shared"
elif [[ ${p} == "clang" ]] ; then
- clang="-m clang"
+ mode_compiler_value="clang"
elif [[ ${p} == "-w" || ${p} == "--work" ]] ; then
let i++
${shell_command} ./bootstrap.sh clean ${verbose} ${color} ${suppress_first} &&
- ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m individual -m individual_thread ${mode_thread_param} ${mode_thread_value} ${clang} &&
+ ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m individual -m individual_thread ${mode_thread_param} ${mode_thread_value} ${mode_compiler_param} ${mode_compiler_value} &&
${shell_command} ./install.sh ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} &&
${shell_command} ./bootstrap.sh clean ${verbose} ${color} ${suppress_first} &&
- ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m level ${mode_thread_param} ${mode_thread_value} ${clang} &&
+ ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m level ${mode_thread_param} ${mode_thread_value} ${mode_compiler_param} ${mode_compiler_value} &&
${shell_command} ./install.sh ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} &&
${shell_command} ./bootstrap.sh clean ${verbose} ${color} ${suppress_first} &&
- ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m level ${mode_thread_param} ${mode_thread_value} &&
+ ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m level ${mode_thread_param} ${mode_thread_value} ${mode_compiler_param} ${mode_compiler_value} &&
${shell_command} ./install.sh ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} &&
${shell_command} ./bootstrap.sh clean ${verbose} ${color} ${suppress_first} &&
- ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m level ${mode_thread_param} ${mode_thread_value} &&
+ ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m level ${mode_thread_param} ${mode_thread_value} ${mode_compiler_param} ${mode_compiler_value} &&
${shell_command} ./install.sh ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work}
fi
${shell_command} ./bootstrap.sh clean ${verbose} ${color} ${suppress_first} &&
- ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m monolithic ${mode_thread_param} ${mode_thread_value} ${clang} &&
+ ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m monolithic ${mode_thread_param} ${mode_thread_value} ${mode_compiler_param} ${mode_compiler_value} &&
${shell_command} ./install.sh ${verbose} ${color} ${shared} ${suppress_first} ${static} -w ${path_work}
fi
${shell_command} ./bootstrap.sh clean ${verbose} ${color} ${suppress_first} &&
- ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m ${build_mode} ${build_mode_extra_param_1} ${build_mode_extra_value_1} ${build_mode_extra_param_2} ${build_mode_extra_value_2} &&
+ ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m ${build_mode} ${build_mode_extra_param_1} ${build_mode_extra_value_1} ${build_mode_extra_param_2} ${build_mode_extra_value_2} ${mode_compiler_param} ${mode_compiler_value} &&
${shell_command} ./install.sh ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work}
${shell_command} ./bootstrap.sh clean ${verbose} ${color} ${suppress_first} &&
- ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m ${build_mode} ${build_mode_extra_param_1} ${build_mode_extra_value_1} ${build_mode_extra_param_2} ${build_mode_extra_value_2} &&
+ ${shell_command} ./bootstrap.sh build ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} -m ${build_mode} ${build_mode_extra_param_1} ${build_mode_extra_value_1} ${build_mode_extra_param_2} ${build_mode_extra_value_2} ${mode_compiler_param} ${mode_compiler_value} &&
${shell_command} ./install.sh ${verbose} ${color} ${suppress_first} ${shared} ${static} -w ${path_work} ||
local path_scripts_package=${path_scripts}package.sh
local path_test=${PWD}/test/
local path_test_package=${path_test}package/
- local path_test_project=${path_test}project/
- local path_test_work=${path_test}work/
local path_test_package_individual=${path_test_package}individual/
+ local path_test_package_program=${path_test_package}program/
local path_test_package_stand_alone=${path_test_package}stand_alone/
+ local path_test_project=${path_test}project/
+ local path_test_work=${path_test}work/
local print_line_first="yes"
local print_line_last="yes"
local test_system=
local test_thread="thread"
- local test_thread_individual="thread_individual"
+ local test_thread_individual="individual_thread"
local context=
local failure=0
local projects="f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_path f_pipe f_print f_serialize f_signal f_socket f_status_string f_thread fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_print fl_signal fl_string fl_utf fl_utf_file fll_control_group fll_error fll_execute fll_file fll_fss fll_fss_status_string fll_iki fll_path fll_print fll_program fll_status_string"
local projects_no_tests="f_type"
+ local programs=""
if [[ $# -gt 0 ]] ; then
t=$#
path_test=
elif [[ ${p} == "-T" || ${p} == "--thread" ]] ; then
test_thread="thread"
- test_thread_individual="thread_individual"
+ test_thread_individual="individual_thread"
elif [[ ${p} == "-L" || ${p} == "--threadless" ]] ; then
test_thread="threadless"
- test_thread_individual=""
+ test_thread_individual=
elif [[ ${test_system} == "" ]] ; then
test_system="${p}"
else
path_test=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
path_test_package=${path_test}package/
path_test_package_individual=${path_test_package}individual/
+ path_test_package_program=${path_test_package}program/
path_test_package_stand_alone=${path_test_package}stand_alone/
path_test_project=${path_test}project/
path_test_work=${path_test}work/
ci_arguments="-d -I${includes_path} -d -L${libraries_path}"
test_operate_ci_prebuild
-
- if [[ ${?} -ne 0 ]] ; then
- let failure=1
-
- return 1
- fi
fi
- if [[ ${build_project} == "yes" ]] ; then
+ if [[ ${failure} -eq 0 && ${build_project} == "yes" ]] ; then
test_operate_build_tools
-
- if [[ ${?} -ne 0 ]] ; then
- let failure=1
-
- return 1
- fi
fi
- test_operate_build_individual
-
- if [[ ${?} -ne 0 ]] ; then
- let failure=1
-
- return 1
+ if [[ ${failure} -eq 0 ]] ; then
+ test_operate_build_individual
fi
- if [[ ${test_system} == "github" || ${test_system} == "gitlab" ]] ; then
- test_operate_ci_pretest
-
- if [[ ${?} -ne 0 ]] ; then
- let failure=1
+ if [[ ${failure} -eq 0 ]] ; then
+ test_operate_build_program
+ fi
- return 1
+ if [[ ${failure} -eq 0 ]] ; then
+ if [[ ${test_system} == "github" || ${test_system} == "gitlab" ]] ; then
+ test_operate_ci_pretest
fi
fi
- test_operate_tests
+ if [[ ${failure} -eq 0 ]] ; then
+ test_operate_tests
+ fi
- return $?
+ return ${failure}
}
test_operate_build_individual() {
if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
test_print_first_or_always
- echo -e "${c_highlight}Cleaning and building package.${c_reset}"
- echo -e "${c_title}------------------------------${c_reset}"
+ echo -e "${c_highlight}Cleaning and building individual package.${c_reset}"
+ echo -e "${c_title}-----------------------------------------${c_reset}"
echo
fi
echo -e "${c_error}ERROR: Failed to clean and build the individual packages.${c_reset}"
fi
+ let failure=1
+
return 1
fi
for project in ${projects} ; do
- test_operate_build_project "${path_test_package_individual}" "${path_test_work}" "${project}" individual ${test_thread} ${test_thread_individual}
+ test_operate_build_project "${path_test_package_individual}" "${path_test_work}" "${project}" individual "" ${test_thread} ${test_thread_individual}
if [[ ${?} -ne 0 ]] ; then
let failure=1
return 0
}
+test_operate_build_program() {
+ local program=
+ local path_original="${PWD}/"
+
+ if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
+ test_print_first_or_always
+
+ echo -e "${c_highlight}Cleaning and building program packages.${c_reset}"
+ echo -e "${c_title}---------------------------------------${c_reset}"
+ echo
+ fi
+
+ if [[ ${verbosity} == "debug" ]] ; then
+ test_print_first_or_always
+
+ echo "${shell_command} ${path_scripts_package} ${verbose} ${context} -d ${path_test_package} -p rebuild"
+ fi
+
+ ${shell_command} ${path_scripts_package} ${verbose} ${context} -d ${path_test_package} -p rebuild
+
+ if [[ ${?} -ne 0 ]] ; then
+ if [[ ${verbosity} != "quiet" ]] ; then
+ test_print_first
+
+ echo -e "${c_error}ERROR: Failed to clean and build the program packages.${c_reset}"
+ fi
+
+ let failure=1
+
+ return 1
+ fi
+
+ if [[ ${failure} -eq 1 ]] ; then
+ return 1
+ fi
+
+ return 0
+}
+
test_operate_build_project() {
local path_="${1}"
local destination="${2}"
echo -e "${c_error}ERROR: Package directory '${c_notice}${path_}${project}-${version}${c_error}' is invalid or missing.${c_reset}"
fi
+ let failure=1
+
return 1
fi
echo -e "${c_error}ERROR: Failed to clean and build the stand_alone fake package.${c_reset}"
fi
+ let failure=1
+
return 1
fi
}
test_operate_tests() {
- local project=
local path_original="${PWD}/"
local destination="${path_test_work}"
local thread_individual_param=
thread_individual_param="-m"
fi
- for project in ${projects} ; do
+ if [[ ${projects} != "" ]] ; then
+ test_operate_tests_projects
+ fi
- if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
+ if [[ ${failure} -eq 0 && ${programs} != "" ]] ; then
+ test_operate_tests_programs
+ fi
+
+ if [[ ${failure} -eq 1 ]] ; then
+ return 1
+ fi
+
+ return 0
+}
+
+test_operate_tests_change_to() {
+ local destination=${1}
+
+ if [[ ${failure} -eq 0 ]] ; then
+ if [[ ${verbosity} == "debug" ]] ; then
test_print_first_or_always
- echo -e "${c_highlight}Testing Project ${project}.${c_reset}"
- echo -e "${c_title}--------------------------------------${c_reset}"
- echo
+ echo -e "Running '${c_notice}cd ${destination}${c_reset}'."
fi
- if [[ ! -d ${path_test_package_individual}${project}-${version}/ ]] ; then
+ cd ${destination}
+
+ if [[ ${?} -ne 0 ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
test_print_first
- echo -e "${c_error}ERROR: Package directory '${c_notice}${path_test_package_individual}${project}-${version}${c_error}' is invalid or missing.${c_reset}"
+ echo -e "${c_error}ERROR: Failed to change into directory '${c_notice}${destination}${c_error}'.${c_reset}"
test_print_last
fi
let failure=1
fi
+ fi
+}
+
+test_operate_tests_name() {
+ local what=${1}
+ local name=${2}
+
+ if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
+ test_print_first_or_always
+
+ echo -e "${c_highlight}Testing ${what} ${name}.${c_reset}"
+ echo -e "${c_title}--------------------------------------${c_reset}"
+ echo
+ fi
+}
+
+test_operate_tests_path_exists() {
+ local what=${1}
+ local path_name=${2}
+
+ if [[ ! -d ${path_name}/ ]] ; then
+ if [[ ${verbosity} != "quiet" ]] ; then
+ test_print_first
+
+ echo -e "${c_error}ERROR: ${what} directory '${c_notice}${path_name}${c_error}' is invalid or missing.${c_reset}"
+
+ test_print_last
+ fi
+
+ let failure=1
+ fi
+}
+
+test_operate_tests_projects() {
+ local project=
+
+ for project in ${projects} ; do
+
+ test_operate_tests_name "Project" "${project}"
+
+ test_operate_tests_path_exists "Project" "${path_test_package_individual}${project}-${version}/"
if [[ ${failure} -eq 0 ]] ; then
if [[ ! -f ${path_test_package_individual}${project}-${version}/data/build/testfile ]] ; then
fi
fi
- if [[ ${failure} -eq 0 ]] ; then
- if [[ ${verbosity} == "debug" ]] ; then
- test_print_first_or_always
-
- echo -e "Running '${c_notice}cd ${path_test_package_individual}${project}-${version}/${c_reset}'."
- fi
+ test_operate_tests_change_to "${path_test_package_individual}${project}-${version}/"
- cd ${path_test_package_individual}${project}-${version}/
+ test_operate_tests_run "project" "${project}"
- if [[ ${?} -ne 0 ]] ; then
- if [[ ${verbosity} != "quiet" ]] ; then
- test_print_first
+ cd ${path_original}
- echo -e "${c_error}ERROR: Failed to change into directory '${c_notice}${path_test_package_individual}${project}-${version}${c_error}'.${c_reset}"
+ if [[ ${failure} -eq 1 ]] ; then
+ break;
+ fi
+ done
- test_print_last
- fi
+ if [[ ${failure} -eq 1 ]] ; then
+ return 1
+ fi
- let failure=1
- fi
- fi
+ return 0
+}
- if [[ ${failure} -eq 0 ]] ; then
- if [[ ${verbosity} == "debug" ]] ; then
- test_print_first_or_always
+test_operate_tests_programs() {
+ local program=
- if [[ ${build_compiler} == "gcc" ]] ; then
- echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m individual -m ${test_thread} ${thread_individual_param} ${thread_individual_value} -m test clean make -f testfile ${ci_arguments}"
- else
- echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m individual -m ${test_thread} ${thread_individual_param} ${thread_individual_value} -m test -m ${build_compiler} clean make -f testfile ${ci_arguments}"
- fi
- fi
+ for program in ${programs} ; do
- if [[ ${build_compiler} == "gcc" ]] ; then
- PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m individual -m ${test_thread} ${thread_individual_param} ${thread_individual_value} -m test clean make -f testfile ${ci_arguments}
- else
- PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m individual -m ${test_thread} ${thread_individual_param} ${thread_individual_value} -m test -m ${build_compiler} clean make -f testfile ${ci_arguments}
- fi
+ test_operate_tests_name "Program" "${program}"
- if [[ ${?} -ne 0 ]] ; then
- if [[ ${verbosity} != "quiet" ]] ; then
- test_print_first
+ test_operate_tests_path_exists "Program" "${path_test_package_program}${program}-${version}/"
- echo -e "${c_error}ERROR: Failure while testing project '${c_notice}${project}${c_reset}${c_error}'.${c_reset}"
+ if [[ ${failure} -eq 0 ]] ; then
+ if [[ ! -f ${path_test_package_program}${program}-${version}/data/build/testfile ]] ; then
+ if [[ ${verbosity} == "verbose" || ${verbosity} == "debug" ]] ; then
+ test_print_first_or_always
- test_print_last
+ echo -e "${c_warning}WARNING: Program '${c_notice}${program}${c_warning}' does not have a testfile.${c_reset}"
fi
- let failure=1
+ continue
fi
fi
+ test_operate_tests_change_to "${path_test_package_program}${program}-${version}/"
+
+ test_operate_tests_run "program" "${program}"
+
cd ${path_original}
if [[ ${failure} -eq 1 ]] ; then
return 0
}
+test_operate_tests_run() {
+ local what=${1}
+ local name=${2}
+
+ if [[ ${failure} -eq 0 ]] ; then
+ if [[ ${verbosity} == "debug" ]] ; then
+ test_print_first_or_always
+
+ if [[ ${build_compiler} == "gcc" ]] ; then
+ echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m individual -m ${test_thread} ${thread_individual_param} ${thread_individual_value} -m test clean make -f testfile ${ci_arguments}"
+ else
+ echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m individual -m ${test_thread} ${thread_individual_param} ${thread_individual_value} -m test -m ${build_compiler} clean make -f testfile ${ci_arguments}"
+ fi
+ fi
+
+ if [[ ${build_compiler} == "gcc" ]] ; then
+ PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m individual -m ${test_thread} ${thread_individual_param} ${thread_individual_value} -m test clean make -f testfile ${ci_arguments}
+ else
+ PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m individual -m ${test_thread} ${thread_individual_param} ${thread_individual_value} -m test -m ${build_compiler} clean make -f testfile ${ci_arguments}
+ fi
+
+ if [[ ${?} -ne 0 ]] ; then
+ if [[ ${verbosity} != "quiet" ]] ; then
+ test_print_first
+
+ echo -e "${c_error}ERROR: Failure while testing ${what} '${c_notice}${name}${c_reset}${c_error}'.${c_reset}"
+
+ test_print_last
+ fi
+
+ let failure=1
+ fi
+ fi
+}
+
test_print_first() {
if [[ ${print_line_first} == "yes" ]] ; then
unset test_operate_ci_pretest
unset test_operate_ci_pretest_cmocka
unset test_operate_tests
+ unset test_operate_tests_change_to
+ unset test_operate_tests_name
+ unset test_operate_tests_path_exists
+ unset test_operate_tests_projects
+ unset test_operate_tests_programs
+ unset test_operate_tests_run
unset test_print_first
unset test_print_first_or_always
unset test_print_last