Mercurial > hg > audiodb
changeset 550:d5ada9532a40
Implement error exits in the SOAP client when the return code is not SOAP_OK.
Corresponding fixes in the test suite, while we're at it.
author | mas01cr |
---|---|
date | Thu, 12 Feb 2009 10:44:54 +0000 |
parents | 0694bb74c5e9 |
children | ea341e68649f |
files | soap.cpp tests/0039/run-test.sh tests/test-utils.sh |
diffstat | 3 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/soap.cpp Wed Feb 11 12:38:04 2009 +0000 +++ b/soap.cpp Thu Feb 12 10:44:54 2009 +0000 @@ -20,7 +20,9 @@ std::cout << "nullCount = " << adbStatusResponse.result.nullCount << std::endl; std::cout << "flags = " << (adbStatusResponse.result.flags & 0x00FFFFFF) << std::endl; } else { - soap_print_fault(&soap,stderr); + char fault[MAXSTR]; + soap_sprint_fault(&soap, fault, MAXSTR); + error(fault); } soap_destroy(&soap); @@ -39,8 +41,13 @@ << adbLisztResponse.result.Rlen[i] << ")" << std::endl; } } else { - soap_print_fault(&soap, stderr); + char fault[MAXSTR]; + soap_sprint_fault(&soap, fault, MAXSTR); + error(fault); } + soap_destroy(&soap); + soap_end(&soap); + soap_done(&soap); } // WS_QUERY (CLIENT SIDE) @@ -72,7 +79,9 @@ } } } else { - soap_print_fault(&soap,stderr); + char fault[MAXSTR]; + soap_sprint_fault(&soap, fault, MAXSTR); + error(fault); } soap_destroy(&soap); @@ -122,10 +131,12 @@ for(int i=0; i<adbQueryResponse.result.__sizeRlist; i++) std::cout << adbQueryResponse.result.Rlist[i] << " " << adbQueryResponse.result.Dist[i] << " " << adbQueryResponse.result.Qpos[i] << " " << adbQueryResponse.result.Spos[i] << std::endl; + } else { + char fault[MAXSTR]; + soap_sprint_fault(&soap, fault, MAXSTR); + error(fault); } - else - soap_print_fault(&soap,stderr); - }else + } else ;// FIX ME: WRITE NON-SEQUENCE QUERY BY KEY ? soap_destroy(&soap);
--- a/tests/0039/run-test.sh Wed Feb 11 12:38:04 2009 +0000 +++ b/tests/0039/run-test.sh Thu Feb 12 10:44:54 2009 +0000 @@ -49,9 +49,9 @@ WSPORT=10039 start_server ${AUDIODB} ${WSPORT} -expect_clean_error_exit ${AUDIODB} -d testdb -c localhost:${WSPORT} --LISZT --lisztOffset -1 -#expect_clean_error_exit ${AUDIODB} -d testdb -c localhost:${WSPORT} --LISZT --lisztOffset 3 #NOT EXITING CLEANLY -expect_clean_error_exit ${AUDIODB} -d testdb -c localhost:${WSPORT} --LISZT --lisztLength -1 +expect_client_failure ${AUDIODB} -d testdb -c localhost:${WSPORT} --LISZT --lisztOffset -1 +expect_client_failure ${AUDIODB} -d testdb -c localhost:${WSPORT} --LISZT --lisztOffset 3 +expect_client_failure ${AUDIODB} -d testdb -c localhost:${WSPORT} --LISZT --lisztLength -1 check_server $!
--- a/tests/test-utils.sh Wed Feb 11 12:38:04 2009 +0000 +++ b/tests/test-utils.sh Thu Feb 12 10:44:54 2009 +0000 @@ -75,7 +75,13 @@ } expect_client_failure() { - # FIXME: work out whether and how the client should report server - # errors. At present, the client exits with a zero exit code. + trap - ERR "$@" + exit_code=$? + trap "exit 1" ERR + if [ $exit_code -eq 0 ]; then + exit 1 + elif [ $exit_code -ge 126 ]; then + exit 1 + fi }