Skip to content

Commit

Permalink
Merge pull request #452 from nasa/450_Output_Expected_Directory_Valid…
Browse files Browse the repository at this point in the history
…ation

Add directory validation checks in .ci product comparison scripts
  • Loading branch information
collinss-jpl authored Jun 18, 2024
2 parents 9260a2b + 207e17f commit a7f6280
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 10 deletions.
12 changes: 11 additions & 1 deletion .ci/scripts/cslc_s1/compare_cslc_s1_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ umask 002
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
. "$SCRIPT_DIR"/../util/test_int_util.sh

# TODO: add validation that OUTPUT/EXPECTED exist within container
OUTPUT_DIR="/home/compass_user/output_dir"
EXPECTED_DIR="/home/compass_user/expected_output_dir"
PGE_NAME="cslc_s1"
Expand All @@ -21,6 +20,17 @@ PGE_NAME="cslc_s1"
# 2 - product validation failure
overall_status=0

# Validate that OUTPUT_DIR and EXPECTED_DIR exist within the container
if [ ! -d "$OUTPUT_DIR" ]; then
echo "Error: Output directory '$OUTPUT_DIR' does not exist." >&2
exit 1
fi

if [ ! -d "$EXPECTED_DIR" ]; then
echo "Error: Expected directory '$EXPECTED_DIR' does not exist." >&2
exit 1
fi

initialize_html_results_file "$OUTPUT_DIR" "$PGE_NAME"
echo "<tr><th>Compare Result</th><th><ul><li>Expected file</li><li>Output file</li></ul></th><th>cslc_s1_compare.py output</th></tr>" >> "$RESULTS_FILE"

Expand Down
12 changes: 11 additions & 1 deletion .ci/scripts/cslc_s1/compare_cslc_s1_static_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ umask 002
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
. "$SCRIPT_DIR"/../util/test_int_util.sh

# TODO: add validation that OUTPUT/EXPECTED exist within container
OUTPUT_DIR="/home/compass_user/output_dir"
EXPECTED_DIR="/home/compass_user/expected_output_dir"
PGE_NAME="cslc_s1"
Expand All @@ -21,6 +20,17 @@ PGE_NAME="cslc_s1"
# 2 - product validation failure
overall_status=0

# Validate that OUTPUT_DIR and EXPECTED_DIR exist within the container
if [ ! -d "$OUTPUT_DIR" ]; then
echo "Error: Output directory '$OUTPUT_DIR' does not exist." >&2
exit 1
fi

if [ ! -d "$EXPECTED_DIR" ]; then
echo "Error: Expected directory '$EXPECTED_DIR' does not exist." >&2
exit 1
fi

initialize_html_results_file "$OUTPUT_DIR" "$PGE_NAME"
echo "<tr><th>Compare Result</th><th><ul><li>Expected file</li><li>Output file</li></ul></th><th>cslc_s1_compare.py output</th></tr>" >> "$RESULTS_FILE"

Expand Down
14 changes: 12 additions & 2 deletions .ci/scripts/dswx_hls/compare_dswx_hls_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ umask 002
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
. "$SCRIPT_DIR"/../util/test_int_util.sh

# TODO: add validation that OUTPUT/EXPECTED exist within container
OUTPUT_DIR="/home/conda/output_dir"
EXPECTED_DIR="/home/conda/expected_output_dir"
PGE_NAME="dswx_hls"

# Validate that OUTPUT_DIR and EXPECTED_DIR exist within the container
if [ ! -d "$OUTPUT_DIR" ]; then
echo "Error: Output directory '$OUTPUT_DIR' does not exist." >&2
exit 1
fi

if [ ! -d "$EXPECTED_DIR" ]; then
echo "Error: Expected directory '$EXPECTED_DIR' does not exist." >&2
exit 1
fi

initialize_html_results_file "$OUTPUT_DIR" "$PGE_NAME"

echo "<tr><th>Compare Result</th><th><ul><li>Expected file</li><li>Output file</li></ul></th><th>dswx_hls_compare.py output</th></tr>" >> "$RESULTS_FILE"
Expand Down Expand Up @@ -98,4 +108,4 @@ echo $overall_status > $OUTPUT_DIR/"compare_dswx_hls_products.rc"

# Always want to return 0 even if some comparisons failed to avoid error handling
# logic in the PGE
exit 0
exit 0
2 changes: 0 additions & 2 deletions .ci/scripts/dswx_ni/compare_dswx_ni_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
. "$SCRIPT_DIR"/../util/test_int_util.sh

OUTPUT_DIR="/home/dswx_user/output_dir"

EXPECTED_DIR="/home/dswx_user/expected_output_dir"

PGE_NAME="dswx_ni"

# Validate that OUTPUT_DIR and EXPECTED_DIR exist within the container
Expand Down
2 changes: 0 additions & 2 deletions .ci/scripts/dswx_s1/compare_dswx_s1_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
. "$SCRIPT_DIR"/../util/test_int_util.sh

OUTPUT_DIR="/home/dswx_user/output_dir"

EXPECTED_DIR="/home/dswx_user/expected_output_dir"

PGE_NAME="dswx_s1"

# Validate that OUTPUT_DIR and EXPECTED_DIR exist within the container
Expand Down
12 changes: 11 additions & 1 deletion .ci/scripts/rtc_s1/compare_rtc_s1_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ umask 002
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
. "$SCRIPT_DIR"/../util/test_int_util.sh

# TODO: add validation that OUTPUT/EXPECTED exist within container
OUTPUT_DIR="/home/rtc_user/output_dir"
EXPECTED_DIR="/home/rtc_user/expected_output_dir"
PGE_NAME="rtc_s1"

# Validate that OUTPUT_DIR and EXPECTED_DIR exist within the container
if [ ! -d "$OUTPUT_DIR" ]; then
echo "Error: Output directory '$OUTPUT_DIR' does not exist." >&2
exit 1
fi

if [ ! -d "$EXPECTED_DIR" ]; then
echo "Error: Expected directory '$EXPECTED_DIR' does not exist." >&2
exit 1
fi

initialize_html_results_file "$OUTPUT_DIR" "$PGE_NAME"

# overall_status values and their meaning
Expand Down
12 changes: 11 additions & 1 deletion .ci/scripts/rtc_s1/compare_rtc_s1_static_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ umask 002
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
. "$SCRIPT_DIR"/../util/test_int_util.sh

# TODO: add validation that OUTPUT/EXPECTED exist within container
OUTPUT_DIR="/home/rtc_user/output_dir"
EXPECTED_DIR="/home/rtc_user/expected_output_dir"
PGE_NAME="rtc_s1"

# Validate that OUTPUT_DIR and EXPECTED_DIR exist within the container
if [ ! -d "$OUTPUT_DIR" ]; then
echo "Error: Output directory '$OUTPUT_DIR' does not exist." >&2
exit 1
fi

if [ ! -d "$EXPECTED_DIR" ]; then
echo "Error: Expected directory '$EXPECTED_DIR' does not exist." >&2
exit 1
fi

initialize_html_results_file "$OUTPUT_DIR" "$PGE_NAME"

# overall_status values and their meaning
Expand Down

0 comments on commit a7f6280

Please sign in to comment.