]> Kevux Git Server - fll/commitdiff
Feature: Add support for debug mode in test script.
authorKevin Day <Kevin@kevux.org>
Tue, 13 Jan 2026 02:11:04 +0000 (20:11 -0600)
committerKevin Day <Kevin@kevux.org>
Tue, 13 Jan 2026 02:11:04 +0000 (20:11 -0600)
The test script should also support the debug mode.
This is not to be confused with running the build process in debug mode itself (the `+D` / `++debug` setting).

build/scripts/test.sh

index c0ee9a76fb9577832d757ae474822ed99d4c5898..1cf7cc0119b83d9f8e0203007ab80e5ab2f6d014 100644 (file)
@@ -49,6 +49,8 @@ test_main() {
   local build_compiler=
   local build_project=no
   local build_project_thread="thread"
+  local mode_debug_param=
+  local mode_debug_value=
   local path_scripts=${PWD}/build/scripts/
   local path_scripts_package=${path_scripts}package.sh
   local path_test=${PWD}/test/
@@ -139,6 +141,9 @@ test_main() {
         elif [[ ${p} == "-t" || ${p} == "--path_test" ]] ; then
           grab_next=path_test
           path_test=
+        elif [[ ${p} == "-D" || ${p} == "--debug_mode" ]] ; then
+          mode_debug_param="-m"
+          mode_debug_value="debug"
         elif [[ ${p} == "-T" || ${p} == "--thread" ]] ; then
           test_thread="thread"
           test_thread_individual="individual_thread"
@@ -348,6 +353,7 @@ test_help() {
   echo
   echo -e " -${c_important}a${c_reset}, --${c_important}analyze${c_reset}       Perform analyzation on during tests (using fanalyzer mode)."
   echo -e " -${c_important}c${c_reset}, --${c_important}compiler${c_reset}      Specify the compiler, either gcc (default) or clang."
+  echo -e " -${c_important}D${c_reset}, --${c_important}debug_mode${c_reset}    Build packages with the debug mode passed to the build system (different from +d/++debug)."
   echo -e " -${c_important}p${c_reset}, --${c_important}project${c_reset}       Designate that the project files must also be built."
   echo -e " -${c_important}s${c_reset}, --${c_important}path_scripts${c_reset}  Specify a custom directory where the build scripts are found."
   echo -e " -${c_important}t${c_reset}, --${c_important}path_test${c_reset}     Specify a custom directory where the test environment is found."
@@ -544,45 +550,45 @@ test_operate_build_project() {
   if [[ ${bootstrap} == "" ]] ; then
     if [[ ${verbosity} == "debug" ]] ; then
       if [[ ${build_compiler} == "gcc" ]] ; then
-        echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} clean build ${ci_arguments}"
+        echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} clean build ${ci_arguments}"
       else
-        echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_thread_param} ${mode_thread_value} -m ${build_compiler} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} clean make -f testfile ${ci_arguments}"
+        echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} -m ${build_compiler} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -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 ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} clean build ${ci_arguments}
+      PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} clean build ${ci_arguments}
     else
-      PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} clean build ${ci_arguments}
+      PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} clean build ${ci_arguments}
     fi
   else
     if [[ ${SHELL_ENGINE} == "zsh" ]] ; then
       if [[ ${verbosity} == "debug" ]] ; then
         if [[ ${build_compiler} == "gcc" ]] ; then
-          echo "zsh ./bootstrap.sh ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} build"
+          echo "zsh ./bootstrap.sh ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} build"
         else
-          echo "zsh ./bootstrap.sh ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} build"
+          echo "zsh ./bootstrap.sh ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} build"
         fi
       fi
 
       if [[ ${build_compiler} == "gcc" ]] ; then
-        zsh ./bootstrap.sh ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} build
+        zsh ./bootstrap.sh ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} build
       else
-        zsh ./bootstrap.sh ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} build
+        zsh ./bootstrap.sh ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} build
       fi
     else
       if [[ ${verbosity} == "debug" ]] ; then
         if [[ ${build_compiler} == "gcc" ]] ; then
-          echo "./bootstrap.sh ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_thread_individual_param} ${mode_thread_individual_value} ${mode_thread_param} ${mode_thread_value} -m test ${analyze_flag} ${analyze_value} build"
+          echo "./bootstrap.sh ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_individual_param} ${mode_thread_individual_value} ${mode_thread_param} ${mode_thread_value} -m test ${analyze_flag} ${analyze_value} build"
         else
-          echo "./bootstrap.sh ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_thread_individual_param} ${mode_thread_individual_value} ${mode_thread_param} ${mode_thread_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} build"
+          echo "./bootstrap.sh ${verbose} ${context} -w \"${destination}\" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_individual_param} ${mode_thread_individual_value} ${mode_thread_param} ${mode_thread_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} build"
         fi
       fi
 
       if [[ ${build_compiler} == "gcc" ]] ; then
-        ./bootstrap.sh ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} build
+        ./bootstrap.sh ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} build
       else
-        ./bootstrap.sh ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} build
+        ./bootstrap.sh ${verbose} ${context} -w "${destination}" -m ${mode} ${mode_debug_param} ${mode_debug_value} ${mode_thread_param} ${mode_thread_value} ${mode_thread_individual_param} ${mode_thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} build
       fi
     fi
   fi
@@ -815,10 +821,10 @@ test_operate_ci_pretest_cmocka() {
   fi
 
   if [[ ${verbosity} == "debug" ]] ; then
-    echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${path_test_work}\" -m ${build_compiler} -m ${test_thread} clean build ${ci_arguments}"
+    echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${path_test_work}\" -m ${build_compiler} -m ${test_thread} ${mode_debug_param} ${mode_debug_value} clean build ${ci_arguments}"
   fi
 
-  PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${path_test_work}" -m ${build_compiler} -m ${test_thread} clean build ${ci_arguments}
+  PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${path_test_work}" -m ${build_compiler} -m ${test_thread} ${mode_debug_param} ${mode_debug_value} clean build ${ci_arguments}
 
   if [[ ${?} -ne 0 ]] ; then
     if [[ ${verbosity} != "quiet" ]] ; then
@@ -1084,16 +1090,16 @@ test_operate_tests_run() {
   if [[ ${failure} -eq 0 ]] ; then
     if [[ ${verbosity} == "debug" ]] ; then
       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 ${analyze_flag} ${analyze_value} clean make -f testfile ${ci_arguments}"
+        echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m individual -m ${test_thread} ${mode_debug_param} ${mode_debug_value} ${thread_individual_param} ${thread_individual_value} -m test ${analyze_flag} ${analyze_value} 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 ${analyze_flag} ${analyze_value} -m ${build_compiler} clean make -f testfile ${ci_arguments}"
+        echo "PATH=\"${env_path}\" LD_LIBRARY_PATH=\"${env_libs}\" fake ${verbose} ${context} -w \"${destination}\" -m individual -m ${test_thread} ${mode_debug_param} ${mode_debug_value} ${thread_individual_param} ${thread_individual_value} -m test ${analyze_flag} ${analyze_value} -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 ${analyze_flag} ${analyze_value} clean make -f testfile ${ci_arguments}
+      PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m individual -m ${test_thread} ${mode_debug_param} ${mode_debug_value} ${thread_individual_param} ${thread_individual_value} -m test ${analyze_flag} ${analyze_value} 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 ${analyze_flag} ${analyze_value} -m ${build_compiler} clean make -f testfile ${ci_arguments}
+      PATH="${env_path}" LD_LIBRARY_PATH="${env_libs}" fake ${verbose} ${context} -w "${destination}" -m individual -m ${test_thread} ${mode_debug_param} ${mode_debug_value} ${thread_individual_param} ${thread_individual_value} -m test ${analyze_flag} ${analyze_value} -m ${build_compiler} clean make -f testfile ${ci_arguments}
     fi
 
     if [[ ${?} -ne 0 ]] ; then