#!/bin/bash # $HeadURL$ $LastChangedRevision$ echo "adeperlf ..." echo "calling with return OK ..." adeperlf 'return($ADE::OK); printf("should not be reached\n");' echo "calling with return FAIL with error message ..." adeperlf 'ADE::error($errstack_ref, "ade_err_misc", "this is the error message"); return($ADE::FAIL); printf("should not be reached\n");' || echo "suppressing non-zero exit code ..." echo "calling with return FAIL without error message ..." adeperlf 'return($ADE::FAIL); printf("should not be reached\n");' || echo "suppressing non-zero exit code ..." echo "calling with return 42 without error message ..." adeperlf 'return(42);'|| echo "suppressing non-zero exit code ..." echo "calling with syntax error in code ..." # sed used here to remove the reported location, which under my 'go' script is reported as # being two lines later, for unknown reasons. adeperlf '"' 2>&1 | sed 's/EOF at .*/EOF at /' echo echo "adeshf ..." echo "calling with return OK ..." adeshf 'return $ADE_OK; echo "should not be reached"' echo "calling with return FAIL with error message ..." adeshf 'ade_error "$ERRSTACK_REF" ADE_ERR_MISC "this is the error message"; return $ADE_FAIL; echo "should not be reached"' || echo "suppressing non-zero exit code ..." echo "calling with return FAIL without error message ..." adeshf 'return $ADE_FAIL; echo "should not be reached"' || echo "suppressing non-zero exit code ..." echo "calling with return 42 without error message ..." adeshf 'return 42' || echo "suppressing non-zero exit code ..." echo "calling with syntax error in code ..." # Unfortunately, when the eval encounters a syntax error it spits # out the full path of the script. In the context of testing that # full path is variant and needs de-varianting. Besides the error # message there are syntax errors from eval that we have to discard # (note 'sed -n ..../p'). adeshf '"' 2>&1 | sed -n 's/adeshf: ERROR: .*/adeshf: ERROR: VARIANT_TEXT_REMOVED/p' echo echo "adepyf ..." echo "calling with return OK ..." adepyf 'import ade; return ade.ok; print("should not be reached")' echo "calling with return FAIL with error message ..." adepyf 'import ade; ade.error(errstack, "ade_err_misc", "this is the error message"); return ade.fail; print("should not be reached")' || echo "suppressing non-zero exit code ..." echo "calling with return FAIL without error message ..." adepyf 'import ade; return ade.fail; print("should not be reached")' || echo "suppressing non-zero exit code ..." echo "calling with return 42 without error message ..." adepyf 'return 42' || echo "suppressing non-zero exit code ..." echo "calling with syntax error in code ..." adepyf '"' || echo "suppressing non-zero exit code ..." echo echo "all done"