Skip to content

Add more specific error return codes - #66

Merged
dvalinrh merged 4 commits into
masterfrom
rerun
Mar 17, 2026
Merged

dvalinrh merged 4 commits into
masterfrom
rerun

Conversation

@dvalinrh

Copy link
Copy Markdown
Contributor

Description

Uses error_codes found in test_tools/error_codes to provide more specific error indication.

Before/After Comparison

Before: Returned a 0 or 1, making determination of having to rerun very course
After: Error codes are now bases on test_tools/error_codes, making it easier to limit when we do a rerun of the test.
Also, changed how we load in test_tools, we try curl, git, and wget, to avoid a failure due to the program not
being installed.

Clerical Stuff

This closes #65

Relates to JIRA: RPOPC-870

Testing Done
global:
ssh_key_file: replace_your_ssh_key
terminate_cloud: 1
os_vendor: rhel
results_prefix: documentation
os_vendor: rhel
system_type: aws
cloud_os_id: ami-035032ea878eca201
systems:
system1:
tests: "auto_hpl"
host_config: "m5.xlarge"

csv results
TV,N,NB,P,Q,Time,Gflops,Start_Date,End_Date
WR12R2R4,38400,256,1,1,296.11,1.2749e+02,2026-03-13T14:45:23Z,2026-03-13T14:51:20Z

Returned 0 as expected. Testing on rerun verification handled in the appropriate zathras pr.

@dvalinrh
dvalinrh requested a review from sayalibhavsar March 13, 2026 15:01
@sayalibhavsar

Copy link
Copy Markdown
Contributor
sbhavsar@sbhavsar-thinkpadp16vgen1:~/autohpl-wrapper$  TOOLS_BIN=~/test_tools bash auto_hpl/generate_makefile.sh --template /nonexistent/file --arch test --blas-lib test --mpi-inc test --output /tmp/out; echo "Exit code: $?"
Error: Template file '/nonexistent/file' not found
Exit code: 101
sbhavsar@sbhavsar-thinkpadp16vgen1:~/autohpl-wrapper$  TOOLS_BIN=~/test_tools bash auto_hpl/generate_makefile.sh --template auto_hpl/Make.Linux_Intel_openblas --arch test --blas-lib test --mpi-inc test --output /nonexistent/dir/out; echo "Exit code: $?"
Generating makefile: /nonexistent/dir/out
  Architecture: test
  BLAS Library: test
  MPI Include:  test
auto_hpl/generate_makefile.sh: line 147: /nonexistent/dir/out: No such file or directory
Error: Failed to generate makefile
Exit code: 101
sbhavsar@sbhavsar-thinkpadp16vgen1:~/autohpl-wrapper$ cat > /tmp/test_fallback.sh << 'EOF'                                                                                                                               
#!/bin/bash                                                                                                                                                                                                              
export TOOLS_BIN=/tmp/test_tools_fake                                                                                                                                                                                    
rm -rf "$TOOLS_BIN"                                                                                                                                                                                                      
tools_git=https://github.com/nonexistent/fake-repo-12345                                                                                                                                                                 
                                                                                                                                                                                                                         
exit_out() { echo "$1"; exit $2; }                                                                                                                                                                                       
                                                                                                                                                                                                                         
attempt_tools_wget() {                                                                                                                                                                                                   
    if [[ ! -d "$TOOLS_BIN" ]]; then                                                                                                                                                                                     
        wget ${tools_git}/archive/refs/heads/main.zip 2>/dev/null                                                                                                                                                        
        if [[ $? -eq 0 ]]; then                                                                                                                                                                                          
            unzip -q main.zip; mv test_tools-wrappers-main ${TOOLS_BIN}; rm main.zip                                                                                                                                     
        fi                                                                                                                                                                                                               
    fi                                                                                                                                                                                                                   
}                                                                                                                                                                                                                        
attempt_tools_curl() {                                                                                                                                                                                                   
    if [[ ! -d "$TOOLS_BIN" ]]; then                                                                                                                                                                                     
        curl -sL -O ${tools_git}/archive/refs/heads/main.zip 2>/dev/null                                                                                                                                                 
        if [[ $? -eq 0 ]]; then                                                                                                                                                                                          
            unzip -q main.zip; mv test_tools-wrappers-main ${TOOLS_BIN}; rm main.zip                                                                                                                                     
        fi                                                                                                                                                                                                               
    fi                                                                                                                                                                                                                   
}                                                                                                                                                                                                                        
attempt_tools_git() {                                                                                                                                                                                                    
    if [[ ! -d "$TOOLS_BIN" ]]; then                                                                                                                                                                                     
        git clone $tools_git "$TOOLS_BIN" 2>/dev/null                                                                                                                                                                    
        if [ $? -ne 0 ]; then                                                                                                                                                                                            
            exit_out "Error: pulling git $tools_git failed." 101                                                                                                                                                         
        fi                                                                                                                                                                                                               
    fi                                                                                                                                                                                                                   
}                                                                                                                                                                                                                        
                                                                                                                                                                                                                         
attempt_tools_wget                                                                                                                                                                                                       
attempt_tools_curl                                                                                                                                                                                                       
attempt_tools_git                                                                                                                                                                                                        
echo "BUG: should not reach here without TOOLS_BIN"                                                                                                                                                                      
EOF                                                                                                                                                                                                                      
sbhavsar@sbhavsar-thinkpadp16vgen1:~/autohpl-wrapper$ bash /tmp/test_fallback.sh; echo "Exit code: $?"                                                                                                                   
HTTP ERROR response 404  [https://github.com/nonexistent/fake-repo-12345/archive/refs/heads/main.zip]                                                                                                                    
main.zip             100% [====================>]       9     --.-KB/s                                                                                                                                                   
                          [Files: 0  Bytes: 9  []                                                                                                                                                                        
[main.zip]                                                                                                                                                                                                               
  End-of-central-directory signature not found.  Either this file is not                                                                                                                                                 
  a zipfile, or it constitutes one disk of a multi-part archive.  In the                                                                                                                                                 
  latter case the central directory and zipfile comment will be found on                                                                                                                                                 
  the last disk(s) of this archive.                                                                                                                                                                                      
unzip:  cannot find zipfile directory in one of main.zip or                                                                                                                                                              
        main.zip.zip, and cannot find main.zip.ZIP, period.                                                                                                                                                              
mv: cannot stat 'test_tools-wrappers-main': No such file or directory                                                                                                                                                    
Error: pulling git https://github.com/nonexistent/fake-repo-12345 failed.                                                                                                                                                
Exit code: 101    
sbhavsar@sbhavsar-thinkpadp16vgen1:~/autohpl-wrapper$ TOOLS_BIN=~/test_tools bash auto_hpl/generate_makefile.sh; echo "Exit code: $?"
Error: Missing required parameters
Usage: auto_hpl/generate_makefile.sh --template TEMPLATE_FILE --arch ARCH --blas-lib BLAS_LIB --mpi-inc MPI_INC --output OUTPUT_FILE [--blas-dir BLAS_DIR]

Parameters:
  --template   : Base makefile template
  --arch       : Architecture name (e.g., Linux_Intel_openblas_rhel10)
  --blas-lib   : BLAS library name (e.g., libopenblas.so.0 or libblis-mt.a)
  --mpi-inc    : MPI include path (e.g., /usr/include/openmpi-x86_64)
  --output     : Output makefile path
  --blas-dir   : Optional BLAS library directory (for BLIS custom builds)
Exit code: 103
  • Verified locally that error codes work correctly:
    • Missing template returns 101 (E_GENERAL)
    • Bad output path returns 101 (E_GENERAL)
    • Missing args returns 103 (E_USAGE)
    • Tool download fallback exits 101 when all methods fail

@sayalibhavsar sayalibhavsar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dvalinrh
dvalinrh merged commit 00a9b9b into master Mar 17, 2026
1 check passed
@dvalinrh
dvalinrh deleted the rerun branch March 18, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add error rtc

2 participants