From dd80cce09415d8a4b8830577bff2a1f778d16073 Mon Sep 17 00:00:00 2001 From: Greg Fiumara Date: Wed, 5 Apr 2023 15:37:35 -0400 Subject: [PATCH] Remove unused code * fail exits, so return statements not needed * check_search_correspondence is not implemented --- elft_1_x/validation/validate | 67 +----------------------------------- 1 file changed, 1 insertion(+), 66 deletions(-) diff --git a/elft_1_x/validation/validate b/elft_1_x/validation/validate index 71671f6..bc73e37 100755 --- a/elft_1_x/validation/validate +++ b/elft_1_x/validation/validate @@ -335,7 +335,7 @@ print_footer() font_reset;font_dim echo -n "Completed: $(get_date)" if [ "${start_sec}" != "" ]; then - local duration=$(( ("$(date +%s)" - start_sec) )) + local duration=$(( "$(date +%s)" - start_sec )) echo " (Runtime: ${duration}s)" else echo @@ -868,7 +868,6 @@ check_library() msg+="naming conventions." fail "${msg}" "" "The library directory is:" \ "$(rp "${local_lib_dir}")" - return 1 fi return 1 @@ -940,7 +939,6 @@ get_core_library_name() local msg="Library directory not found. Create it and place " msg+="the core library inside." fail "${msg}" "" "The library directory is:" "${local_lib_dir}" - return 1 fi local core_lib="" @@ -949,7 +947,6 @@ get_core_library_name() -regex "${local_lib_dir}/${lib_regex}" -printf "%P\n" | wc -l) if [ "${count}" -gt 1 ]; then fail "More than one core library found in ${local_lib_dir}" - return 1 fi local core_lib @@ -960,7 +957,6 @@ get_core_library_name() msg+="Please review the ELFT library naming conventions." fail "${msg}" "" "The library directory is:" \ "$(rp "${local_lib_dir}")" - return 1 fi echo "${core_lib}" @@ -1349,7 +1345,6 @@ check_api_level() output=$(<"${tempfile}") rm "${tempfile}" fail "${output}" - return 1 fi rm "${tempfile}" @@ -1363,13 +1358,11 @@ clean_previous_attempts() rm -rf "${bin_dir}" if [ -d "${bin_dir}" ]; then fail "Failed to remove" "${bin_dir}" - return 1 fi rm -rf "${output_dir}" if [ -d "${output_dir}" ]; then fail "Failed to remove" "${output_dir}" - return 1 fi rm -rf "${lib_dir}/libelft.so" @@ -1391,7 +1384,6 @@ clean_previous_attempts() wc -l)" -ne 0 ]; then fail "Failed to remove some output. Please delete it manually." - return 1 fi okay @@ -1528,7 +1520,6 @@ run_extract() then local msg="An error occurred while running. Please review:" fail "${msg}" "$(rp "${log}")" - return 1 fi # Check for runtime error messages @@ -1556,7 +1547,6 @@ run_create_database() then local msg="An error occurred while running. Please review:" fail "${msg}" "$(rp "${log}")" - return 1 fi # Check for runtime error messages @@ -1598,7 +1588,6 @@ run_search() then local msg="An error occurred while running. Please review:" fail "${msg}" "$(rp "${log}")" - return 1 fi # Check for runtime error messages @@ -1738,59 +1727,6 @@ check_search_correspondence() # echo -n "Checking search logs (correspondence)... " merge_logs "correspondence" return 0 - - local bad_coord=0 - local bad_theta=0 - local log="${driver_output_dir}/correspondence.log" - while read -r line; do -# read -r identifier ref_id ref_x ref_y ref_theta probe_id \ -# probe_x probe_y probe_theta <<< "$(cut -f \ -# 1,6,7,8,9,11,12,13,14 -d ',' <<< "${line}" | tr ',' ' ')" - read -r identifier ref_theta probe_x probe_y probe_theta <<< \ - "$(cut -f 1,9,12,13,14 -d ',' <<< "${line}" | tr ',' ' ')" - read -r probe_width probe_height <<< "$(cut -f 12 -d '_' \ - <<< "${identifier}" | tr -d '\"' | tr 'x' ' ')" - - # Location within image - if [ "${probe_x}" -ge "${probe_width}" ] || \ - [ "${probe_y}" -ge "${probe_height}" ]; then - bad_coord=1 - fi - # TODO: Reference image - - # Theta [0,359] - if [ "${probe_theta}" -lt 0 ] || \ - [ "${probe_theta}" -gt 359 ] || \ - [ "${ref_theta}" -lt 0 ] || \ - [ "${ref_theta}" -gt 359 ]; then - bad_theta=$(( bad_theta + 1 )) - fi - - # TODO: Probe/Reference ID valid based on number of images. - # Right now, only ever one probe. Reference difficult to - # do on a per-line basis. - - # TODO: Rank valid based on candidates returned for this search. - # Difficult to do on a per-line basis. - - # TODO: All corresponding minutia are identical to those - # extracted in ExtractionInterface. Difficult to do on a - # per-line basis. - done < <(tail -n +2 "${log}") - - if [ "${bad_coord}" -gt 0 ]; then - local msg="There are some (${bad_coord}) coordinates returned " - msg+="that are outside the image. Please review: " - fail "${msg}" "${log}" - fi - - if [ "${bad_theta}" -gt 0 ]; then - local msg="There are some (${bad_theta}) theta values outside " - msg+="the allowed range of [0, 359]. Please review: " - fail "${msg}" "${log}" - fi - - okay } # Check search candidates log for potential errors @@ -2057,4 +1993,3 @@ if [ "${validation_version_checked}" -ne 1 ]; then fi print_final_success print_footer "${start_sec}" -