diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2013-11-14 00:02:28 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2013-11-14 00:02:28 +0000 |
| commit | 81eff899b63a5cb94de177fa5679333b5c22902a (patch) | |
| tree | 1a6821e7a7e03dfebf501a646bfa52317c232c23 /qpid/cpp/src/tests | |
| parent | bbb9c940637204b6bab8ebfec6ea9da8fb945e22 (diff) | |
| download | qpid-python-81eff899b63a5cb94de177fa5679333b5c22902a.tar.gz | |
QPID-5306: Improve test wrapper to avoid using getopt for long options
Using getopt with long options is a gnu extension and so best avoided
for portability reasons.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1541764 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests')
| -rw-r--r-- | qpid/cpp/src/tests/CMakeLists.txt | 2 | ||||
| -rwxr-xr-x | qpid/cpp/src/tests/run_test | 44 |
2 files changed, 41 insertions, 5 deletions
diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt index e4fa9bbd3d..9f56d3dd45 100644 --- a/qpid/cpp/src/tests/CMakeLists.txt +++ b/qpid/cpp/src/tests/CMakeLists.txt @@ -345,7 +345,7 @@ add_test (federation_sys_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_federati add_test (queue_flow_limit_tests ${test_wrap} --start-broker "--broker-options=--default-flow-stop-threshold=80 --default-flow-resume-threshold=70 -t --log-to-stderr=no --log-to-stdout=no" - ${CMAKE_CURRENT_SOURCE_DIR}/run_queue_flow_limit_tests${test_script_suffix}) + -- ${CMAKE_CURRENT_SOURCE_DIR}/run_queue_flow_limit_tests${test_script_suffix}) if (BUILD_ACL) add_test (acl_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_acl_tests${test_script_suffix}) endif (BUILD_ACL) diff --git a/qpid/cpp/src/tests/run_test b/qpid/cpp/src/tests/run_test index 6fe49f7975..acb1714b0e 100755 --- a/qpid/cpp/src/tests/run_test +++ b/qpid/cpp/src/tests/run_test @@ -31,13 +31,46 @@ # examination. # -working_dir='.' +wrapper="Qpid Test Wrapper" +function usage { + echo "Usage:" + echo " --working-dir DIR" + echo " --build-dir DIR" + echo " --source-dir DIR" + echo " --python - run python script" + echo " --boost-test - run boost unit test" + echo " --xml - XML output from tests" + echo " --start-broker - start/stop broker before/after test" + echo " --broker-options - use these extra options when starting broker" + echo " --help - print this message" + echo " -- - This is required to separate the wrapped command" + echo " from the test parameters" +} + +function illegal_option { + echo "$wrapper: $1 is not an accepted option" + usage >&2 +} -OPTS=$(getopt -n "Qpid Test Wrapper" -o '' -l working-dir:,build-dir:,source-dir:,python,boost-test,xml,start-broker,broker-options: -- "$@") || exit 1 -eval set -- $OPTS +function no_command { + echo "$wrapper: No wrapped command specified" + usage >&2 +} + +function ignored_argument { + echo "Ignored argument: $1" >&2 +} + +working_dir='.' while true; do case "$1" in + --) shift; break ;; + # Split up any parameters expressed as --blah=foo + # and process them next time round the loop + --*=*) option=${1%%=*}; param=${1#*=} + shift; + set -- "$option" "$param" "$@" ;; --working-dir) working_dir=$2; shift 2 ;; --build-dir) build_dir=$2; shift 2 ;; --source-dir) source_dir=$2; shift 2 ;; @@ -46,7 +79,10 @@ case "$1" in --xml) xml_output=yes; shift ;; --start-broker) start_broker=yes; shift ;; --broker-options) qpidd_extra_options=$2; shift 2 ;; - --) shift; break ;; + --help) usage; exit 0; ;; + --*) illegal_option "$1"; exit 1; ;; + '') no_command; exit 1; ;; + *) ignored_argument "$1"; shift; ;; esac done |
