diff options
author | Kate Ward <kate.ward@forestent.com> | 2016-01-10 16:53:04 +0100 |
---|---|---|
committer | Kate Ward <kate.ward@forestent.com> | 2016-01-10 16:53:04 +0100 |
commit | 4b66ecdc0d3f6b89d3132b75f5aca1773a29a1a3 (patch) | |
tree | 9668b6e23a484f660f25ff34c98876db0276ffe6 /source | |
parent | b11509fad7f5e9e66a734116fcec7c418419ee1f (diff) | |
download | shflags-4b66ecdc0d3f6b89d3132b75f5aca1773a29a1a3.tar.gz |
restructured source for GitHub
Diffstat (limited to 'source')
39 files changed, 0 insertions, 9587 deletions
diff --git a/source/1.0/README.md b/source/1.0/README.md deleted file mode 100644 index 437b684..0000000 --- a/source/1.0/README.md +++ /dev/null @@ -1,145 +0,0 @@ -==================== -shFlags 1.0.x README -==================== - -GitHub -====== - -This project is stored on GitHub as https://github.com/kward/shflags. -Documentation is available there, as are all releases and source code. The -source code is stored in Git and can be accessed using the following -information. - -Browse the code in a web browser at https://github.com/kward/shflags. - -Check out the code locally - -```sh -$ git clone https://github.com/kward/shflags.git -``` - -Documentation is (still) available on the web at -https://github.com/kward/shflags/wiki/Documentation10x - - -Making a release -================ - -For these steps, it is assumed we are working with release 1.0.0. - -Steps: - -- Write release notes. -- Update version. -- Finish change log. -- Check all the code in. -- Tag the release. -- Export the release. -- Create tarball. -- Create hashes for the tarball and sign with `gpg`. -- Update website. - -Write Release Notes -------------------- - -This should be pretty self explanatory. Use one of the release notes from a -previous release as an example. - -Update Version --------------- - -Edit `src/shflags` and change the version number in the `FLAGS_VERSION` -variable. - -Finish Documentation --------------------- - -Make sure that any remaining changes get put into the `CHANGES-X.X.txt` file. - -Finish writing the `RELEASE_NOTES-X.X.X.txt`. Once it is finished, run it -through the `fmt` command to make it pretty. (This assumes the lines weren't -already wrapped at 80 chars when the file was edited.) - -```sh -$ fmt -w 80 RELEASE_NOTES-2.0.0.txt >RELEASE_NOTES-2.0.0.txt.new -$ mv RELEASE_NOTES-2.0.0.txt.new RELEASE_NOTES-2.0.0.txt -``` - -We want to have an up-to-date version of the documentation in the release, so -we'd better build it. - -```sh -$ pwd -.../shflags/source/1.0 -$ rst2html --stylesheet-path=doc/rst2html.css README.txt >README.html -``` - -Check In All the Code ---------------------- - -This step is pretty self-explainatory - -```sh -$ pwd -.../shflags/source/1.0 -$ svn ci -m "finalizing 1.0.0 release" -``` - -Tag the Release ---------------- - -```sh -$ cd .. -$ pwd -.../shflags/source -$ ls -1.0 -$ svn cp -m "Release 1.0.0" 1.0 https://shflags.googlecode.com/svn/tags/1.0.0 -``` - -Export the Release ------------------- - -```sh -$ cd ../builds -$ pwd -.../shflags/builds -$ svn export https://shflags.googlecode.com/svn/tags/1.0.0 shflags-1.0.0 -``` - -Create the tarball ------------------- - -```sh -$ tar cfz ../releases/shflags-1.0.0.tgz shflags-1.0.0 -``` - -Sign the tarball with gpg -------------------------- - -```sh -$ cd ../releases -$ gpg --default-key kate.ward@forestent.com --detach-sign shflags-1.0.0.tgz -``` - -Post the release ----------------- - -To post the release, the ProjectInfo page needs to be updated with the release -info (release, date, and MD5), and the release with GPG signature needs to -uploaded. - - -Appendix -======== - -Related Documentation ---------------------- - -google-gflags (http://code.google.com/p/google-gflags/) - -Miscellaneous -------------- - -This document is written using the Restructured Text format to make it easily -parsable into an HTML file. diff --git a/source/1.0/bin/cb_wrapper.sh b/source/1.0/bin/cb_wrapper.sh deleted file mode 100755 index 418dd93..0000000 --- a/source/1.0/bin/cb_wrapper.sh +++ /dev/null @@ -1 +0,0 @@ -../bin/continuous_build.sh -c ./shflags_test.sh -w shflags -O ~/tmp diff --git a/source/1.0/bin/continuous_build.sh b/source/1.0/bin/continuous_build.sh deleted file mode 100755 index 6f47c69..0000000 --- a/source/1.0/bin/continuous_build.sh +++ /dev/null @@ -1,126 +0,0 @@ -# /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2010 Kate Ward. All Rights Reserved. -# Author: kate.ward@forestent.com (Kate Ward) -# -# Continuous build script for shell library testing. -# -# Sample usages: -# $ blah - -# treat unset variables as an error -set -u - -# global constants -ARGV0=`basename "$0"` -ARGV0_DIR=`dirname "$0"` -SHLIB_DIR="${ARGV0_DIR}/../lib" - -# load libraries -. ${SHFLAGS_LIB:-${SHLIB_DIR}/shflags} \ - || (echo 'unable to load shflags library' >&2; exit 1) -. ${VERSIONS_LIB:-${SHLIB_DIR}/versions} \ - || (echo 'unable to load versions library' >&2; exit 1) - -OUTPUT_FILE="${VERSIONS_OS_NAME}_${VERSIONS_OS_RELEASE}" - -# define flags -DEFINE_string 'command' '' 'the command to start a build' 'c' -DEFINE_string 'watch' '' 'file to watch for changes' 'w' -DEFINE_string 'watch_from' '' 'file containing filenames to watch' 'W' -DEFINE_string 'output' "${OUTPUT_FILE}" 'output file to write to' 'o' -DEFINE_string 'output_dir' '.' 'directory to write output file' 'O' -DEFINE_integer 'pause' 60 'pause between successive runs (sec)' 'p' - -FLAGS_HELP="USAGE: ${ARGV0} [flags]" - -#------------------------------------------------------------------------------ -# functions -# - -# This function exits the script, optionally printing a message -# -# Args: -# message: string: an error message to be output (optional) -# Output: -# string: usable flags -die() { - [ $# -ne 0 ] && echo "$@" >&2 - flags_help - exit 1 -} - -# Function to give the current date in ISO format -# -# Args: -# none -# Output: -# string: isodate -isodate() { - date -u '+%Y%m%dT%H%M%SZ' -} - -age() { - awkScript='' - case ${VERSIONS_OS_NAME} in - FreeBSD|Solaris) awkScript='{print $6,$7,$8}' ;; - Linux) awkScript='{print $6,$7}' ;; - *) echo "unrecognized OS name (${VERSIONS_OS_NAME})" >&2 ;; - esac - ls -l "$1" |awk "${awkScript}" -} - -#------------------------------------------------------------------------------ -# main -# - -main() -{ - # checks - [ -n "${FLAGS_command}" ] || die 'command required' - [ -z "${FLAGS_watch}" -a -z "${FLAGS_watch_from}" ] \ - && die 'one of watch or watch_from required' - [ -n "${FLAGS_watch}" -a -n "${FLAGS_watch_from}" ] \ - && die 'only one of watch or watch_from can be specified' - [ -r "${FLAGS_watch}" ] || die 'unable to read watch file' - [ -w "${FLAGS_output_dir}" ] || die 'unable to write to output directory' - - watchAge=`age "${FLAGS_watch}"` - watchAgePrev=${watchAge} - - # build - while true; do - if [ ! "${watchAge}" == "${watchAgePrev}" ]; then - date=`isodate` - echo "building ${VERSIONS_OS_NAME}-${VERSIONS_OS_RELEASE} @ ${date}" - outputFileDated="${FLAGS_output}-${date}" - ${FLAGS_command} >"${FLAGS_output_dir}/${outputFileDated}" 2>&1 - - ( cd "${FLAGS_output_dir}"; - rm -f "${FLAGS_output}"; - ln -s "${outputFileDated}" "${FLAGS_output}"; - grep FAIL "${FLAGS_output}"; ) - - watchAgePrev=${watchAge} - fi - - watchAge=`age "${FLAGS_watch}"` - if [ "${watchAge}" == "${watchAgePrev}" ]; then - echo 'sleeping...' - while [ "${watchAge}" == "${watchAgePrev}" ]; do - sleep ${FLAGS_pause} - watchAge=`age "${FLAGS_watch}"` - done - fi - done -} - -# execute main() if this is run in standalone mode (i.e. not in a unit test) -argv0=`echo "${ARGV0}" |sed 's/_test$//;s/_test\.sh$//'` -if [ "${ARGV0}" = "${argv0}" ]; then - FLAGS "$@" || exit $? - eval set -- "${FLAGS_ARGV}" - if [ $# -gt 0 ]; then main "$@"; else main; fi -fi diff --git a/source/1.0/bin/gen_test_results.flags b/source/1.0/bin/gen_test_results.flags deleted file mode 100644 index f42e2ae..0000000 --- a/source/1.0/bin/gen_test_results.flags +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2011 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# Flag definition overrides for the gen_test_results.sh script. -# - -DEFINE_string suite 'shflags_test.sh' 'unit test suite' s diff --git a/source/1.0/bin/gen_test_results.sh b/source/1.0/bin/gen_test_results.sh deleted file mode 100755 index 79d2fd4..0000000 --- a/source/1.0/bin/gen_test_results.sh +++ /dev/null @@ -1,88 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This script runs the provided unit tests and sends the output to the -# appropriate file. -# - -# treat unset variables as an error -set -u - -die() -{ - [ $# -gt 0 ] && echo "error: $@" >&2 - exit 1 -} - -BASE_DIR="`dirname $0`/.." -LIB_DIR="${BASE_DIR}/lib" - -# load libraries -. ${LIB_DIR}/shflags || die 'unable to load shflags library' -. ${LIB_DIR}/shlib || die 'unable to load shlib library' -. ${LIB_DIR}/versions || die 'unable to load versions library' - -# redefining BASE_DIR now that we have the shlib functions -BASE_DIR=`shlib_relToAbsPath "${BASE_DIR}"` -BIN_DIR="${BASE_DIR}/bin" -SRC_DIR="${BASE_DIR}/src" - -os_name=`versions_osName |sed 's/ /_/g'` -os_version=`versions_osVersion` - -# load external flags -. ${BIN_DIR}/gen_test_results.flags - -# define flags -DEFINE_boolean force false 'force overwrite' f -DEFINE_string output_dir "`pwd`" 'output dir' d -DEFINE_string output_file "${os_name}-${os_version}.txt" 'output file' o -DEFINE_boolean dry_run false "supress logging to a file" n - -main() -{ - # determine output filename - output="${FLAGS_output_dir:+${FLAGS_output_dir}/}${FLAGS_output_file}" - output=`shlib_relToAbsPath "${output}"` - - # checks - [ -n "${FLAGS_suite:-}" ] || die 'suite flag missing' - - if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} -a -f "${output}" ]; then - if [ ${FLAGS_force} -eq ${FLAGS_TRUE} ]; then - rm -f "${output}" - else - echo "not overwriting '${output}'" >&2 - exit ${FLAGS_ERROR} - fi - fi - if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then - touch "${output}" 2>/dev/null || die "unable to write to '${output}'" - fi - - # run tests - ( - cd "${SRC_DIR}"; - if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then - ./${FLAGS_suite} |tee "${output}" - else - ./${FLAGS_suite} - fi - ) - - if [ ! ${FLAGS_dry_run} ]; then - echo >&2 - echo "output written to '${output}'" >&2 - fi -} - -FLAGS "$@" || exit $? -[ ${FLAGS_help} -eq ${FALSE} ] || exit -eval set -- "${FLAGS_ARGV}" -main "$@" diff --git a/source/1.0/doc/CHANGES-1.0.md b/source/1.0/doc/CHANGES-1.0.md deleted file mode 100644 index dee1408..0000000 --- a/source/1.0/doc/CHANGES-1.0.md +++ /dev/null @@ -1,155 +0,0 @@ -Changes in shFlags 1.0.x -======================== - -Changes with 1.0.4 ------------------- - -Changed from the LGPL v2.1 license to the Apache v2.0 license so that others can -include the library or make changes without needing to release the modified -source code as well. - -Moved documentation to Markdown. - -Migrated the code to GitHub as code.google.com is turning down. - -Fixed issue #10. Usage of `expr` under FreeBSD 7.2 (FreeNAS 0.7.1) and FreeBSD -8.0 that was causing many unit tests to fail. - -Fixed issue where booleans were sometimes mis-configured to require additional -values like other flags. - -Changed `_flags_fatal()` to exit with `FLAGS_ERROR` immediately. - -Fixed issue #11. When help is requested, the help flag is no longer prefixed -with [no]. - -Upgraded shUnit2 to 2.1.6. - -Fixed issue #12. Requesting help shouldn't be considered an error. - -Added the ability to override the use of the OS default `getopt` command by -defining the `FLAGS_GETOPT_CMD` variable. - -Updated `gen_test_results.sh` and versions from shUnit2 source. - -Fixed issues# 13, 14. Added support for dashes ('-') in long flag names. The -defined flag will still be declared with underscores ('_') due to shell -limitations, so only one of a dashed flag name or an underscored flag name are -allowed, not both. - -Issue #20. Updated LGPL v2.1 license from -http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt. - -Issue #15. Use `gexpr` instead of `expr` on BSD variants. - -Minor tweaks to make run on FreeBSD 9.1. - -Fixed issue in `shflags_test_public.sh` where screens >80 columns were causing a -test to fail. - -Issue #22. Fixed broken testGetFlagInfo() test. - -Created alternate `validFloat()` and `validInt()` functions that use shell -built-ins where possible to increase performance and reduce the usage of the -`expr` command. - -Added separate built-in and `expr` functions for doing math. - - -Changes with 1.0.3 ------------------- - -MAJOR CHANGE! `FLAGS_ARGC` is now obsolete, and is replaced by -`FLAGS_ARGV`. See below for more info. - -Fixed issue# 7 where long flags defined with '=' (e.g. `--abc=123`) made it -impossible for the user to know how many non-flag command-line arguments were -available because the value returned by `FLAGS_ARGC` was wrong. The -`FLAGS_ARGC` value is now obsolete, but will be maintained for backwards -compatibility. The new method of getting the non-flag arguments is by executing -`eval set -- "${FLAGS_ARGV}"` after the `FLAGS` call. The arguments will -then be available using the standard shell $#, $@, $*, $1, etc. variables. - -Due to above fix for issue# 7, there is now proper support for mixing flags -with non-flag arguments on the command-line. Previously, all non-flag arguments -had to be at the end of the command-line. - -Renamed `_flags_standardGetopt()` and `_flags_enhancedGetopt()` functions to -`_flags_getoptStandard()` and `_flags_getoptEnhanced()`. - -Took out the setting and restoration of the '-u' shell flag to treat unset -variables as an error. No point in having it in this library as it is verified -in the unit tests, and provides basically no benefit. - -Fixed bug under Solaris where the generated help was adding extra 'x' -characters. - -Added checks for reserved flag variables (e.g. `FLAGS_TRUE`). - -Fixed some unset variable bugs. - -Now report the actual `getopt` error if there is one. - -All tests now properly enable skipping based on whether a standard or enhanced -`getopt` is found. - -Added the OS version to OS release for Solaris. - -Fixed `flags_reset()` so it unsets the default value environment vars. - - -Changes with 1.0.2 ------------------- - -FLAGS_PARENT no longer transforms into a constant so that it can be defined at -run time in scripts. - -Added warning about short flags being unsupported when there are problems -parsing the options with `getopt`. - -Add default values to end of description strings. - -Fixed bug that returned an error instead of success when recalling the default -values for empty strings. - -Added warning when a duplicate flag definition is attempted. - -Improved `assert[Warn|Error]Msg()` test helper grepping. - -Replaced shell_versions.sh with a new versions library and created -`gen_test_results.sh` to make releases easier. - -Copied the coding standards from shUnit2, but haven't fully implemented them -in shFlags yet. - -Issue# 1: When a user defines their own `--help` flag, no more warning is thrown -when `FLAGS()` is called stating that the help flag already defined. - -Issue# 2: Passing the `--nohelp` option no longer gives help output. - -Issue# 3: Added support for screen width detection. - - -Changes with 1.0.1 ------------------- - -Fixed bug where the help output added '[no]' to all flag names - -Added additional example files that are referenced by the documentation. - -Improved `zsh` version and option checking. - -Upgraded shUnit2 to 2.1.4 - -Added unit testing for the help output. - -When including a library (e.g. shflags) in a script, zsh 3.0.8 doesn't actually -execute the code in-line, but later. As such, variables that are defined in the -library cannot be used until functions are called from the main code. This -required the 'help' flag definition to be moved inside the FLAGS command. - - -Changes with 1.0.0 ------------------- - -This is the first official release, so everything is new. diff --git a/source/1.0/doc/LICENSE.shunit2 b/source/1.0/doc/LICENSE.shunit2 deleted file mode 100644 index 8dada3e..0000000 --- a/source/1.0/doc/LICENSE.shunit2 +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/source/1.0/doc/RELEASE_NOTES-1.0.0.txt b/source/1.0/doc/RELEASE_NOTES-1.0.0.txt deleted file mode 100644 index e489cf5..0000000 --- a/source/1.0/doc/RELEASE_NOTES-1.0.0.txt +++ /dev/null @@ -1,72 +0,0 @@ ------------------------------- -shFlags.sh 1.0.0 Release Notes ------------------------------- - -Preface -------- -Copyright 2008 Kate Ward. All Rights Reserved. -Released under the LGPL (GNU Lesser General Public License) - -Author: Kate Ward (kate.ward@forestent.com) - -This document covers any known issues and workarounds for the stated release of -shFlags. - -General info ------------- - -This is the first official release of shFlags. The project is modeled after the -gflags code released by Google on http://code.google.com/p/google-gflags/. Many -thanks for the code they have provided. - -As this is the first release, there are bound to be issues. Feel free - -Disclamer ---------- - -The unit tests --------------- - -shFlags is designed to work on as many environments as possible, but not all -environments are created equal. As such, not all of the unit tests will succeed -on every platform. The unit tests are therefore designed to fail, indicating to -the tester that the supported functionality is not present, but an additional -test is present to verify that shFlags properly caught the limitation and -presented the user with an appropriate error message. - -shFlags tries to support both the standard and enhanced versions of ``getopt``. -As each responds differently, and not everything is supported on the standard -version, some unit tests will be skipped (i.e. ASSERTS will not be thrown) when -the standard version of ``getopt`` is detected. The reason being that there is -no point testing for functionality that is positively known not to exist. A -tally of skipped tests will be kept for later reference. - -Standard vs Enhanced getopt ---------------------------- - -Here is a matrix of the supported features of the various getopt variants. - -+-------------------------+---+---+ -|Feature |std|enh| -+=========================+===+===+ -|short option names | Y | Y | -|long option names | N | Y | -|spaces in string options | N | Y | -+-------------------------+---+---+ - -Known Issues ------------- - -The getopt version provided by default with all versions of Solaris (up to and -including Solaris 10) is the standard version. As such, only short flags are -supported. - -The getopt version provided by default with all versions of Mac OS X (up to and -including 10.5) is the standard version. As such, only short flags are -supported. - -Workarounds ------------ - -The zsh shell requires the 'shwordsplit' option to be set, and the special -FLAGS_PARENT variable must be defined. diff --git a/source/1.0/doc/RELEASE_NOTES-1.0.1.txt b/source/1.0/doc/RELEASE_NOTES-1.0.1.txt deleted file mode 100644 index 651e204..0000000 --- a/source/1.0/doc/RELEASE_NOTES-1.0.1.txt +++ /dev/null @@ -1,72 +0,0 @@ ------------------------------- -shFlags.sh 1.0.1 Release Notes ------------------------------- - -Preface -------- -Copyright 2008 Kate Ward. All Rights Reserved. -Released under the LGPL (GNU Lesser General Public License) - -Author: Kate Ward (kate.ward@forestent.com) - -This document covers any known issues and workarounds for the stated release of -shFlags. - -General info ------------- - -This is a minor bugfix release of shFlags. It mainly fixes poor output of the -automated help system, but it also includes a couple more examples that are -referenced by the documentation. - -Please see the CHANGES-1.0.txt file for a complete list of changes. - -Disclamer ---------- - -The unit tests --------------- - -shFlags is designed to work on as many environments as possible, but not all -environments are created equal. As such, not all of the unit tests will succeed -on every platform. The unit tests are therefore designed to fail, indicating to -the tester that the supported functionality is not present, but an additional -test is present to verify that shFlags properly caught the limitation and -presented the user with an appropriate error message. - -shFlags tries to support both the standard and enhanced versions of ``getopt``. -As each responds differently, and not everything is supported on the standard -version, some unit tests will be skipped (i.e. ASSERTS will not be thrown) when -the standard version of ``getopt`` is detected. The reason being that there is -no point testing for functionality that is positively known not to exist. A -tally of skipped tests will be kept for later reference. - -Standard vs Enhanced getopt ---------------------------- - -Here is a matrix of the supported features of the various getopt variants. - -+-------------------------+---+---+ -|Feature |std|enh| -+=========================+===+===+ -|short option names | Y | Y | -|long option names | N | Y | -|spaces in string options | N | Y | -+-------------------------+---+---+ - -Known Issues ------------- - -The getopt version provided by default with all versions of Mac OS X (up to and -including 10.5) is the standard version. As such, only short flags are -supported. - -The getopt version provided by default with all versions of Solaris (up to and -including Solaris 10) is the standard version. As such, only short flags are -supported. - -Workarounds ------------ - -The zsh shell requires the 'shwordsplit' option to be set, and the special -FLAGS_PARENT variable must be defined. diff --git a/source/1.0/doc/RELEASE_NOTES-1.0.2.txt b/source/1.0/doc/RELEASE_NOTES-1.0.2.txt deleted file mode 100644 index f8154c7..0000000 --- a/source/1.0/doc/RELEASE_NOTES-1.0.2.txt +++ /dev/null @@ -1,78 +0,0 @@ ------------------------------- -shFlags.sh 1.0.1 Release Notes ------------------------------- - -Preface -------- -Copyright 2008 Kate Ward. All Rights Reserved. -Released under the LGPL (GNU Lesser General Public License) - -Author: Kate Ward (kate.ward@forestent.com) - -This document covers any known issues and workarounds for the stated release of -shFlags. - -General info ------------- - -This is both a minor bug fix release, and a minor new feature release of -shFlags. It adds several warning messages, fixes three issues, and now displays -the default value behind the help string when help is requested. Additionally, -the coding standards have been modified slightly and officially documented. -They were taken from the standards used by shUnit2 (the unit testing framework -used for the unit testing). - -Please see the CHANGES-1.0.txt file for a complete list of changes. - -The unit tests --------------- - -shFlags is designed to work on as many environments as possible, but not all -environments are created equal. As such, not all of the unit tests will succeed -on every platform. The unit tests are therefore designed to fail, indicating to -the tester that the supported functionality is not present, but an additional -test is present to verify that shFlags properly caught the limitation and -presented the user with an appropriate error message. - -shFlags tries to support both the standard and enhanced versions of **getopt**. -As each responds differently, and not everything is supported on the standard -version, some unit tests will be skipped (i.e. ASSERTS will not be thrown) when -the standard version of **getopt** is detected. The reason being that there is -no point testing for functionality that is positively known not to exist. A -tally of skipped tests will be kept for later reference. - -To see the test results for the various OSes tested, please visit -http://forestent.com/projects/shflags/testresults/. - -Standard vs Enhanced getopt ---------------------------- - -Here is a matrix of the supported features of the various **getopt** variants. - -+-------------------------+---+---+ -|Feature |std|enh| -+=========================+===+===+ -|short option names | Y | Y | -|long option names | N | Y | -|spaces in string options | N | Y | -+-------------------------+---+---+ - -Known Issues ------------- - -The **getopt** version provided by default with all versions of Mac OS X (up to -and including 10.5.5) is the standard version. As such, only short flags are -supported. - -The **getopt** version provided by default with all versions of Solaris (up to -and including Solaris 10 and OpenSolaris) is the standard version. As such, -only short flags are supported. - -Workarounds ------------ - -The Zsh shell requires the ``shwordsplit`` option to be set, and the special -``FLAGS_PARENT`` variable must be defined. - - -.. vim:fileencoding=latin1:ft=rst:spell:tw=80 diff --git a/source/1.0/doc/RELEASE_NOTES-1.0.3.txt b/source/1.0/doc/RELEASE_NOTES-1.0.3.txt deleted file mode 100644 index edfb1e2..0000000 --- a/source/1.0/doc/RELEASE_NOTES-1.0.3.txt +++ /dev/null @@ -1,94 +0,0 @@ ------------------------------- -shFlags.sh 1.0.3 Release Notes ------------------------------- - -Preface -======= -Copyright 2008-2009 Kate Ward. All Rights Reserved. -Released under the LGPL (GNU Lesser General Public License) -Author: kate.ward@forestent.com (Kate Ward) - -This document covers any known issues and workarounds for the stated release of -shFlags. - -Release info -============ - -This is a major bug fix release. The biggest fix is in how non-flag arguments are -made available to the script. - -Major changes -------------- - -The use of the ``FLAGS_ARGC`` variable is now obsolete. It will be maintained -for backwards compatibility with old scripts, but its value is known to be -wrong when flag and non-flag arguments are mixed together on the command-line. - -To gain access to the non-flag arguments, replace the following snippet of code -in your scripts with the updated version. - -old :: - shift ${FLAGS_ARGC} - -new :: - eval set -- "${FLAGS_ARGV}" - -Please see the CHANGES-1.0.txt file for a complete list of changes. - -Obsolete items --------------- - -Bug fixes ---------- - -Issue# 7 Flags set with '=' result in off-by-one shifting error - -General info -============ - -The unit tests --------------- - -shFlags is designed to work on as many environments as possible, but not all -environments are created equal. As such, not all of the unit tests will succeed -on every platform. The unit tests are therefore designed to fail, indicating to -the tester that the supported functionality is not present, but an additional -test is present to verify that shFlags properly caught the limitation and -presented the user with an appropriate error message. - -shFlags tries to support both the standard and enhanced versions of ``getopt``. -As each responds differently, and not everything is supported on the standard -version, some unit tests will be skipped (i.e. ASSERTS will not be thrown) when -the standard version of ``getopt`` is detected. The reason being that there is -no point testing for functionality that is positively known not to exist. A -tally of skipped tests will be kept for later reference. - -Standard vs Enhanced getopt ---------------------------- - -Here is a matrix of the supported features of the various **getopt** variants. - -+=========================================+=====+=====+ -| Feature | std | enh | -+-----------------------------------------+-----+-----+ -| short option names | Y | Y | -| long option names | N | Y | -| spaces in string options | N | Y | -| intermixing of flag and non-flag values | N | Y | -+=========================================+=====+=====+ - -Known Issues ------------- - -The **getopt** version provided by default with all versions of Mac OS X (up to -and including 10.5.6) and Solaris (up to and including Solaris 10 and -OpenSolaris) is the standard version. - -Workarounds ------------ - -The Zsh shell requires the ``shwordsplit`` option to be set and the special -``FLAGS_PARENT`` variable must be defined. See ``src/shflags_test_helpers`` to -see how the unit tests do this. - -.. vim:fileencoding=latin1:ft=rst:spell:tw=80 diff --git a/source/1.0/doc/RELEASE_NOTES-1.0.4.md b/source/1.0/doc/RELEASE_NOTES-1.0.4.md deleted file mode 100644 index 30e75a8..0000000 --- a/source/1.0/doc/RELEASE_NOTES-1.0.4.md +++ /dev/null @@ -1,81 +0,0 @@ -# shFlags.sh 1.0.4 Release Notes - -Preface -======= - -Copyright 2008-2009 Kate Ward. All Rights Reserved. -Released under the Apache License. -Author: kate.ward@forestent.com (Kate Ward) - -This document covers any known issues and workarounds for the stated release of -shFlags. - -Release info -============ - -This is a minor bug fix release. - -Please see the `CHANGES-1.0.txt` file for a complete list of changes. - -Major changes -------------- - -Changed from the LGPL v2.1 license to the Apache v2.0 license so that others can -include the library or make changes without needing to release the modified -source code as well. - -Obsolete items --------------- - -None - -Bug fixes ---------- - -Issue #10 - Changed the internal usage of the `expn` command to fix issues -under FreeBSD. - -General info -============ - -The unit tests --------------- - -shFlags is designed to work on as many environments as possible, but not all -environments are created equal. As such, not all of the unit tests will succeed -on every platform. The unit tests are therefore designed to fail, indicating to -the tester that the supported functionality is not present, but an additional -test is present to verify that shFlags properly caught the limitation and -presented the user with an appropriate error message. - -shFlags tries to support both the standard and enhanced versions of `getopt`. -As each responds differently, and not everything is supported on the standard -version, some unit tests will be skipped (i.e. ASSERTS will not be thrown) when -the standard version of `getopt` is detected. The reason being that there is -no point testing for functionality that is positively known not to exist. A -tally of skipped tests will be kept for later reference. - -Standard vs Enhanced getopt ---------------------------- - -Here is a matrix of the supported features of the various `getopt` variants. - -| Feature | std | enh | -|-----------------------------------------|-----|-----| -| short option names | Y | Y | -| long option names | N | Y | -| spaces in string options | N | Y | -| intermixing of flag and non-flag values | N | Y | - -Known Issues ------------- - -The `getopt` version provided by default with all versions of Mac OS X (up to -and including 10.10.2) and Solaris (up to and including Solaris 10 and -OpenSolaris) is the standard version. - -Workarounds ------------ -The Zsh shell requires the `shwordsplit` option to be set and the special -`FLAGS_PARENT` variable must be defined. See `src/shflags_test_helpers` to -see how the unit tests do this. diff --git a/source/1.0/doc/TODO.txt b/source/1.0/doc/TODO.txt deleted file mode 100644 index 515c851..0000000 --- a/source/1.0/doc/TODO.txt +++ /dev/null @@ -1,10 +0,0 @@ -improve zsh, automatically ... (pulled from configure) - - if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST - else diff --git a/source/1.0/doc/coding_standards.txt b/source/1.0/doc/coding_standards.txt deleted file mode 100644 index 1a9b52e..0000000 --- a/source/1.0/doc/coding_standards.txt +++ /dev/null @@ -1,118 +0,0 @@ -Coding Standards -================ - -shFlags is more than just a simple 20 line shell script. It is a pretty -significant library of shell code that at first glance is not that easy to -understand. To improve code readability and usability, some guidelines have -been set down to make the code more understandable for anyone who wants to read -or modify it. - -Function Documentation ----------------------- - -Each function should be preceded by a header that provides the following: - -#. A one-sentence summary of what the function does -#. (optional) A longer description of what the function does, and perhaps some - special information that helps convey its usage better. -#. Args: a one-line summary of each argument of the form: - ``name: type: description`` -#. Output: a one-line summary of the output provided. Only output to STDOUT - must be documented, unless the output to STDERR is of significance (i.e. not - just an error message). The output should be of the form: - ``type: description`` -#. Returns: a one-line summary of the value returned. Returns in shell are - always integers, but if the output is a true/false for success (i.e. a - boolean), it should be noted. The output should be of the form: - ``type: description`` - -Here is a sample header: :: - - # Return valid getopt options using currently defined list of long options. - # - # This function builds a proper getopt option string for short (and long) - # options, using the current list of long options for reference. - # - # Args: - # _flags_optStr: integer: option string type (__FLAGS_OPTSTR_*) - # Output: - # string: generated option string for getopt - # Returns: - # boolean: success of operation (always returns True) - -Variable and Function Names ---------------------------- - -All shFlags specific constants, variables, and functions will be prefixed -appropriately with 'flags'. This is to distinguish usage in the shFlags code -from users own scripts so that the shell name space remains predictable to -users. The exceptions here are the standard ``assertEquals``, etc. functions. - -All non built-in constants and variables will be surrouned with squiggle -brackets, e.g. '${flags_someVariable}' to improve code readability. - -Due to some shells not supporting local variables in functions, care in the -naming and use of variables, both public and private, is very important. -Accidental overriding of the variables can occur easily if care is not taken as -all variables are technically global variables in some shells. - -================================ ======================== -**type** **sample** -global public constant ``FLAGS_TRUE`` -global private constant ``__FLAGS_SHELL_FLAGS`` -global public variable ``flags_variable`` -global private variable ``__flags_variable`` -global macro ``_FLAGS_SOME_MACRO_`` -public function ``flags_function`` -public function, local variable ``flags_variable_`` -private function ``_flags_function`` -private function, local variable ``_flags_variable_`` -================================ ======================== - -Where it makes sense to improve readability, variables can have the first -letter of the second and later words capitalized. For example, the local -variable name for the help string length is ``flags_helpStrLen_``. - -There are three special-case global public variables used. They are used due to -overcome the limitations of shell scoping or to prevent forking. The three variables are: - - - flags_error - - flags_output - - flags_return - -Local Variable Cleanup ----------------------- - -As many shells do not support local variables, no support for cleanup of -variables is present either. As such, all variables local to a function must be -cleared up with the ``unset`` command at the end of each function. - -Indentation ------------ - -Code block indentation is two (2) spaces, and tabs may not be used. :: - - if [ -z 'some string' ]; then - someFunction - fi - -Lines of code should be no longer than 80 characters unless absolutely -necessary. When lines are wrapped using the backslash character '\', subsequent -lines should be indented with four (4) spaces so as to differentiate from the -standard spacing of two characters, and tabs may not be used. :: - - for x in some set of very long set of arguments that make for a very long \ - that extends much too long for one line - do - echo ${x} - done - -When a conditional expression is written using the builtin [ command, and that -line must be wrapped, place the control || or && operators on the same line as -the expression where possible, with the list to be executed on its own line. :: - - [ -n 'some really long expression' -a -n 'some other long expr' ] && \ - echo 'that was actually true!' - -.. vim:spell -.. $Id$ diff --git a/source/1.0/doc/contributors.txt b/source/1.0/doc/contributors.txt deleted file mode 100644 index 2c3c824..0000000 --- a/source/1.0/doc/contributors.txt +++ /dev/null @@ -1,5 +0,0 @@ -I'd like to thank these people for their contributisons to shFlags. - -Maciej Bliziński <blizinski@google.com> -Bjarni Einarsson <bre@google.com> -pvanderdoes [http://code.google.com/u/103206786526099082032/] diff --git a/source/1.0/doc/rst2html.css b/source/1.0/doc/rst2html.css deleted file mode 100644 index 01983a5..0000000 --- a/source/1.0/doc/rst2html.css +++ /dev/null @@ -1,292 +0,0 @@ -/* -:Author: David Goodger -:Contact: goodger@users.sourceforge.net -:Date: $Date: 2007-04-11 11:48:16 +0100 (Wed, 11 Apr 2007) $ -:Revision: $Revision: 2791 $ -:Copyright: This stylesheet has been placed in the public domain. -:Modified by: Kate Ward <kate.ward@forestent.com> - -Default cascading style sheet for the HTML output of Docutils. - -See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to -customize this style sheet. -*/ - -/* used to remove borders from tables and images */ -.borderless, table.borderless td, table.borderless th { - border: 0 } - -table.borderless td, table.borderless th { - /* Override padding for "table.docutils td" with "! important". - The right padding separates the table cells. */ - padding: 0 0.5em 0 0 ! important } - -.first { - /* Override more specific margin styles with "! important". */ - margin-top: 0 ! important } - -.last, .with-subtitle { - margin-bottom: 0 ! important } - -.hidden { - display: none } - -a.toc-backref { - text-decoration: none ; - color: black } - -blockquote.epigraph { - margin: 2em 5em ; } - -dl.docutils dd { - margin-bottom: 0.5em } - -/* Uncomment (and remove this text!) to get bold-faced definition list terms -dl.docutils dt { - font-weight: bold } -*/ - -div.abstract { - margin: 2em 5em } - -div.abstract p.topic-title { - font-weight: bold ; - text-align: center } - -div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning { - margin: 2em ; - border: medium outset ; - padding: 1em } - -div.admonition p.admonition-title, div.hint p.admonition-title, -div.important p.admonition-title, div.note p.admonition-title, -div.tip p.admonition-title { - font-weight: bold ; - font-family: sans-serif } - -div.attention p.admonition-title, div.caution p.admonition-title, -div.danger p.admonition-title, div.error p.admonition-title, -div.warning p.admonition-title { - color: red ; - font-weight: bold ; - font-family: sans-serif } - -/* Uncomment (and remove this text!) to get reduced vertical space in - compound paragraphs. -div.compound .compound-first, div.compound .compound-middle { - margin-bottom: 0.5em } - -div.compound .compound-last, div.compound .compound-middle { - margin-top: 0.5em } -*/ - -div.dedication { - margin: 2em 5em ; - text-align: center ; - font-style: italic } - -div.dedication p.topic-title { - font-weight: bold ; - font-style: normal } - -div.figure { - margin-left: 2em ; - margin-right: 2em } - -div.footer, div.header { - clear: both; - font-size: smaller } - -div.line-block { - display: block ; - margin-top: 1em ; - margin-bottom: 1em } - -div.line-block div.line-block { - margin-top: 0 ; - margin-bottom: 0 ; - margin-left: 1.5em } - -div.sidebar { - margin-left: 1em ; - border: medium outset ; - padding: 1em ; - background-color: #ffffee ; - width: 40% ; - float: right ; - clear: right } - -div.sidebar p.rubric { - font-family: sans-serif ; - font-size: medium } - -div.system-messages { - margin: 5em } - -div.system-messages h1 { - color: red } - -div.system-message { - border: medium outset ; - padding: 1em } - -div.system-message p.system-message-title { - color: red ; - font-weight: bold } - -div.topic { - margin: 2em } - -h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, -h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { - margin-top: 0.4em } - -h1.title { - text-align: center } - -h2.subtitle { - text-align: center } - -hr.docutils { - width: 75% } - -img.align-left { - clear: left } - -img.align-right { - clear: right } - -ol.simple, ul.simple { - margin-bottom: 1em } - -ol.arabic { - list-style: decimal } - -ol.loweralpha { - list-style: lower-alpha } - -ol.upperalpha { - list-style: upper-alpha } - -ol.lowerroman { - list-style: lower-roman } - -ol.upperroman { - list-style: upper-roman } - -p.attribution { - text-align: right ; - margin-left: 50% } - -p.caption { - font-style: italic } - -p.credits { - font-style: italic ; - font-size: smaller } - -p.label { - white-space: nowrap } - -p.rubric { - font-weight: bold ; - font-size: larger ; - color: maroon ; - text-align: center } - -p.sidebar-title { - font-family: sans-serif ; - font-weight: bold ; - font-size: larger } - -p.sidebar-subtitle { - font-family: sans-serif ; - font-weight: bold } - -p.topic-title { - font-weight: bold } - -pre.address { - margin-bottom: 0 ; - margin-top: 0 ; - font-family: serif ; - font-size: 100% } - -pre.literal-block, pre.doctest-block { - margin-left: 2em ; - margin-right: 2em ; - background-color: #eeeeee } - -span.classifier { - font-family: sans-serif ; - font-style: oblique } - -span.classifier-delimiter { - font-family: sans-serif ; - font-weight: bold } - -span.interpreted { - font-family: sans-serif } - -span.option { - white-space: nowrap } - -span.pre { - white-space: pre } - -span.problematic { - color: red } - -span.section-subtitle { - /* font-size relative to parent (h1..h6 element) */ - font-size: 80% } - -table.citation { - border-left: solid 1px gray; - margin-left: 1px } - -table.docinfo { - margin: 2em 4em } - -/* -table.docutils { - margin-top: 0.5em ; - margin-bottom: 0.5em } -*/ - -table.footnote { - border-left: solid 1px black; - margin-left: 1px ; - font-size: 80% } - } - -table.docutils td, table.docutils th, -table.docinfo td, table.docinfo th { - padding-left: 0.5em ; - padding-right: 0.5em ; - vertical-align: top } - -table.docutils th.field-name, table.docinfo th.docinfo-name { - font-weight: bold ; - text-align: left ; - white-space: nowrap ; - padding-left: 0 } - -h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, -h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { - font-size: 100% } - -/* -tt.docutils { - background-color: #eeeeee } -*/ - -ul.auto-toc { - list-style-type: none } - -/* customizations by kward */ - -h1 { font-size: 133%; border-top:1px solid #CCCCFF; } -h1.title { font-size: 150%; border-top:0px; padding-top: 1em; } -/* div.document { font-size: 90% } */ diff --git a/source/1.0/examples/debug_output.sh b/source/1.0/examples/debug_output.sh deleted file mode 100755 index d54635f..0000000 --- a/source/1.0/examples/debug_output.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This script does the very simple job of echoing some text. If a '-d' (or -# '--debug') flag is given, additinal "debug" output is enabled. -# -# This script demonstrates the use of a boolean flag to enable custom -# functionality in a script. -# -# Try running these: -# $ ./debug_output.sh speak -# $ ./debug_output.sh sing -# $ ./debug_output.sh --debug sing - -# source shflags -. ../src/shflags - -# define flags -DEFINE_boolean 'debug' false 'enable debug mode' 'd' -FLAGS_HELP=`cat <<EOF -commands: - speak: say something - sing: sing something -EOF` - - -debug() -{ - [ ${FLAGS_debug} -eq ${FLAGS_TRUE} ] || return - echo "DEBUG: $@" >&2 -} - -die() { - [ $# -gt 0 ] && echo "error: $@" >&2 - flags_help - exit 1 -} - - -# parse the command-line -FLAGS "$@" || exit 1 -eval set -- "${FLAGS_ARGV}" - -command=$1 -case ${command} in - '') die ;; - - speak) - debug "I'm getting ready to say something..." - echo 'The answer to the question "What is the meaning of life?" is "42".' - ;; - - sing) - debug "I'm getting ready to sing something..." - echo 'I love to sing! La diddy da dum!' - ;; - - *) die "unrecognized command (${command})" ;; -esac diff --git a/source/1.0/examples/hello_world.sh b/source/1.0/examples/hello_world.sh deleted file mode 100755 index 6fb2cb0..0000000 --- a/source/1.0/examples/hello_world.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This is the proverbial 'Hello, world!' script to demonstrate the most basic -# functionality of shFlags. -# -# This script demonstrates accepts a single command-line flag of '-n' (or -# '--name'). If a name is given, it is output, otherwise the default of 'world' -# is output. - -# source shflags -. ../src/shflags - -# define a 'name' command-line string flag -DEFINE_string 'name' 'world' 'name to say hello to' 'n' - -# parse the command-line -FLAGS "$@" || exit 1 -eval set -- "${FLAGS_ARGV}" - -echo "Hello, ${FLAGS_name}!" diff --git a/source/1.0/examples/write_date.sh b/source/1.0/examples/write_date.sh deleted file mode 100755 index 85695cf..0000000 --- a/source/1.0/examples/write_date.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This script takes a filename as input and writes the current date to the -# file. If the file already exists, it will not be overwritten unless the '-f' -# (or '--force') flag is given. -# -# This script demonstrates several types of shFlags functionality. -# - declaration of the FLAGS_HELP variable to customize the help output -# - direct calling of the flags_help() function for script controlled usage -# output -# - handling of non-flag type command-line arguments that follow the flags -# -# Try the following: -# $ ./write_date.sh now.out -# $ cat now.out -# -# $ ./write_date.sh now.out -# $ cat now.out -# -# $ ./write_date.sh -f now.out -# $ cat now.out - -# source shflags -. ../src/shflags - -# configure shflags -DEFINE_boolean 'force' false 'force overwriting' 'f' -FLAGS_HELP="USAGE: $0 [flags] filename" - - -write_date() -{ - date >"$1" -} - -die() -{ - [ $# -gt 0 ] && echo "error: $@" >&2 - flags_help - exit 1 -} - - -# parse the command-line -FLAGS "$@" || exit 1 -eval set -- "${FLAGS_ARGV}" - -# check for filename -[ $# -gt 0 ] || die 'filename missing' -filename=$1 - -[ -f "${filename}" -a ${FLAGS_force} -eq ${FLAGS_FALSE} ] \ - && die 'filename exists; not overwriting' -write_date "${filename}" diff --git a/source/1.0/lib/shflags b/source/1.0/lib/shflags deleted file mode 100644 index 9e69e64..0000000 --- a/source/1.0/lib/shflags +++ /dev/null @@ -1,1156 +0,0 @@ -# $Id: shflags 189 2013-01-15 00:13:10Z kate.ward@forestent.com $ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# shFlags -- Advanced command-line flag library for Unix shell scripts. -# http://code.google.com/p/shflags/ -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This module implements something like the google-gflags library available -# from http://code.google.com/p/google-gflags/. -# -# FLAG TYPES: This is a list of the DEFINE_*'s that you can do. All flags take -# a name, default value, help-string, and optional 'short' name (one-letter -# name). Some flags have other arguments, which are described with the flag. -# -# DEFINE_string: takes any input, and intreprets it as a string. -# -# DEFINE_boolean: does not take any arguments. Say --myflag to set -# FLAGS_myflag to true, or --nomyflag to set FLAGS_myflag to false. For short -# flags, passing the flag on the command-line negates the default value, i.e. -# if the default is true, passing the flag sets the value to false. -# -# DEFINE_float: takes an input and intreprets it as a floating point number. As -# shell does not support floats per-se, the input is merely validated as -# being a valid floating point value. -# -# DEFINE_integer: takes an input and intreprets it as an integer. -# -# SPECIAL FLAGS: There are a few flags that have special meaning: -# --help (or -?) prints a list of all the flags in a human-readable fashion -# --flagfile=foo read flags from foo. (not implemented yet) -# -- as in getopt(), terminates flag-processing -# -# EXAMPLE USAGE: -# -# -- begin hello.sh -- -# #! /bin/sh -# . ./shflags -# DEFINE_string name 'world' "somebody's name" n -# FLAGS "$@" || exit $? -# eval set -- "${FLAGS_ARGV}" -# echo "Hello, ${FLAGS_name}." -# -- end hello.sh -- -# -# $ ./hello.sh -n Kate -# Hello, Kate. -# -# CUSTOMIZABLE BEHAVIOR: -# -# A script can override the default 'getopt' command by providing the path to -# an alternate implementation by defining the FLAGS_GETOPT_CMD variable. -# -# NOTES: -# -# * Not all systems include a getopt version that supports long flags. On these -# systems, only short flags are recognized. - -#============================================================================== -# shFlags -# -# Shared attributes: -# flags_error: last error message -# flags_output: last function output (rarely valid) -# flags_return: last return value -# -# __flags_longNames: list of long names for all flags -# __flags_shortNames: list of short names for all flags -# __flags_boolNames: list of boolean flag names -# -# __flags_opts: options parsed by getopt -# -# Per-flag attributes: -# FLAGS_<flag_name>: contains value of flag named 'flag_name' -# __flags_<flag_name>_default: the default flag value -# __flags_<flag_name>_help: the flag help string -# __flags_<flag_name>_short: the flag short name -# __flags_<flag_name>_type: the flag type -# -# Notes: -# - lists of strings are space separated, and a null value is the '~' char. - -# return if FLAGS already loaded -[ -n "${FLAGS_VERSION:-}" ] && return 0 -FLAGS_VERSION='1.0.4pre' - -# return values that scripts can use -FLAGS_TRUE=0 -FLAGS_FALSE=1 -FLAGS_ERROR=2 - -# determine some reasonable command defaults -__FLAGS_UNAME_S=`uname -s` -case "${__FLAGS_UNAME_S}" in - BSD) __FLAGS_EXPR_CMD='gexpr' ;; - *) __FLAGS_EXPR_CMD='expr' ;; -esac - -# commands a user can override if needed -FLAGS_EXPR_CMD=${FLAGS_EXPR_CMD:-${__FLAGS_EXPR_CMD}} -FLAGS_GETOPT_CMD=${FLAGS_GETOPT_CMD:-getopt} - -# specific shell checks -if [ -n "${ZSH_VERSION:-}" ]; then - setopt |grep "^shwordsplit$" >/dev/null - if [ $? -ne ${FLAGS_TRUE} ]; then - _flags_fatal 'zsh shwordsplit option is required for proper zsh operation' - fi - if [ -z "${FLAGS_PARENT:-}" ]; then - _flags_fatal "zsh does not pass \$0 through properly. please declare' \ -\"FLAGS_PARENT=\$0\" before calling shFlags" - fi -fi - -# can we use built-ins? -( echo "${FLAGS_TRUE#0}"; ) >/dev/null 2>&1 -if [ $? -eq ${FLAGS_TRUE} ]; then - __FLAGS_USE_BUILTIN=${FLAGS_TRUE} -else - __FLAGS_USE_BUILTIN=${FLAGS_FALSE} -fi - -# -# constants -# - -# reserved flag names -__FLAGS_RESERVED_LIST=' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE ' -__FLAGS_RESERVED_LIST="${__FLAGS_RESERVED_LIST} VERSION " - -# getopt version -__FLAGS_GETOPT_VERS_STD=0 -__FLAGS_GETOPT_VERS_ENH=1 -__FLAGS_GETOPT_VERS_BSD=2 - -${FLAGS_GETOPT_CMD} >/dev/null 2>&1 -case $? in - 0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;; # bsd getopt - 2) - # TODO(kward): look into '-T' option to test the internal getopt() version - if [ "`${FLAGS_GETOPT_CMD} --version`" = '-- ' ]; then - __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} - else - __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_ENH} - fi - ;; - *) _flags_fatal 'unable to determine getopt version' ;; -esac - -# getopt optstring lengths -__FLAGS_OPTSTR_SHORT=0 -__FLAGS_OPTSTR_LONG=1 - -__FLAGS_NULL='~' - -# flag info strings -__FLAGS_INFO_DEFAULT='default' -__FLAGS_INFO_HELP='help' -__FLAGS_INFO_SHORT='short' -__FLAGS_INFO_TYPE='type' - -# flag lengths -__FLAGS_LEN_SHORT=0 -__FLAGS_LEN_LONG=1 - -# flag types -__FLAGS_TYPE_NONE=0 -__FLAGS_TYPE_BOOLEAN=1 -__FLAGS_TYPE_FLOAT=2 -__FLAGS_TYPE_INTEGER=3 -__FLAGS_TYPE_STRING=4 - -# set the constants readonly -__flags_constants=`set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'` -for __flags_const in ${__flags_constants}; do - # skip certain flags - case ${__flags_const} in - FLAGS_HELP) continue ;; - FLAGS_PARENT) continue ;; - esac - # set flag readonly - if [ -z "${ZSH_VERSION:-}" ]; then - readonly ${__flags_const} - else # handle zsh - case ${ZSH_VERSION} in - [123].*) readonly ${__flags_const} ;; - *) readonly -g ${__flags_const} ;; # declare readonly constants globally - esac - fi -done -unset __flags_const __flags_constants - -# -# internal variables -# - -# space separated lists -__flags_boolNames=' ' # boolean flag names -__flags_longNames=' ' # long flag names -__flags_shortNames=' ' # short flag names -__flags_definedNames=' ' # defined flag names (used for validation) - -__flags_columns='' # screen width in columns -__flags_opts='' # temporary storage for parsed getopt flags - -#------------------------------------------------------------------------------ -# private functions -# - -# logging functions -_flags_debug() { echo "flags:DEBUG $@" >&2; } -_flags_warn() { echo "flags:WARN $@" >&2; } -_flags_error() { echo "flags:ERROR $@" >&2; } -_flags_fatal() { echo "flags:FATAL $@" >&2; exit ${FLAGS_ERROR}; } - -# Define a flag. -# -# Calling this function will define the following info variables for the -# specified flag: -# FLAGS_flagname - the name for this flag (based upon the long flag name) -# __flags_<flag_name>_default - the default value -# __flags_flagname_help - the help string -# __flags_flagname_short - the single letter alias -# __flags_flagname_type - the type of flag (one of __FLAGS_TYPE_*) -# -# Args: -# _flags__type: integer: internal type of flag (__FLAGS_TYPE_*) -# _flags__name: string: long flag name -# _flags__default: default flag value -# _flags__help: string: help string -# _flags__short: string: (optional) short flag name -# Returns: -# integer: success of operation, or error -_flags_define() -{ - if [ $# -lt 4 ]; then - flags_error='DEFINE error: too few arguments' - flags_return=${FLAGS_ERROR} - _flags_error "${flags_error}" - return ${flags_return} - fi - - _flags_type_=$1 - _flags_name_=$2 - _flags_default_=$3 - _flags_help_=$4 - _flags_short_=${5:-${__FLAGS_NULL}} - - _flags_return_=${FLAGS_TRUE} - _flags_usName_=`_flags_underscoreName ${_flags_name_}` - - # check whether the flag name is reserved - _flags_itemInList ${_flags_usName_} "${__FLAGS_RESERVED_LIST}" - if [ $? -eq ${FLAGS_TRUE} ]; then - flags_error="flag name (${_flags_name_}) is reserved" - _flags_return_=${FLAGS_ERROR} - fi - - # require short option for getopt that don't support long options - if [ ${_flags_return_} -eq ${FLAGS_TRUE} \ - -a ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} \ - -a "${_flags_short_}" = "${__FLAGS_NULL}" ] - then - flags_error="short flag required for (${_flags_name_}) on this platform" - _flags_return_=${FLAGS_ERROR} - fi - - # check for existing long name definition - if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then - if _flags_itemInList ${_flags_usName_} ${__flags_definedNames}; then - flags_error="definition for ([no]${_flags_name_}) already exists" - _flags_warn "${flags_error}" - _flags_return_=${FLAGS_FALSE} - fi - fi - - # check for existing short name definition - if [ ${_flags_return_} -eq ${FLAGS_TRUE} \ - -a "${_flags_short_}" != "${__FLAGS_NULL}" ] - then - if _flags_itemInList "${_flags_short_}" ${__flags_shortNames}; then - flags_error="flag short name (${_flags_short_}) already defined" - _flags_warn "${flags_error}" - _flags_return_=${FLAGS_FALSE} - fi - fi - - # handle default value. note, on several occasions the 'if' portion of an - # if/then/else contains just a ':' which does nothing. a binary reversal via - # '!' is not done because it does not work on all shells. - if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then - case ${_flags_type_} in - ${__FLAGS_TYPE_BOOLEAN}) - if _flags_validBool "${_flags_default_}"; then - case ${_flags_default_} in - true|t|0) _flags_default_=${FLAGS_TRUE} ;; - false|f|1) _flags_default_=${FLAGS_FALSE} ;; - esac - else - flags_error="invalid default flag value '${_flags_default_}'" - _flags_return_=${FLAGS_ERROR} - fi - ;; - - ${__FLAGS_TYPE_FLOAT}) - if _flags_validFloat "${_flags_default_}"; then - : - else - flags_error="invalid default flag value '${_flags_default_}'" - _flags_return_=${FLAGS_ERROR} - fi - ;; - - ${__FLAGS_TYPE_INTEGER}) - if _flags_validInt "${_flags_default_}"; then - : - else - flags_error="invalid default flag value '${_flags_default_}'" - _flags_return_=${FLAGS_ERROR} - fi - ;; - - ${__FLAGS_TYPE_STRING}) ;; # everything in shell is a valid string - - *) - flags_error="unrecognized flag type '${_flags_type_}'" - _flags_return_=${FLAGS_ERROR} - ;; - esac - fi - - if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then - # store flag information - eval "FLAGS_${_flags_usName_}='${_flags_default_}'" - eval "__flags_${_flags_usName_}_${__FLAGS_INFO_TYPE}=${_flags_type_}" - eval "__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}=\ -\"${_flags_default_}\"" - eval "__flags_${_flags_usName_}_${__FLAGS_INFO_HELP}=\"${_flags_help_}\"" - eval "__flags_${_flags_usName_}_${__FLAGS_INFO_SHORT}='${_flags_short_}'" - - # append flag names to name lists - __flags_shortNames="${__flags_shortNames}${_flags_short_} " - __flags_longNames="${__flags_longNames}${_flags_name_} " - [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \ - __flags_boolNames="${__flags_boolNames}no${_flags_name_} " - - # append flag names to defined names for later validation checks - __flags_definedNames="${__flags_definedNames}${_flags_usName_} " - [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \ - __flags_definedNames="${__flags_definedNames}no${_flags_usName_} " - fi - - flags_return=${_flags_return_} - unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ \ - _flags_short_ _flags_type_ _flags_usName_ - [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_error "${flags_error}" - return ${flags_return} -} - -# Underscore a flag name by replacing dashes with underscores. -# -# Args: -# unnamed: string: log flag name -# Output: -# string: underscored name -_flags_underscoreName() -{ - echo $1 |tr '-' '_' -} - -# Return valid getopt options using currently defined list of long options. -# -# This function builds a proper getopt option string for short (and long) -# options, using the current list of long options for reference. -# -# Args: -# _flags_optStr: integer: option string type (__FLAGS_OPTSTR_*) -# Output: -# string: generated option string for getopt -# Returns: -# boolean: success of operation (always returns True) -_flags_genOptStr() -{ - _flags_optStrType_=$1 - - _flags_opts_='' - - for _flags_name_ in ${__flags_longNames}; do - _flags_usName_=`_flags_underscoreName ${_flags_name_}` - _flags_type_=`_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}` - [ $? -eq ${FLAGS_TRUE} ] || _flags_fatal 'call to _flags_type_ failed' - case ${_flags_optStrType_} in - ${__FLAGS_OPTSTR_SHORT}) - _flags_shortName_=`_flags_getFlagInfo \ - ${_flags_usName_} ${__FLAGS_INFO_SHORT}` - if [ "${_flags_shortName_}" != "${__FLAGS_NULL}" ]; then - _flags_opts_="${_flags_opts_}${_flags_shortName_}" - # getopt needs a trailing ':' to indicate a required argument - [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \ - _flags_opts_="${_flags_opts_}:" - fi - ;; - - ${__FLAGS_OPTSTR_LONG}) - _flags_opts_="${_flags_opts_:+${_flags_opts_},}${_flags_name_}" - # getopt needs a trailing ':' to indicate a required argument - [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \ - _flags_opts_="${_flags_opts_}:" - ;; - esac - done - - echo "${_flags_opts_}" - unset _flags_name_ _flags_opts_ _flags_optStrType_ _flags_shortName_ \ - _flags_type_ _flags_usName_ - return ${FLAGS_TRUE} -} - -# Returns flag details based on a flag name and flag info. -# -# Args: -# string: underscored flag name -# string: flag info (see the _flags_define function for valid info types) -# Output: -# string: value of dereferenced flag variable -# Returns: -# integer: one of FLAGS_{TRUE|FALSE|ERROR} -_flags_getFlagInfo() -{ - # note: adding gFI to variable names to prevent naming conflicts with calling - # functions - _flags_gFI_usName_=$1 - _flags_gFI_info_=$2 - - _flags_infoVar_="__flags_${_flags_gFI_usName_}_${_flags_gFI_info_}" - _flags_strToEval_="_flags_infoValue_=\"\${${_flags_infoVar_}:-}\"" - eval "${_flags_strToEval_}" - if [ -n "${_flags_infoValue_}" ]; then - flags_return=${FLAGS_TRUE} - else - # see if the _flags_gFI_usName_ variable is a string as strings can be - # empty... - # note: the DRY principle would say to have this function call itself for - # the next three lines, but doing so results in an infinite loop as an - # invalid _flags_name_ will also not have the associated _type variable. - # Because it doesn't (it will evaluate to an empty string) the logic will - # try to find the _type variable of the _type variable, and so on. Not so - # good ;-) - _flags_typeVar_="__flags_${_flags_gFI_usName_}_${__FLAGS_INFO_TYPE}" - _flags_strToEval_="_flags_typeValue_=\"\${${_flags_typeVar_}:-}\"" - eval "${_flags_strToEval_}" - if [ "${_flags_typeValue_}" = "${__FLAGS_TYPE_STRING}" ]; then - flags_return=${FLAGS_TRUE} - else - flags_return=${FLAGS_ERROR} - flags_error="missing flag info variable (${_flags_infoVar_})" - fi - fi - - echo "${_flags_infoValue_}" - unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ \ - _flags_strToEval_ _flags_typeValue_ _flags_typeVar_ - [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_error "${flags_error}" - return ${flags_return} -} - -# Check for presense of item in a list. -# -# Passed a string (e.g. 'abc'), this function will determine if the string is -# present in the list of strings (e.g. ' foo bar abc '). -# -# Args: -# _flags_str_: string: string to search for in a list of strings -# unnamed: list: list of strings -# Returns: -# boolean: true if item is in the list -_flags_itemInList() { - _flags_str_=$1 - shift - - echo " ${*:-} " |grep " ${_flags_str_} " >/dev/null - if [ $? -eq 0 ]; then - flags_return=${FLAGS_TRUE} - else - flags_return=${FLAGS_FALSE} - fi - - unset _flags_str_ - return ${flags_return} -} - -# Returns the width of the current screen. -# -# Output: -# integer: width in columns of the current screen. -_flags_columns() -{ - if [ -z "${__flags_columns}" ]; then - # determine the value and store it - if eval stty size >/dev/null 2>&1; then - # stty size worked :-) - set -- `stty size` - __flags_columns=$2 - elif eval tput cols >/dev/null 2>&1; then - set -- `tput cols` - __flags_columns=$1 - else - __flags_columns=80 # default terminal width - fi - fi - echo ${__flags_columns} -} - -# Validate a boolean. -# -# Args: -# _flags__bool: boolean: value to validate -# Returns: -# bool: true if the value is a valid boolean -_flags_validBool() -{ - _flags_bool_=$1 - - flags_return=${FLAGS_TRUE} - case "${_flags_bool_}" in - true|t|0) ;; - false|f|1) ;; - *) flags_return=${FLAGS_FALSE} ;; - esac - - unset _flags_bool_ - return ${flags_return} -} - -# Validate a float. -# -# Args: -# _flags_float_: float: value to validate -# Returns: -# bool: true if the value is a valid integer -_flags_validFloat() -{ - flags_return=${FLAGS_FALSE} - [ -n "$1" ] || return ${flags_return} - _flags_float_=$1 - - if _flags_validInt ${_flags_float_}; then - flags_return=${FLAGS_TRUE} - elif _flags_useBuiltin; then - _flags_float_whole_=${_flags_float_%.*} - _flags_float_fraction_=${_flags_float_#*.} - if _flags_validInt ${_flags_float_whole_:-0} -a \ - _flags_validInt ${_flags_float_fraction_}; then - flags_return=${FLAGS_TRUE} - fi - unset _flags_float_whole_ _flags_float_fraction_ - else - flags_return=${FLAGS_TRUE} - case ${_flags_float_} in - -*) # negative floats - _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\ - '\(-[0-9]*\.[0-9]*\)'` - ;; - *) # positive floats - _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\ - '\([0-9]*\.[0-9]*\)'` - ;; - esac - [ "${_flags_test_}" != "${_flags_float_}" ] && flags_return=${FLAGS_FALSE} - unset _flags_test_ - fi - - unset _flags_float_ _flags_float_whole_ _flags_float_fraction_ - return ${flags_return} -} - -# Validate an integer. -# -# Args: -# _flags_int_: integer: value to validate -# Returns: -# bool: true if the value is a valid integer -_flags_validInt() -{ - flags_return=${FLAGS_FALSE} - [ -n "$1" ] || return ${flags_return} - _flags_int_=$1 - - case ${_flags_int_} in - -*.*) ;; # ignore negative floats (we'll invalidate them later) - -*) # strip possible leading negative sign - if _flags_useBuiltin; then - _flags_int_=${_flags_int_#-} - else - _flags_int_=`${FLAGS_EXPR_CMD} -- "${_flags_int_}" : '-\([0-9][0-9]*\)'` - fi - ;; - esac - - case ${_flags_int_} in - *[!0-9]*) flags_return=${FLAGS_FALSE} ;; - *) flags_return=${FLAGS_TRUE} ;; - esac - - unset _flags_int_ - return ${flags_return} -} - -# Parse command-line options using the standard getopt. -# -# Note: the flag options are passed around in the global __flags_opts so that -# the formatting is not lost due to shell parsing and such. -# -# Args: -# @: varies: command-line options to parse -# Returns: -# integer: a FLAGS success condition -_flags_getoptStandard() -{ - flags_return=${FLAGS_TRUE} - _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}` - - # check for spaces in passed options - for _flags_opt_ in "$@"; do - # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06 - _flags_match_=`echo "x${_flags_opt_}x" |sed 's/ //g'` - if [ "${_flags_match_}" != "x${_flags_opt_}x" ]; then - flags_error='the available getopt does not support spaces in options' - flags_return=${FLAGS_ERROR} - break - fi - done - - if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then - __flags_opts=`getopt ${_flags_shortOpts_} $@ 2>&1` - _flags_rtrn_=$? - if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then - _flags_warn "${__flags_opts}" - flags_error='unable to parse provided options with getopt.' - flags_return=${FLAGS_ERROR} - fi - fi - - unset _flags_match_ _flags_opt_ _flags_rtrn_ _flags_shortOpts_ - return ${flags_return} -} - -# Parse command-line options using the enhanced getopt. -# -# Note: the flag options are passed around in the global __flags_opts so that -# the formatting is not lost due to shell parsing and such. -# -# Args: -# @: varies: command-line options to parse -# Returns: -# integer: a FLAGS success condition -_flags_getoptEnhanced() -{ - flags_return=${FLAGS_TRUE} - _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}` - _flags_boolOpts_=`echo "${__flags_boolNames}" \ - |sed 's/^ *//;s/ *$//;s/ /,/g'` - _flags_longOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_LONG}` - - __flags_opts=`${FLAGS_GETOPT_CMD} \ - -o ${_flags_shortOpts_} \ - -l "${_flags_longOpts_},${_flags_boolOpts_}" \ - -- "$@" 2>&1` - _flags_rtrn_=$? - if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then - _flags_warn "${__flags_opts}" - flags_error='unable to parse provided options with getopt.' - flags_return=${FLAGS_ERROR} - fi - - unset _flags_boolOpts_ _flags_longOpts_ _flags_rtrn_ _flags_shortOpts_ - return ${flags_return} -} - -# Dynamically parse a getopt result and set appropriate variables. -# -# This function does the actual conversion of getopt output and runs it through -# the standard case structure for parsing. The case structure is actually quite -# dynamic to support any number of flags. -# -# Args: -# argc: int: original command-line argument count -# @: varies: output from getopt parsing -# Returns: -# integer: a FLAGS success condition -_flags_parseGetopt() -{ - _flags_argc_=$1 - shift - - flags_return=${FLAGS_TRUE} - - if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then - set -- $@ - else - # note the quotes around the `$@' -- they are essential! - eval set -- "$@" - fi - - # Provide user with the number of arguments to shift by later. - # NOTE: the FLAGS_ARGC variable is obsolete as of 1.0.3 because it does not - # properly give user access to non-flag arguments mixed in between flag - # arguments. Its usage was replaced by FLAGS_ARGV, and it is being kept only - # for backwards compatibility reasons. - FLAGS_ARGC=`_flags_math "$# - 1 - ${_flags_argc_}"` - - # handle options. note options with values must do an additional shift - while true; do - _flags_opt_=$1 - _flags_arg_=${2:-} - _flags_type_=${__FLAGS_TYPE_NONE} - _flags_name_='' - - # determine long flag name - case "${_flags_opt_}" in - --) shift; break ;; # discontinue option parsing - - --*) # long option - if _flags_useBuiltin; then - _flags_opt_=${_flags_opt_#*--} - else - _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '--\(.*\)'` - fi - _flags_len_=${__FLAGS_LEN_LONG} - if _flags_itemInList "${_flags_opt_}" ${__flags_longNames}; then - _flags_name_=${_flags_opt_} - else - # check for negated long boolean version - if _flags_itemInList "${_flags_opt_}" ${__flags_boolNames}; then - if _flags_useBuiltin; then - _flags_name_=${_flags_opt_#*no} - else - _flags_name_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : 'no\(.*\)'` - fi - _flags_type_=${__FLAGS_TYPE_BOOLEAN} - _flags_arg_=${__FLAGS_NULL} - fi - fi - ;; - - -*) # short option - if _flags_useBuiltin; then - _flags_opt_=${_flags_opt_#*-} - else - _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '-\(.*\)'` - fi - _flags_len_=${__FLAGS_LEN_SHORT} - if _flags_itemInList "${_flags_opt_}" ${__flags_shortNames}; then - # yes. match short name to long name. note purposeful off-by-one - # (too high) with awk calculations. - _flags_pos_=`echo "${__flags_shortNames}" \ - |awk 'BEGIN{RS=" ";rn=0}$0==e{rn=NR}END{print rn}' \ - e=${_flags_opt_}` - _flags_name_=`echo "${__flags_longNames}" \ - |awk 'BEGIN{RS=" "}rn==NR{print $0}' rn="${_flags_pos_}"` - fi - ;; - esac - - # die if the flag was unrecognized - if [ -z "${_flags_name_}" ]; then - flags_error="unrecognized option (${_flags_opt_})" - flags_return=${FLAGS_ERROR} - break - fi - - # set new flag value - _flags_usName_=`_flags_underscoreName ${_flags_name_}` - [ ${_flags_type_} -eq ${__FLAGS_TYPE_NONE} ] && \ - _flags_type_=`_flags_getFlagInfo \ - "${_flags_usName_}" ${__FLAGS_INFO_TYPE}` - case ${_flags_type_} in - ${__FLAGS_TYPE_BOOLEAN}) - if [ ${_flags_len_} -eq ${__FLAGS_LEN_LONG} ]; then - if [ "${_flags_arg_}" != "${__FLAGS_NULL}" ]; then - eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}" - else - eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}" - fi - else - _flags_strToEval_="_flags_val_=\ -\${__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}}" - eval "${_flags_strToEval_}" - if [ ${_flags_val_} -eq ${FLAGS_FALSE} ]; then - eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}" - else - eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}" - fi - fi - ;; - - ${__FLAGS_TYPE_FLOAT}) - if _flags_validFloat "${_flags_arg_}"; then - eval "FLAGS_${_flags_usName_}='${_flags_arg_}'" - else - flags_error="invalid float value (${_flags_arg_})" - flags_return=${FLAGS_ERROR} - break - fi - ;; - - ${__FLAGS_TYPE_INTEGER}) - if _flags_validInt "${_flags_arg_}"; then - eval "FLAGS_${_flags_usName_}='${_flags_arg_}'" - else - flags_error="invalid integer value (${_flags_arg_})" - flags_return=${FLAGS_ERROR} - break - fi - ;; - - ${__FLAGS_TYPE_STRING}) - eval "FLAGS_${_flags_usName_}='${_flags_arg_}'" - ;; - esac - - # handle special case help flag - if [ "${_flags_usName_}" = 'help' ]; then - if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then - flags_help - flags_error='help requested' - flags_return=${FLAGS_TRUE} - break - fi - fi - - # shift the option and non-boolean arguements out. - shift - [ ${_flags_type_} != ${__FLAGS_TYPE_BOOLEAN} ] && shift - done - - # give user back non-flag arguments - FLAGS_ARGV='' - while [ $# -gt 0 ]; do - FLAGS_ARGV="${FLAGS_ARGV:+${FLAGS_ARGV} }'$1'" - shift - done - - unset _flags_arg_ _flags_len_ _flags_name_ _flags_opt_ _flags_pos_ \ - _flags_strToEval_ _flags_type_ _flags_usName_ _flags_val_ - return ${flags_return} -} - -# Perform some path using built-ins. -# -# Args: -# $@: string: math expression to evaluate -# Output: -# integer: the result -# Returns: -# bool: success of math evaluation -_flags_math() -{ - if [ $# -eq 0 ]; then - flags_return=${FLAGS_FALSE} - elif _flags_useBuiltin; then - # Variable assignment is needed as workaround for Solaris Bourne shell, - # which cannot parse a bare $((expression)). - _flags_expr_='$(($@))' - eval echo ${_flags_expr_} - flags_return=$? - unset _flags_expr_ - else - eval expr $@ - flags_return=$? - fi - - return ${flags_return} -} - -# Cross-platform strlen() implementation. -# -# Args: -# _flags_str: string: to determine length of -# Output: -# integer: length of string -# Returns: -# bool: success of strlen evaluation -_flags_strlen() -{ - _flags_str_=${1:-} - - if [ -z "${_flags_str_}" ]; then - flags_output=0 - elif _flags_useBuiltin; then - flags_output=${#_flags_str_} - else - flags_output=`${FLAGS_EXPR_CMD} -- "${_flags_str_}" : '.*'` - fi - flags_return=$? - - unset _flags_str_ - echo ${flags_output} - return ${flags_return} -} - -# Use built-in helper function to enable unit testing. -# -# Args: -# None -# Returns: -# bool: true if built-ins should be used -_flags_useBuiltin() -{ - return ${__FLAGS_USE_BUILTIN} -} - -#------------------------------------------------------------------------------ -# public functions -# -# A basic boolean flag. Boolean flags do not take any arguments, and their -# value is either 1 (false) or 0 (true). For long flags, the false value is -# specified on the command line by prepending the word 'no'. With short flags, -# the presense of the flag toggles the current value between true and false. -# Specifying a short boolean flag twice on the command results in returning the -# value back to the default value. -# -# A default value is required for boolean flags. -# -# For example, lets say a Boolean flag was created whose long name was 'update' -# and whose short name was 'x', and the default value was 'false'. This flag -# could be explicitly set to 'true' with '--update' or by '-x', and it could be -# explicitly set to 'false' with '--noupdate'. -DEFINE_boolean() { _flags_define ${__FLAGS_TYPE_BOOLEAN} "$@"; } - -# Other basic flags. -DEFINE_float() { _flags_define ${__FLAGS_TYPE_FLOAT} "$@"; } -DEFINE_integer() { _flags_define ${__FLAGS_TYPE_INTEGER} "$@"; } -DEFINE_string() { _flags_define ${__FLAGS_TYPE_STRING} "$@"; } - -# Parse the flags. -# -# Args: -# unnamed: list: command-line flags to parse -# Returns: -# integer: success of operation, or error -FLAGS() -{ - # define a standard 'help' flag if one isn't already defined - [ -z "${__flags_help_type:-}" ] && \ - DEFINE_boolean 'help' false 'show this help' 'h' - - # parse options - if [ $# -gt 0 ]; then - if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then - _flags_getoptStandard "$@" - else - _flags_getoptEnhanced "$@" - fi - flags_return=$? - else - # nothing passed; won't bother running getopt - __flags_opts='--' - flags_return=${FLAGS_TRUE} - fi - - if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then - _flags_parseGetopt $# "${__flags_opts}" - flags_return=$? - fi - - [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_fatal "${flags_error}" - return ${flags_return} -} - -# This is a helper function for determining the 'getopt' version for platforms -# where the detection isn't working. It simply outputs debug information that -# can be included in a bug report. -# -# Args: -# none -# Output: -# debug info that can be included in a bug report -# Returns: -# nothing -flags_getoptInfo() -{ - # platform info - _flags_debug "uname -a: `uname -a`" - _flags_debug "PATH: ${PATH}" - - # shell info - if [ -n "${BASH_VERSION:-}" ]; then - _flags_debug 'shell: bash' - _flags_debug "BASH_VERSION: ${BASH_VERSION}" - elif [ -n "${ZSH_VERSION:-}" ]; then - _flags_debug 'shell: zsh' - _flags_debug "ZSH_VERSION: ${ZSH_VERSION}" - fi - - # getopt info - ${FLAGS_GETOPT_CMD} >/dev/null - _flags_getoptReturn=$? - _flags_debug "getopt return: ${_flags_getoptReturn}" - _flags_debug "getopt --version: `${FLAGS_GETOPT_CMD} --version 2>&1`" - - unset _flags_getoptReturn -} - -# Returns whether the detected getopt version is the enhanced version. -# -# Args: -# none -# Output: -# none -# Returns: -# bool: true if getopt is the enhanced version -flags_getoptIsEnh() -{ - test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} -} - -# Returns whether the detected getopt version is the standard version. -# -# Args: -# none -# Returns: -# bool: true if getopt is the standard version -flags_getoptIsStd() -{ - test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} -} - -# This is effectively a 'usage()' function. It prints usage information and -# exits the program with ${FLAGS_FALSE} if it is ever found in the command line -# arguments. Note this function can be overridden so other apps can define -# their own --help flag, replacing this one, if they want. -# -# Args: -# none -# Returns: -# integer: success of operation (always returns true) -flags_help() -{ - if [ -n "${FLAGS_HELP:-}" ]; then - echo "${FLAGS_HELP}" >&2 - else - echo "USAGE: ${FLAGS_PARENT:-$0} [flags] args" >&2 - fi - if [ -n "${__flags_longNames}" ]; then - echo 'flags:' >&2 - for flags_name_ in ${__flags_longNames}; do - flags_flagStr_='' - flags_boolStr_='' - flags_usName_=`_flags_underscoreName ${flags_name_}` - - flags_default_=`_flags_getFlagInfo \ - "${flags_usName_}" ${__FLAGS_INFO_DEFAULT}` - flags_help_=`_flags_getFlagInfo \ - "${flags_usName_}" ${__FLAGS_INFO_HELP}` - flags_short_=`_flags_getFlagInfo \ - "${flags_usName_}" ${__FLAGS_INFO_SHORT}` - flags_type_=`_flags_getFlagInfo \ - "${flags_usName_}" ${__FLAGS_INFO_TYPE}` - - [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \ - flags_flagStr_="-${flags_short_}" - - if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} ]; then - [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \ - flags_flagStr_="${flags_flagStr_}," - # add [no] to long boolean flag names, except the 'help' flag - [ ${flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} \ - -a "${flags_usName_}" != 'help' ] && \ - flags_boolStr_='[no]' - flags_flagStr_="${flags_flagStr_}--${flags_boolStr_}${flags_name_}:" - fi - - case ${flags_type_} in - ${__FLAGS_TYPE_BOOLEAN}) - if [ ${flags_default_} -eq ${FLAGS_TRUE} ]; then - flags_defaultStr_='true' - else - flags_defaultStr_='false' - fi - ;; - ${__FLAGS_TYPE_FLOAT}|${__FLAGS_TYPE_INTEGER}) - flags_defaultStr_=${flags_default_} ;; - ${__FLAGS_TYPE_STRING}) flags_defaultStr_="'${flags_default_}'" ;; - esac - flags_defaultStr_="(default: ${flags_defaultStr_})" - - flags_helpStr_=" ${flags_flagStr_} ${flags_help_} ${flags_defaultStr_}" - _flags_strlen "${flags_helpStr_}" >/dev/null - flags_helpStrLen_=${flags_output} - flags_columns_=`_flags_columns` - - if [ ${flags_helpStrLen_} -lt ${flags_columns_} ]; then - echo "${flags_helpStr_}" >&2 - else - echo " ${flags_flagStr_} ${flags_help_}" >&2 - # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06 - # because it doesn't like empty strings when used in this manner. - flags_emptyStr_="`echo \"x${flags_flagStr_}x\" \ - |awk '{printf "%"length($0)-2"s", ""}'`" - flags_helpStr_=" ${flags_emptyStr_} ${flags_defaultStr_}" - _flags_strlen "${flags_helpStr_}" >/dev/null - flags_helpStrLen_=${flags_output} - - if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} \ - -o ${flags_helpStrLen_} -lt ${flags_columns_} ]; then - # indented to match help string - echo "${flags_helpStr_}" >&2 - else - # indented four from left to allow for longer defaults as long flag - # names might be used too, making things too long - echo " ${flags_defaultStr_}" >&2 - fi - fi - done - fi - - unset flags_boolStr_ flags_default_ flags_defaultStr_ flags_emptyStr_ \ - flags_flagStr_ flags_help_ flags_helpStr flags_helpStrLen flags_name_ \ - flags_columns_ flags_short_ flags_type_ flags_usName_ - return ${FLAGS_TRUE} -} - -# Reset shflags back to an uninitialized state. -# -# Args: -# none -# Returns: -# nothing -flags_reset() -{ - for flags_name_ in ${__flags_longNames}; do - flags_usName_=`_flags_underscoreName ${flags_name_}` - flags_strToEval_="unset FLAGS_${flags_usName_}" - for flags_type_ in \ - ${__FLAGS_INFO_DEFAULT} \ - ${__FLAGS_INFO_HELP} \ - ${__FLAGS_INFO_SHORT} \ - ${__FLAGS_INFO_TYPE} - do - flags_strToEval_=\ -"${flags_strToEval_} __flags_${flags_usName_}_${flags_type_}" - done - eval ${flags_strToEval_} - done - - # reset internal variables - __flags_boolNames=' ' - __flags_longNames=' ' - __flags_shortNames=' ' - __flags_definedNames=' ' - - unset flags_name_ flags_type_ flags_strToEval_ flags_usName_ -} diff --git a/source/1.0/lib/shlib b/source/1.0/lib/shlib deleted file mode 100644 index d294636..0000000 --- a/source/1.0/lib/shlib +++ /dev/null @@ -1,40 +0,0 @@ -# $Id: shlib 14 2007-02-18 19:43:41Z sfsetse $ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2011 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License). -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# Library of shell functions. - -# Convert a relative path into it's absolute equivalent. -# -# This function will automatically prepend the current working directory if the -# path is not already absolute. It then removes all parent references (../) to -# reconstruct the proper absolute path. -# -# Args: -# shlib_path_: string: relative path -# Outputs: -# string: absolute path -shlib_relToAbsPath() -{ - shlib_path_=$1 - - # prepend current directory to relative paths - echo "${shlib_path_}" |grep '^/' >/dev/null 2>&1 \ - || shlib_path_="`pwd`/${shlib_path_}" - - # clean up the path. if all seds supported true regular expressions, then - # this is what it would be: - shlib_old_=${shlib_path_} - while true; do - shlib_new_=`echo "${shlib_old_}" |sed 's/[^/]*\/\.\.\/*//g;s/\/\.\//\//'` - [ "${shlib_old_}" = "${shlib_new_}" ] && break - shlib_old_=${shlib_new_} - done - echo "${shlib_new_}" - - unset shlib_path_ shlib_old_ shlib_new_ -} diff --git a/source/1.0/lib/shunit2 b/source/1.0/lib/shunit2 deleted file mode 100644 index 590a5a8..0000000 --- a/source/1.0/lib/shunit2 +++ /dev/null @@ -1,1048 +0,0 @@ -#! /bin/sh -# $Id: shunit2 322 2011-04-24 00:09:45Z kate.ward@forestent.com $ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# shUnit2 -- Unit testing framework for Unix shell scripts. -# http://code.google.com/p/shunit2/ -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# shUnit2 is a xUnit based unit test framework for Bourne shell scripts. It is -# based on the popular JUnit unit testing framework for Java. - -# return if shunit already loaded -[ -n "${SHUNIT_VERSION:-}" ] && exit 0 - -SHUNIT_VERSION='2.1.6' - -SHUNIT_TRUE=0 -SHUNIT_FALSE=1 -SHUNIT_ERROR=2 - -# enable strict mode by default -SHUNIT_STRICT=${SHUNIT_STRICT:-${SHUNIT_TRUE}} - -_shunit_warn() { echo "shunit2:WARN $@" >&2; } -_shunit_error() { echo "shunit2:ERROR $@" >&2; } -_shunit_fatal() { echo "shunit2:FATAL $@" >&2; exit ${SHUNIT_ERROR}; } - -# specific shell checks -if [ -n "${ZSH_VERSION:-}" ]; then - setopt |grep "^shwordsplit$" >/dev/null - if [ $? -ne ${SHUNIT_TRUE} ]; then - _shunit_fatal 'zsh shwordsplit option is required for proper operation' - fi - if [ -z "${SHUNIT_PARENT:-}" ]; then - _shunit_fatal "zsh does not pass \$0 through properly. please declare \ -\"SHUNIT_PARENT=\$0\" before calling shUnit2" - fi -fi - -# -# constants -# - -__SHUNIT_ASSERT_MSG_PREFIX='ASSERT:' -__SHUNIT_MODE_SOURCED='sourced' -__SHUNIT_MODE_STANDALONE='standalone' -__SHUNIT_PARENT=${SHUNIT_PARENT:-$0} - -# set the constants readonly -shunit_constants_=`set |grep '^__SHUNIT_' |cut -d= -f1` -echo "${shunit_constants_}" |grep '^Binary file' >/dev/null && \ - shunit_constants_=`set |grep -a '^__SHUNIT_' |cut -d= -f1` -for shunit_constant_ in ${shunit_constants_}; do - shunit_ro_opts_='' - case ${ZSH_VERSION:-} in - '') ;; # this isn't zsh - [123].*) ;; # early versions (1.x, 2.x, 3.x) - *) shunit_ro_opts_='-g' ;; # all later versions. declare readonly globally - esac - readonly ${shunit_ro_opts_} ${shunit_constant_} -done -unset shunit_constant_ shunit_constants_ shunit_ro_opts_ - -# variables -__shunit_lineno='' # line number of executed test -__shunit_mode=${__SHUNIT_MODE_SOURCED} # operating mode -__shunit_reportGenerated=${SHUNIT_FALSE} # is report generated -__shunit_script='' # filename of unittest script (standalone mode) -__shunit_skip=${SHUNIT_FALSE} # is skipping enabled -__shunit_suite='' # suite of tests to execute - -# counts of tests -__shunit_testSuccess=${SHUNIT_TRUE} -__shunit_testsTotal=0 -__shunit_testsPassed=0 -__shunit_testsFailed=0 - -# counts of asserts -__shunit_assertsTotal=0 -__shunit_assertsPassed=0 -__shunit_assertsFailed=0 -__shunit_assertsSkipped=0 - -# macros -_SHUNIT_LINENO_='eval __shunit_lineno=""; if [ "${1:-}" = "--lineno" ]; then [ -n "$2" ] && __shunit_lineno="[$2] "; shift 2; fi' - -#----------------------------------------------------------------------------- -# assert functions -# - -# Assert that two values are equal to one another. -# -# Args: -# message: string: failure message [optional] -# expected: string: expected value -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -assertEquals() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then - _shunit_error "assertEquals() requires two or three arguments; $# given" - _shunit_error "1: ${1:+$1} 2: ${2:+$2} 3: ${3:+$3}" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - shunit_expected_=$1 - shunit_actual_=$2 - - shunit_return=${SHUNIT_TRUE} - if [ "${shunit_expected_}" = "${shunit_actual_}" ]; then - _shunit_assertPass - else - failNotEquals "${shunit_message_}" "${shunit_expected_}" "${shunit_actual_}" - shunit_return=${SHUNIT_FALSE} - fi - - unset shunit_message_ shunit_expected_ shunit_actual_ - return ${shunit_return} -} -_ASSERT_EQUALS_='eval assertEquals --lineno "${LINENO:-}"' - -# Assert that two values are not equal to one another. -# -# Args: -# message: string: failure message [optional] -# expected: string: expected value -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -assertNotEquals() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then - _shunit_error "assertNotEquals() requires two or three arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - shunit_expected_=$1 - shunit_actual_=$2 - - shunit_return=${SHUNIT_TRUE} - if [ "${shunit_expected_}" != "${shunit_actual_}" ]; then - _shunit_assertPass - else - failSame "${shunit_message_}" "$@" - shunit_return=${SHUNIT_FALSE} - fi - - unset shunit_message_ shunit_expected_ shunit_actual_ - return ${shunit_return} -} -_ASSERT_NOT_EQUALS_='eval assertNotEquals --lineno "${LINENO:-}"' - -# Assert that a value is null (i.e. an empty string) -# -# Args: -# message: string: failure message [optional] -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -assertNull() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 1 -o $# -gt 2 ]; then - _shunit_error "assertNull() requires one or two arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 2 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - assertTrue "${shunit_message_}" "[ -z '$1' ]" - shunit_return=$? - - unset shunit_message_ - return ${shunit_return} -} -_ASSERT_NULL_='eval assertNull --lineno "${LINENO:-}"' - -# Assert that a value is not null (i.e. a non-empty string) -# -# Args: -# message: string: failure message [optional] -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -assertNotNull() -{ - ${_SHUNIT_LINENO_} - if [ $# -gt 2 ]; then # allowing 0 arguments as $1 might actually be null - _shunit_error "assertNotNull() requires one or two arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 2 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - shunit_actual_=`_shunit_escapeCharactersInString "${1:-}"` - test -n "${shunit_actual_}" - assertTrue "${shunit_message_}" $? - shunit_return=$? - - unset shunit_actual_ shunit_message_ - return ${shunit_return} -} -_ASSERT_NOT_NULL_='eval assertNotNull --lineno "${LINENO:-}"' - -# Assert that two values are the same (i.e. equal to one another). -# -# Args: -# message: string: failure message [optional] -# expected: string: expected value -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -assertSame() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then - _shunit_error "assertSame() requires two or three arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - assertEquals "${shunit_message_}" "$1" "$2" - shunit_return=$? - - unset shunit_message_ - return ${shunit_return} -} -_ASSERT_SAME_='eval assertSame --lineno "${LINENO:-}"' - -# Assert that two values are not the same (i.e. not equal to one another). -# -# Args: -# message: string: failure message [optional] -# expected: string: expected value -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -assertNotSame() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then - _shunit_error "assertNotSame() requires two or three arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then - shunit_message_="${shunit_message_:-}$1" - shift - fi - assertNotEquals "${shunit_message_}" "$1" "$2" - shunit_return=$? - - unset shunit_message_ - return ${shunit_return} -} -_ASSERT_NOT_SAME_='eval assertNotSame --lineno "${LINENO:-}"' - -# Assert that a value or shell test condition is true. -# -# In shell, a value of 0 is true and a non-zero value is false. Any integer -# value passed can thereby be tested. -# -# Shell supports much more complicated tests though, and a means to support -# them was needed. As such, this function tests that conditions are true or -# false through evaluation rather than just looking for a true or false. -# -# The following test will succeed: -# assertTrue 0 -# assertTrue "[ 34 -gt 23 ]" -# The folloing test will fail with a message: -# assertTrue 123 -# assertTrue "test failed" "[ -r '/non/existant/file' ]" -# -# Args: -# message: string: failure message [optional] -# condition: string: integer value or shell conditional statement -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -assertTrue() -{ - ${_SHUNIT_LINENO_} - if [ $# -gt 2 ]; then - _shunit_error "assertTrue() takes one two arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 2 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - shunit_condition_=$1 - - # see if condition is an integer, i.e. a return value - shunit_match_=`expr "${shunit_condition_}" : '\([0-9]*\)'` - shunit_return=${SHUNIT_TRUE} - if [ -z "${shunit_condition_}" ]; then - # null condition - shunit_return=${SHUNIT_FALSE} - elif [ -n "${shunit_match_}" -a "${shunit_condition_}" = "${shunit_match_}" ] - then - # possible return value. treating 0 as true, and non-zero as false. - [ ${shunit_condition_} -ne 0 ] && shunit_return=${SHUNIT_FALSE} - else - # (hopefully) a condition - ( eval ${shunit_condition_} ) >/dev/null 2>&1 - [ $? -ne 0 ] && shunit_return=${SHUNIT_FALSE} - fi - - # record the test - if [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then - _shunit_assertPass - else - _shunit_assertFail "${shunit_message_}" - fi - - unset shunit_message_ shunit_condition_ shunit_match_ - return ${shunit_return} -} -_ASSERT_TRUE_='eval assertTrue --lineno "${LINENO:-}"' - -# Assert that a value or shell test condition is false. -# -# In shell, a value of 0 is true and a non-zero value is false. Any integer -# value passed can thereby be tested. -# -# Shell supports much more complicated tests though, and a means to support -# them was needed. As such, this function tests that conditions are true or -# false through evaluation rather than just looking for a true or false. -# -# The following test will succeed: -# assertFalse 1 -# assertFalse "[ 'apples' = 'oranges' ]" -# The folloing test will fail with a message: -# assertFalse 0 -# assertFalse "test failed" "[ 1 -eq 1 -a 2 -eq 2 ]" -# -# Args: -# message: string: failure message [optional] -# condition: string: integer value or shell conditional statement -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -assertFalse() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 1 -o $# -gt 2 ]; then - _shunit_error "assertFalse() quires one or two arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 2 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - shunit_condition_=$1 - - # see if condition is an integer, i.e. a return value - shunit_match_=`expr "${shunit_condition_}" : '\([0-9]*\)'` - shunit_return=${SHUNIT_TRUE} - if [ -z "${shunit_condition_}" ]; then - # null condition - shunit_return=${SHUNIT_FALSE} - elif [ -n "${shunit_match_}" -a "${shunit_condition_}" = "${shunit_match_}" ] - then - # possible return value. treating 0 as true, and non-zero as false. - [ ${shunit_condition_} -eq 0 ] && shunit_return=${SHUNIT_FALSE} - else - # (hopefully) a condition - ( eval ${shunit_condition_} ) >/dev/null 2>&1 - [ $? -eq 0 ] && shunit_return=${SHUNIT_FALSE} - fi - - # record the test - if [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then - _shunit_assertPass - else - _shunit_assertFail "${shunit_message_}" - fi - - unset shunit_message_ shunit_condition_ shunit_match_ - return ${shunit_return} -} -_ASSERT_FALSE_='eval assertFalse --lineno "${LINENO:-}"' - -#----------------------------------------------------------------------------- -# failure functions -# - -# Records a test failure. -# -# Args: -# message: string: failure message [optional] -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -fail() -{ - ${_SHUNIT_LINENO_} - if [ $# -gt 1 ]; then - _shunit_error "fail() requires zero or one arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 1 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - - _shunit_assertFail "${shunit_message_}" - - unset shunit_message_ - return ${SHUNIT_FALSE} -} -_FAIL_='eval fail --lineno "${LINENO:-}"' - -# Records a test failure, stating two values were not equal. -# -# Args: -# message: string: failure message [optional] -# expected: string: expected value -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -failNotEquals() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then - _shunit_error "failNotEquals() requires one or two arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - shunit_expected_=$1 - shunit_actual_=$2 - - _shunit_assertFail "${shunit_message_:+${shunit_message_} }expected:<${shunit_expected_}> but was:<${shunit_actual_}>" - - unset shunit_message_ shunit_expected_ shunit_actual_ - return ${SHUNIT_FALSE} -} -_FAIL_NOT_EQUALS_='eval failNotEquals --lineno "${LINENO:-}"' - -# Records a test failure, stating two values should have been the same. -# -# Args: -# message: string: failure message [optional] -# expected: string: expected value -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -failSame() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then - _shunit_error "failSame() requires two or three arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - - _shunit_assertFail "${shunit_message_:+${shunit_message_} }expected not same" - - unset shunit_message_ - return ${SHUNIT_FALSE} -} -_FAIL_SAME_='eval failSame --lineno "${LINENO:-}"' - -# Records a test failure, stating two values were not equal. -# -# This is functionally equivalent to calling failNotEquals(). -# -# Args: -# message: string: failure message [optional] -# expected: string: expected value -# actual: string: actual value -# Returns: -# integer: success (TRUE/FALSE/ERROR constant) -failNotSame() -{ - ${_SHUNIT_LINENO_} - if [ $# -lt 2 -o $# -gt 3 ]; then - _shunit_error "failNotEquals() requires one or two arguments; $# given" - return ${SHUNIT_ERROR} - fi - _shunit_shouldSkip && return ${SHUNIT_TRUE} - - shunit_message_=${__shunit_lineno} - if [ $# -eq 3 ]; then - shunit_message_="${shunit_message_}$1" - shift - fi - failNotEquals "${shunit_message_}" "$1" "$2" - shunit_return=$? - - unset shunit_message_ - return ${shunit_return} -} -_FAIL_NOT_SAME_='eval failNotSame --lineno "${LINENO:-}"' - -#----------------------------------------------------------------------------- -# skipping functions -# - -# Force remaining assert and fail functions to be "skipped". -# -# This function forces the remaining assert and fail functions to be "skipped", -# i.e. they will have no effect. Each function skipped will be recorded so that -# the total of asserts and fails will not be altered. -# -# Args: -# None -startSkipping() -{ - __shunit_skip=${SHUNIT_TRUE} -} - -# Resume the normal recording behavior of assert and fail calls. -# -# Args: -# None -endSkipping() -{ - __shunit_skip=${SHUNIT_FALSE} -} - -# Returns the state of assert and fail call skipping. -# -# Args: -# None -# Returns: -# boolean: (TRUE/FALSE constant) -isSkipping() -{ - return ${__shunit_skip} -} - -#----------------------------------------------------------------------------- -# suite functions -# - -# Stub. This function should contains all unit test calls to be made. -# -# DEPRECATED (as of 2.1.0) -# -# This function can be optionally overridden by the user in their test suite. -# -# If this function exists, it will be called when shunit2 is sourced. If it -# does not exist, shunit2 will search the parent script for all functions -# beginning with the word 'test', and they will be added dynamically to the -# test suite. -# -# This function should be overridden by the user in their unit test suite. -# Note: see _shunit_mktempFunc() for actual implementation -# -# Args: -# None -#suite() { :; } # DO NOT UNCOMMENT THIS FUNCTION - -# Adds a function name to the list of tests schedule for execution. -# -# This function should only be called from within the suite() function. -# -# Args: -# function: string: name of a function to add to current unit test suite -suite_addTest() -{ - shunit_func_=${1:-} - - __shunit_suite="${__shunit_suite:+${__shunit_suite} }${shunit_func_}" - __shunit_testsTotal=`expr ${__shunit_testsTotal} + 1` - - unset shunit_func_ -} - -# Stub. This function will be called once before any tests are run. -# -# Common one-time environment preparation tasks shared by all tests can be -# defined here. -# -# This function should be overridden by the user in their unit test suite. -# Note: see _shunit_mktempFunc() for actual implementation -# -# Args: -# None -#oneTimeSetUp() { :; } # DO NOT UNCOMMENT THIS FUNCTION - -# Stub. This function will be called once after all tests are finished. -# -# Common one-time environment cleanup tasks shared by all tests can be defined -# here. -# -# This function should be overridden by the user in their unit test suite. -# Note: see _shunit_mktempFunc() for actual implementation -# -# Args: -# None -#oneTimeTearDown() { :; } # DO NOT UNCOMMENT THIS FUNCTION - -# Stub. This function will be called before each test is run. -# -# Common environment preparation tasks shared by all tests can be defined here. -# -# This function should be overridden by the user in their unit test suite. -# Note: see _shunit_mktempFunc() for actual implementation -# -# Args: -# None -#setUp() { :; } - -# Note: see _shunit_mktempFunc() for actual implementation -# Stub. This function will be called after each test is run. -# -# Common environment cleanup tasks shared by all tests can be defined here. -# -# This function should be overridden by the user in their unit test suite. -# Note: see _shunit_mktempFunc() for actual implementation -# -# Args: -# None -#tearDown() { :; } # DO NOT UNCOMMENT THIS FUNCTION - -#------------------------------------------------------------------------------ -# internal shUnit2 functions -# - -# Create a temporary directory to store various run-time files in. -# -# This function is a cross-platform temporary directory creation tool. Not all -# OSes have the mktemp function, so one is included here. -# -# Args: -# None -# Outputs: -# string: the temporary directory that was created -_shunit_mktempDir() -{ - # try the standard mktemp function - ( exec mktemp -dqt shunit.XXXXXX 2>/dev/null ) && return - - # the standard mktemp didn't work. doing our own. - if [ -r '/dev/urandom' -a -x '/usr/bin/od' ]; then - _shunit_random_=`/usr/bin/od -vAn -N4 -tx4 </dev/urandom \ - |sed 's/^[^0-9a-f]*//'` - elif [ -n "${RANDOM:-}" ]; then - # $RANDOM works - _shunit_random_=${RANDOM}${RANDOM}${RANDOM}$$ - else - # $RANDOM doesn't work - _shunit_date_=`date '+%Y%m%d%H%M%S'` - _shunit_random_=`expr ${_shunit_date_} / $$` - fi - - _shunit_tmpDir_="${TMPDIR:-/tmp}/shunit.${_shunit_random_}" - ( umask 077 && mkdir "${_shunit_tmpDir_}" ) || \ - _shunit_fatal 'could not create temporary directory! exiting' - - echo ${_shunit_tmpDir_} - unset _shunit_date_ _shunit_random_ _shunit_tmpDir_ -} - -# This function is here to work around issues in Cygwin. -# -# Args: -# None -_shunit_mktempFunc() -{ - for _shunit_func_ in oneTimeSetUp oneTimeTearDown setUp tearDown suite noexec - do - _shunit_file_="${__shunit_tmpDir}/${_shunit_func_}" - cat <<EOF >"${_shunit_file_}" -#! /bin/sh -exit ${SHUNIT_TRUE} -EOF - chmod +x "${_shunit_file_}" - done - - unset _shunit_file_ -} - -# Final cleanup function to leave things as we found them. -# -# Besides removing the temporary directory, this function is in charge of the -# final exit code of the unit test. The exit code is based on how the script -# was ended (e.g. normal exit, or via Ctrl-C). -# -# Args: -# name: string: name of the trap called (specified when trap defined) -_shunit_cleanup() -{ - _shunit_name_=$1 - - case ${_shunit_name_} in - EXIT) _shunit_signal_=0 ;; - INT) _shunit_signal_=2 ;; - TERM) _shunit_signal_=15 ;; - *) - _shunit_warn "unrecognized trap value (${_shunit_name_})" - _shunit_signal_=0 - ;; - esac - - # do our work - rm -fr "${__shunit_tmpDir}" - - # exit for all non-EXIT signals - if [ ${_shunit_name_} != 'EXIT' ]; then - _shunit_warn "trapped and now handling the (${_shunit_name_}) signal" - # disable EXIT trap - trap 0 - # add 128 to signal and exit - exit `expr ${_shunit_signal_} + 128` - elif [ ${__shunit_reportGenerated} -eq ${SHUNIT_FALSE} ] ; then - _shunit_assertFail 'Unknown failure encountered running a test' - _shunit_generateReport - exit ${SHUNIT_ERROR} - fi - - unset _shunit_name_ _shunit_signal_ -} - -# The actual running of the tests happens here. -# -# Args: -# None -_shunit_execSuite() -{ - for _shunit_test_ in ${__shunit_suite}; do - __shunit_testSuccess=${SHUNIT_TRUE} - - # disable skipping - endSkipping - - # execute the per-test setup function - setUp - - # execute the test - echo "${_shunit_test_}" - eval ${_shunit_test_} - - # execute the per-test tear-down function - tearDown - - # update stats - if [ ${__shunit_testSuccess} -eq ${SHUNIT_TRUE} ]; then - __shunit_testsPassed=`expr ${__shunit_testsPassed} + 1` - else - __shunit_testsFailed=`expr ${__shunit_testsFailed} + 1` - fi - done - - unset _shunit_test_ -} - -# Generates the user friendly report with appropriate OK/FAILED message. -# -# Args: -# None -# Output: -# string: the report of successful and failed tests, as well as totals. -_shunit_generateReport() -{ - _shunit_ok_=${SHUNIT_TRUE} - - # if no exit code was provided one, determine an appropriate one - [ ${__shunit_testsFailed} -gt 0 \ - -o ${__shunit_testSuccess} -eq ${SHUNIT_FALSE} ] \ - && _shunit_ok_=${SHUNIT_FALSE} - - echo - if [ ${__shunit_testsTotal} -eq 1 ]; then - echo "Ran ${__shunit_testsTotal} test." - else - echo "Ran ${__shunit_testsTotal} tests." - fi - - _shunit_failures_='' - _shunit_skipped_='' - [ ${__shunit_assertsFailed} -gt 0 ] \ - && _shunit_failures_="failures=${__shunit_assertsFailed}" - [ ${__shunit_assertsSkipped} -gt 0 ] \ - && _shunit_skipped_="skipped=${__shunit_assertsSkipped}" - - if [ ${_shunit_ok_} -eq ${SHUNIT_TRUE} ]; then - _shunit_msg_='OK' - [ -n "${_shunit_skipped_}" ] \ - && _shunit_msg_="${_shunit_msg_} (${_shunit_skipped_})" - else - _shunit_msg_="FAILED (${_shunit_failures_}" - [ -n "${_shunit_skipped_}" ] \ - && _shunit_msg_="${_shunit_msg_},${_shunit_skipped_}" - _shunit_msg_="${_shunit_msg_})" - fi - - echo - echo ${_shunit_msg_} - __shunit_reportGenerated=${SHUNIT_TRUE} - - unset _shunit_failures_ _shunit_msg_ _shunit_ok_ _shunit_skipped_ -} - -# Test for whether a function should be skipped. -# -# Args: -# None -# Returns: -# boolean: whether the test should be skipped (TRUE/FALSE constant) -_shunit_shouldSkip() -{ - [ ${__shunit_skip} -eq ${SHUNIT_FALSE} ] && return ${SHUNIT_FALSE} - _shunit_assertSkip -} - -# Records a successful test. -# -# Args: -# None -_shunit_assertPass() -{ - __shunit_assertsPassed=`expr ${__shunit_assertsPassed} + 1` - __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1` -} - -# Records a test failure. -# -# Args: -# message: string: failure message to provide user -_shunit_assertFail() -{ - _shunit_msg_=$1 - - __shunit_testSuccess=${SHUNIT_FALSE} - __shunit_assertsFailed=`expr ${__shunit_assertsFailed} + 1` - __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1` - echo "${__SHUNIT_ASSERT_MSG_PREFIX}${_shunit_msg_}" - - unset _shunit_msg_ -} - -# Records a skipped test. -# -# Args: -# None -_shunit_assertSkip() -{ - __shunit_assertsSkipped=`expr ${__shunit_assertsSkipped} + 1` - __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1` -} - -# Prepare a script filename for sourcing. -# -# Args: -# script: string: path to a script to source -# Returns: -# string: filename prefixed with ./ (if necessary) -_shunit_prepForSourcing() -{ - _shunit_script_=$1 - case "${_shunit_script_}" in - /*|./*) echo "${_shunit_script_}" ;; - *) echo "./${_shunit_script_}" ;; - esac - unset _shunit_script_ -} - -# Escape a character in a string. -# -# Args: -# c: string: unescaped character -# s: string: to escape character in -# Returns: -# string: with escaped character(s) -_shunit_escapeCharInStr() -{ - [ -n "$2" ] || return # no point in doing work on an empty string - - # Note: using shorter variable names to prevent conflicts with - # _shunit_escapeCharactersInString(). - _shunit_c_=$1 - _shunit_s_=$2 - - - # escape the character - echo ''${_shunit_s_}'' |sed 's/\'${_shunit_c_}'/\\\'${_shunit_c_}'/g' - - unset _shunit_c_ _shunit_s_ -} - -# Escape a character in a string. -# -# Args: -# str: string: to escape characters in -# Returns: -# string: with escaped character(s) -_shunit_escapeCharactersInString() -{ - [ -n "$1" ] || return # no point in doing work on an empty string - - _shunit_str_=$1 - - # Note: using longer variable names to prevent conflicts with - # _shunit_escapeCharInStr(). - for _shunit_char_ in '"' '$' "'" '`'; do - _shunit_str_=`_shunit_escapeCharInStr "${_shunit_char_}" "${_shunit_str_}"` - done - - echo "${_shunit_str_}" - unset _shunit_char_ _shunit_str_ -} - -# Extract list of functions to run tests against. -# -# Args: -# script: string: name of script to extract functions from -# Returns: -# string: of function names -_shunit_extractTestFunctions() -{ - _shunit_script_=$1 - - # extract the lines with test function names, strip of anything besides the - # function name, and output everything on a single line. - _shunit_regex_='^[ ]*(function )*test[A-Za-z0-9_]* *\(\)' - egrep "${_shunit_regex_}" "${_shunit_script_}" \ - |sed 's/^[^A-Za-z0-9_]*//;s/^function //;s/\([A-Za-z0-9_]*\).*/\1/g' \ - |xargs - - unset _shunit_regex_ _shunit_script_ -} - -#------------------------------------------------------------------------------ -# main -# - -# determine the operating mode -if [ $# -eq 0 ]; then - __shunit_script=${__SHUNIT_PARENT} - __shunit_mode=${__SHUNIT_MODE_SOURCED} -else - __shunit_script=$1 - [ -r "${__shunit_script}" ] || \ - _shunit_fatal "unable to read from ${__shunit_script}" - __shunit_mode=${__SHUNIT_MODE_STANDALONE} -fi - -# create a temporary storage location -__shunit_tmpDir=`_shunit_mktempDir` - -# provide a public temporary directory for unit test scripts -# TODO(kward): document this -SHUNIT_TMPDIR="${__shunit_tmpDir}/tmp" -mkdir "${SHUNIT_TMPDIR}" - -# setup traps to clean up after ourselves -trap '_shunit_cleanup EXIT' 0 -trap '_shunit_cleanup INT' 2 -trap '_shunit_cleanup TERM' 15 - -# create phantom functions to work around issues with Cygwin -_shunit_mktempFunc -PATH="${__shunit_tmpDir}:${PATH}" - -# make sure phantom functions are executable. this will bite if /tmp (or the -# current $TMPDIR) points to a path on a partition that was mounted with the -# 'noexec' option. the noexec command was created with _shunit_mktempFunc(). -noexec 2>/dev/null || _shunit_fatal \ - 'please declare TMPDIR with path on partition with exec permission' - -# we must manually source the tests in standalone mode -if [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then - . "`_shunit_prepForSourcing \"${__shunit_script}\"`" -fi - -# execute the oneTimeSetUp function (if it exists) -oneTimeSetUp - -# execute the suite function defined in the parent test script -# deprecated as of 2.1.0 -suite - -# if no suite function was defined, dynamically build a list of functions -if [ -z "${__shunit_suite}" ]; then - shunit_funcs_=`_shunit_extractTestFunctions "${__shunit_script}"` - for shunit_func_ in ${shunit_funcs_}; do - suite_addTest ${shunit_func_} - done -fi -unset shunit_func_ shunit_funcs_ - -# execute the tests -_shunit_execSuite - -# execute the oneTimeTearDown function (if it exists) -oneTimeTearDown - -# generate the report -_shunit_generateReport - -# that's it folks -[ ${__shunit_testsFailed} -eq 0 ] -exit $? diff --git a/source/1.0/lib/versions b/source/1.0/lib/versions deleted file mode 100755 index 7ca55e7..0000000 --- a/source/1.0/lib/versions +++ /dev/null @@ -1,239 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This library provides reusable functions that determine actual names and -# versions of installed shells and the OS. The library can also be run as a -# script if set execuatable. - -ARGV0=`basename "$0"` -LSB_RELEASE='/etc/lsb-release' -VERSIONS_SHELLS="/bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/sh /bin/zsh" - -TRUE=0 -FALSE=1 -ERROR=2 - -UNAME_R=`uname -r` -UNAME_S=`uname -s` - -__versions_haveStrings=${ERROR} - -#------------------------------------------------------------------------------ -# functions -# - -versions_osName() -{ - os_name_='unrecognized' - os_system_=${UNAME_S} - case ${os_system_} in - CYGWIN_NT-*) os_name_='Cygwin' ;; - Darwin) os_name_='Mac OS X' ;; - FreeBSD) os_name_='FreeBSD' ;; - Linux) os_name_='Linux' ;; - SunOS) - if grep 'OpenSolaris' /etc/release >/dev/null; then - os_name_='OpenSolaris' - else - os_name_='Solaris' - fi - ;; - esac - - echo ${os_name_} - unset os_name_ os_system_ -} - -versions_osVersion() -{ - os_version_='unrecognized' - os_system_=${UNAME_S} - os_release_=${UNAME_R} - case ${os_system_} in - CYGWIN_NT-*) - os_version_=`expr "${os_release_}" : '\([0-9]*\.[0-9]\.[0-9]*\).*'` - ;; - Darwin) - major_='10' - sub_=`echo ${os_release_} |sed 's/^[0-9]*\.\([0-9]*\)\.[0-9]*$/\1/'` - case ${os_release_} in - 8.*) minor_='4' ;; - 9.*) minor_='5' ;; - 10.*) minor_='6' ;; - 11.*) minor_='7' ;; - 12.*) minor_='8' ;; - *) minor_='X'; sub_='X' ;; - esac - os_version_="${major_}.${minor_}.${sub_}" - ;; - FreeBSD) - os_version_=`expr "${os_release_}" : '\([0-9]*\.[0-9]*\)-.*'` - ;; - Linux) - if [ -r "${LSB_RELEASE}" ]; then - if grep -q 'DISTRIB_ID=Ubuntu' "${LSB_RELEASE}"; then - os_version_=`cat "${LSB_RELEASE}" \ - |awk -F= '$1~/DISTRIB_DESCRIPTION/{print $2}' \ - |sed 's/"//g;s/ /-/g'` - fi - elif [ -r '/etc/redhat-release' ]; then - os_version_=`cat /etc/redhat-release` - fi - ;; - SunOS) - if grep 'OpenSolaris' /etc/release >/dev/null; then - os_version_=`grep 'OpenSolaris' /etc/release |awk '{print $2"("$3")"}'` - else - major_=`echo ${os_release_} |sed 's/[0-9]*\.\([0-9]*\)/\1/'` - minor_=`grep Solaris /etc/release |sed 's/[^u]*\(u[0-9]*\).*/\1/'` - os_version_="${major_}${minor_}" - fi - ;; - esac - - echo ${os_version_} - unset os_name_ os_release_ os_version_ major_ minor_ sub_ -} - -versions_shellVersion() -{ - shell_=$1 - - if [ ! -x "${shell_}" ]; then - echo 'not installed' - return - fi - - version_='' - case ${shell_} in - */sh) - # TODO(kward): fix this - ## this could be one of any number of shells. try until one fits. - #version_=`versions_shell_bash ${shell_}` - ## dash cannot be self determined yet - #[ -z "${version_}" ] && version_=`versions_shell_ksh ${shell_}` - ## pdksh is covered in versions_shell_ksh() - #[ -z "${version_}" ] && version_=`versions_shell_zsh ${shell_}` - ;; - */bash) version_=`versions_shell_bash ${shell_}` ;; - */dash) - # simply assuming Ubuntu Linux until somebody comes up with a better - # test. the following test will return an empty string if dash is not - # installed. - version_=`versions_shell_dash` - ;; - */ksh) version_=`versions_shell_ksh ${shell_}` ;; - */pdksh) version_=`versions_shell_pdksh ${shell_}` ;; - */zsh) version_=`versions_shell_zsh ${shell_}` ;; - *) version_='invalid' - esac - - echo ${version_:-unknown} - unset shell_ version_ -} - -versions_shell_bash() -{ - $1 --version 2>&1 |grep 'GNU bash' |sed 's/.*version \([^ ]*\).*/\1/' -} - -versions_shell_dash() -{ - eval dpkg >/dev/null 2>&1 - [ $? -eq 127 ] && return # return if dpkg not found - - dpkg -l |grep ' dash ' |awk '{print $3}' -} - -versions_shell_ksh() -{ - versions_shell_=$1 - - # try a few different ways to figure out the version - versions_version_=`${versions_shell_} --version : 2>&1` - if [ $? -eq 0 ]; then - versions_version_=`echo "${versions_version_}" \ - |sed 's/.*\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*/\1/'` - else - versions_version_='' - fi - - if [ -z "${versions_version_}" ]; then - _versions_have_strings - versions_version_=`strings ${versions_shell_} 2>&1 \ - |grep Version \ - |sed 's/^.*Version \(.*\)$/\1/;s/ s+ \$$//;s/ /-/g'` - fi - - if [ -z "${versions_version_}" ]; then - versions_version_=`versions_shell_pdksh ${versions_shell_}` - fi - - echo ${versions_version_} - unset versions_shell_ versions_version_ -} - -versions_shell_pdksh() -{ - _versions_have_strings - strings $1 2>&1 \ - |grep 'PD KSH' \ - |sed -e 's/.*PD KSH \(.*\)/\1/;s/ /-/g' -} - -versions_shell_zsh() -{ - versions_shell_=$1 - - # try a few different ways to figure out the version - versions_version_=`echo 'echo ${ZSH_VERSION}' |${versions_shell_}` - - if [ -z "${versions_version_}" ]; then - versions_version_=`${versions_shell_} --version 2>&1 |awk '{print $2}'` - fi - - echo ${versions_version_} - unset versions_shell_ versions_version_ -} - -# Determine if the 'strings' binary installed. -_versions_have_strings() -{ - [ ${__versions_haveStrings} -ne ${ERROR} ] && return - eval strings /dev/null >/dev/null 2>&1 - if [ $? -eq 0 ]; then - __versions_haveStrings=${TRUE} - else - echo 'WARN: strings not installed. try installing binutils?' >&2 - __versions_haveStrings=${FALSE} - fi -} - -#------------------------------------------------------------------------------ -# main -# - -versions_main() -{ - # treat unset variables as an error - set -u - - os_name=`versions_osName` - os_version=`versions_osVersion` - echo "os: ${os_name} version: ${os_version}" - - for shell in ${VERSIONS_SHELLS}; do - shell_version=`versions_shellVersion ${shell}` - echo "shell: ${shell} version: ${shell_version}" - done -} - -if [ "${ARGV0}" = 'versions' ]; then - versions_main "$@" -fi diff --git a/source/1.0/src/shflags b/source/1.0/src/shflags deleted file mode 100644 index 726b206..0000000 --- a/source/1.0/src/shflags +++ /dev/null @@ -1,1156 +0,0 @@ -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# shFlags -- Advanced command-line flag library for Unix shell scripts. -# http://code.google.com/p/shflags/ -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# This module implements something like the google-gflags library available -# from http://code.google.com/p/google-gflags/. -# -# FLAG TYPES: This is a list of the DEFINE_*'s that you can do. All flags take -# a name, default value, help-string, and optional 'short' name (one-letter -# name). Some flags have other arguments, which are described with the flag. -# -# DEFINE_string: takes any input, and intreprets it as a string. -# -# DEFINE_boolean: does not take any arguments. Say --myflag to set -# FLAGS_myflag to true, or --nomyflag to set FLAGS_myflag to false. For short -# flags, passing the flag on the command-line negates the default value, i.e. -# if the default is true, passing the flag sets the value to false. -# -# DEFINE_float: takes an input and intreprets it as a floating point number. As -# shell does not support floats per-se, the input is merely validated as -# being a valid floating point value. -# -# DEFINE_integer: takes an input and intreprets it as an integer. -# -# SPECIAL FLAGS: There are a few flags that have special meaning: -# --help (or -?) prints a list of all the flags in a human-readable fashion -# --flagfile=foo read flags from foo. (not implemented yet) -# -- as in getopt(), terminates flag-processing -# -# EXAMPLE USAGE: -# -# -- begin hello.sh -- -# #! /bin/sh -# . ./shflags -# DEFINE_string name 'world' "somebody's name" n -# FLAGS "$@" || exit $? -# eval set -- "${FLAGS_ARGV}" -# echo "Hello, ${FLAGS_name}." -# -- end hello.sh -- -# -# $ ./hello.sh -n Kate -# Hello, Kate. -# -# CUSTOMIZABLE BEHAVIOR: -# -# A script can override the default 'getopt' command by providing the path to -# an alternate implementation by defining the FLAGS_GETOPT_CMD variable. -# -# NOTES: -# -# * Not all systems include a getopt version that supports long flags. On these -# systems, only short flags are recognized. - -#============================================================================== -# shFlags -# -# Shared attributes: -# flags_error: last error message -# flags_output: last function output (rarely valid) -# flags_return: last return value -# -# __flags_longNames: list of long names for all flags -# __flags_shortNames: list of short names for all flags -# __flags_boolNames: list of boolean flag names -# -# __flags_opts: options parsed by getopt -# -# Per-flag attributes: -# FLAGS_<flag_name>: contains value of flag named 'flag_name' -# __flags_<flag_name>_default: the default flag value -# __flags_<flag_name>_help: the flag help string -# __flags_<flag_name>_short: the flag short name -# __flags_<flag_name>_type: the flag type -# -# Notes: -# - lists of strings are space separated, and a null value is the '~' char. - -# return if FLAGS already loaded -[ -n "${FLAGS_VERSION:-}" ] && return 0 -FLAGS_VERSION='1.0.4pre' - -# return values that scripts can use -FLAGS_TRUE=0 -FLAGS_FALSE=1 -FLAGS_ERROR=2 - -# determine some reasonable command defaults -__FLAGS_UNAME_S=`uname -s` -case "${__FLAGS_UNAME_S}" in - BSD) __FLAGS_EXPR_CMD='gexpr' ;; - *) __FLAGS_EXPR_CMD='expr' ;; -esac - -# commands a user can override if needed -FLAGS_EXPR_CMD=${FLAGS_EXPR_CMD:-${__FLAGS_EXPR_CMD}} -FLAGS_GETOPT_CMD=${FLAGS_GETOPT_CMD:-getopt} - -# specific shell checks -if [ -n "${ZSH_VERSION:-}" ]; then - setopt |grep "^shwordsplit$" >/dev/null - if [ $? -ne ${FLAGS_TRUE} ]; then - _flags_fatal 'zsh shwordsplit option is required for proper zsh operation' - fi - if [ -z "${FLAGS_PARENT:-}" ]; then - _flags_fatal "zsh does not pass \$0 through properly. please declare' \ -\"FLAGS_PARENT=\$0\" before calling shFlags" - fi -fi - -# can we use built-ins? -( echo "${FLAGS_TRUE#0}"; ) >/dev/null 2>&1 -if [ $? -eq ${FLAGS_TRUE} ]; then - __FLAGS_USE_BUILTIN=${FLAGS_TRUE} -else - __FLAGS_USE_BUILTIN=${FLAGS_FALSE} -fi - -# -# constants -# - -# reserved flag names -__FLAGS_RESERVED_LIST=' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE ' -__FLAGS_RESERVED_LIST="${__FLAGS_RESERVED_LIST} VERSION " - -# getopt version -__FLAGS_GETOPT_VERS_STD=0 -__FLAGS_GETOPT_VERS_ENH=1 -__FLAGS_GETOPT_VERS_BSD=2 - -${FLAGS_GETOPT_CMD} >/dev/null 2>&1 -case $? in - 0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;; # bsd getopt - 2) - # TODO(kward): look into '-T' option to test the internal getopt() version - if [ "`${FLAGS_GETOPT_CMD} --version`" = '-- ' ]; then - __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} - else - __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_ENH} - fi - ;; - *) _flags_fatal 'unable to determine getopt version' ;; -esac - -# getopt optstring lengths -__FLAGS_OPTSTR_SHORT=0 -__FLAGS_OPTSTR_LONG=1 - -__FLAGS_NULL='~' - -# flag info strings -__FLAGS_INFO_DEFAULT='default' -__FLAGS_INFO_HELP='help' -__FLAGS_INFO_SHORT='short' -__FLAGS_INFO_TYPE='type' - -# flag lengths -__FLAGS_LEN_SHORT=0 -__FLAGS_LEN_LONG=1 - -# flag types -__FLAGS_TYPE_NONE=0 -__FLAGS_TYPE_BOOLEAN=1 -__FLAGS_TYPE_FLOAT=2 -__FLAGS_TYPE_INTEGER=3 -__FLAGS_TYPE_STRING=4 - -# set the constants readonly -__flags_constants=`set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'` -for __flags_const in ${__flags_constants}; do - # skip certain flags - case ${__flags_const} in - FLAGS_HELP) continue ;; - FLAGS_PARENT) continue ;; - esac - # set flag readonly - if [ -z "${ZSH_VERSION:-}" ]; then - readonly ${__flags_const} - else # handle zsh - case ${ZSH_VERSION} in - [123].*) readonly ${__flags_const} ;; - *) readonly -g ${__flags_const} ;; # declare readonly constants globally - esac - fi -done -unset __flags_const __flags_constants - -# -# internal variables -# - -# space separated lists -__flags_boolNames=' ' # boolean flag names -__flags_longNames=' ' # long flag names -__flags_shortNames=' ' # short flag names -__flags_definedNames=' ' # defined flag names (used for validation) - -__flags_columns='' # screen width in columns -__flags_opts='' # temporary storage for parsed getopt flags - -#------------------------------------------------------------------------------ -# private functions -# - -# logging functions -_flags_debug() { echo "flags:DEBUG $@" >&2; } -_flags_warn() { echo "flags:WARN $@" >&2; } -_flags_error() { echo "flags:ERROR $@" >&2; } -_flags_fatal() { echo "flags:FATAL $@" >&2; exit ${FLAGS_ERROR}; } - -# Define a flag. -# -# Calling this function will define the following info variables for the -# specified flag: -# FLAGS_flagname - the name for this flag (based upon the long flag name) -# __flags_<flag_name>_default - the default value -# __flags_flagname_help - the help string -# __flags_flagname_short - the single letter alias -# __flags_flagname_type - the type of flag (one of __FLAGS_TYPE_*) -# -# Args: -# _flags__type: integer: internal type of flag (__FLAGS_TYPE_*) -# _flags__name: string: long flag name -# _flags__default: default flag value -# _flags__help: string: help string -# _flags__short: string: (optional) short flag name -# Returns: -# integer: success of operation, or error -_flags_define() -{ - if [ $# -lt 4 ]; then - flags_error='DEFINE error: too few arguments' - flags_return=${FLAGS_ERROR} - _flags_error "${flags_error}" - return ${flags_return} - fi - - _flags_type_=$1 - _flags_name_=$2 - _flags_default_=$3 - _flags_help_=$4 - _flags_short_=${5:-${__FLAGS_NULL}} - - _flags_return_=${FLAGS_TRUE} - _flags_usName_=`_flags_underscoreName ${_flags_name_}` - - # check whether the flag name is reserved - _flags_itemInList ${_flags_usName_} "${__FLAGS_RESERVED_LIST}" - if [ $? -eq ${FLAGS_TRUE} ]; then - flags_error="flag name (${_flags_name_}) is reserved" - _flags_return_=${FLAGS_ERROR} - fi - - # require short option for getopt that don't support long options - if [ ${_flags_return_} -eq ${FLAGS_TRUE} \ - -a ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} \ - -a "${_flags_short_}" = "${__FLAGS_NULL}" ] - then - flags_error="short flag required for (${_flags_name_}) on this platform" - _flags_return_=${FLAGS_ERROR} - fi - - # check for existing long name definition - if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then - if _flags_itemInList ${_flags_usName_} ${__flags_definedNames}; then - flags_error="definition for ([no]${_flags_name_}) already exists" - _flags_warn "${flags_error}" - _flags_return_=${FLAGS_FALSE} - fi - fi - - # check for existing short name definition - if [ ${_flags_return_} -eq ${FLAGS_TRUE} \ - -a "${_flags_short_}" != "${__FLAGS_NULL}" ] - then - if _flags_itemInList "${_flags_short_}" ${__flags_shortNames}; then - flags_error="flag short name (${_flags_short_}) already defined" - _flags_warn "${flags_error}" - _flags_return_=${FLAGS_FALSE} - fi - fi - - # handle default value. note, on several occasions the 'if' portion of an - # if/then/else contains just a ':' which does nothing. a binary reversal via - # '!' is not done because it does not work on all shells. - if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then - case ${_flags_type_} in - ${__FLAGS_TYPE_BOOLEAN}) - if _flags_validBool "${_flags_default_}"; then - case ${_flags_default_} in - true|t|0) _flags_default_=${FLAGS_TRUE} ;; - false|f|1) _flags_default_=${FLAGS_FALSE} ;; - esac - else - flags_error="invalid default flag value '${_flags_default_}'" - _flags_return_=${FLAGS_ERROR} - fi - ;; - - ${__FLAGS_TYPE_FLOAT}) - if _flags_validFloat "${_flags_default_}"; then - : - else - flags_error="invalid default flag value '${_flags_default_}'" - _flags_return_=${FLAGS_ERROR} - fi - ;; - - ${__FLAGS_TYPE_INTEGER}) - if _flags_validInt "${_flags_default_}"; then - : - else - flags_error="invalid default flag value '${_flags_default_}'" - _flags_return_=${FLAGS_ERROR} - fi - ;; - - ${__FLAGS_TYPE_STRING}) ;; # everything in shell is a valid string - - *) - flags_error="unrecognized flag type '${_flags_type_}'" - _flags_return_=${FLAGS_ERROR} - ;; - esac - fi - - if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then - # store flag information - eval "FLAGS_${_flags_usName_}='${_flags_default_}'" - eval "__flags_${_flags_usName_}_${__FLAGS_INFO_TYPE}=${_flags_type_}" - eval "__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}=\ -\"${_flags_default_}\"" - eval "__flags_${_flags_usName_}_${__FLAGS_INFO_HELP}=\"${_flags_help_}\"" - eval "__flags_${_flags_usName_}_${__FLAGS_INFO_SHORT}='${_flags_short_}'" - - # append flag names to name lists - __flags_shortNames="${__flags_shortNames}${_flags_short_} " - __flags_longNames="${__flags_longNames}${_flags_name_} " - [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \ - __flags_boolNames="${__flags_boolNames}no${_flags_name_} " - - # append flag names to defined names for later validation checks - __flags_definedNames="${__flags_definedNames}${_flags_usName_} " - [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \ - __flags_definedNames="${__flags_definedNames}no${_flags_usName_} " - fi - - flags_return=${_flags_return_} - unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ \ - _flags_short_ _flags_type_ _flags_usName_ - [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_error "${flags_error}" - return ${flags_return} -} - -# Underscore a flag name by replacing dashes with underscores. -# -# Args: -# unnamed: string: log flag name -# Output: -# string: underscored name -_flags_underscoreName() -{ - echo $1 |tr '-' '_' -} - -# Return valid getopt options using currently defined list of long options. -# -# This function builds a proper getopt option string for short (and long) -# options, using the current list of long options for reference. -# -# Args: -# _flags_optStr: integer: option string type (__FLAGS_OPTSTR_*) -# Output: -# string: generated option string for getopt -# Returns: -# boolean: success of operation (always returns True) -_flags_genOptStr() -{ - _flags_optStrType_=$1 - - _flags_opts_='' - - for _flags_name_ in ${__flags_longNames}; do - _flags_usName_=`_flags_underscoreName ${_flags_name_}` - _flags_type_=`_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}` - [ $? -eq ${FLAGS_TRUE} ] || _flags_fatal 'call to _flags_type_ failed' - case ${_flags_optStrType_} in - ${__FLAGS_OPTSTR_SHORT}) - _flags_shortName_=`_flags_getFlagInfo \ - ${_flags_usName_} ${__FLAGS_INFO_SHORT}` - if [ "${_flags_shortName_}" != "${__FLAGS_NULL}" ]; then - _flags_opts_="${_flags_opts_}${_flags_shortName_}" - # getopt needs a trailing ':' to indicate a required argument - [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \ - _flags_opts_="${_flags_opts_}:" - fi - ;; - - ${__FLAGS_OPTSTR_LONG}) - _flags_opts_="${_flags_opts_:+${_flags_opts_},}${_flags_name_}" - # getopt needs a trailing ':' to indicate a required argument - [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \ - _flags_opts_="${_flags_opts_}:" - ;; - esac - done - - echo "${_flags_opts_}" - unset _flags_name_ _flags_opts_ _flags_optStrType_ _flags_shortName_ \ - _flags_type_ _flags_usName_ - return ${FLAGS_TRUE} -} - -# Returns flag details based on a flag name and flag info. -# -# Args: -# string: underscored flag name -# string: flag info (see the _flags_define function for valid info types) -# Output: -# string: value of dereferenced flag variable -# Returns: -# integer: one of FLAGS_{TRUE|FALSE|ERROR} -_flags_getFlagInfo() -{ - # note: adding gFI to variable names to prevent naming conflicts with calling - # functions - _flags_gFI_usName_=$1 - _flags_gFI_info_=$2 - - _flags_infoVar_="__flags_${_flags_gFI_usName_}_${_flags_gFI_info_}" - _flags_strToEval_="_flags_infoValue_=\"\${${_flags_infoVar_}:-}\"" - eval "${_flags_strToEval_}" - if [ -n "${_flags_infoValue_}" ]; then - flags_return=${FLAGS_TRUE} - else - # see if the _flags_gFI_usName_ variable is a string as strings can be - # empty... - # note: the DRY principle would say to have this function call itself for - # the next three lines, but doing so results in an infinite loop as an - # invalid _flags_name_ will also not have the associated _type variable. - # Because it doesn't (it will evaluate to an empty string) the logic will - # try to find the _type variable of the _type variable, and so on. Not so - # good ;-) - _flags_typeVar_="__flags_${_flags_gFI_usName_}_${__FLAGS_INFO_TYPE}" - _flags_strToEval_="_flags_typeValue_=\"\${${_flags_typeVar_}:-}\"" - eval "${_flags_strToEval_}" - if [ "${_flags_typeValue_}" = "${__FLAGS_TYPE_STRING}" ]; then - flags_return=${FLAGS_TRUE} - else - flags_return=${FLAGS_ERROR} - flags_error="missing flag info variable (${_flags_infoVar_})" - fi - fi - - echo "${_flags_infoValue_}" - unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ \ - _flags_strToEval_ _flags_typeValue_ _flags_typeVar_ - [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_error "${flags_error}" - return ${flags_return} -} - -# Check for presense of item in a list. -# -# Passed a string (e.g. 'abc'), this function will determine if the string is -# present in the list of strings (e.g. ' foo bar abc '). -# -# Args: -# _flags_str_: string: string to search for in a list of strings -# unnamed: list: list of strings -# Returns: -# boolean: true if item is in the list -_flags_itemInList() { - _flags_str_=$1 - shift - - echo " ${*:-} " |grep " ${_flags_str_} " >/dev/null - if [ $? -eq 0 ]; then - flags_return=${FLAGS_TRUE} - else - flags_return=${FLAGS_FALSE} - fi - - unset _flags_str_ - return ${flags_return} -} - -# Returns the width of the current screen. -# -# Output: -# integer: width in columns of the current screen. -_flags_columns() -{ - if [ -z "${__flags_columns}" ]; then - # determine the value and store it - if eval stty size >/dev/null 2>&1; then - # stty size worked :-) - set -- `stty size` - __flags_columns=$2 - elif eval tput cols >/dev/null 2>&1; then - set -- `tput cols` - __flags_columns=$1 - else - __flags_columns=80 # default terminal width - fi - fi - echo ${__flags_columns} -} - -# Validate a boolean. -# -# Args: -# _flags__bool: boolean: value to validate -# Returns: -# bool: true if the value is a valid boolean -_flags_validBool() -{ - _flags_bool_=$1 - - flags_return=${FLAGS_TRUE} - case "${_flags_bool_}" in - true|t|0) ;; - false|f|1) ;; - *) flags_return=${FLAGS_FALSE} ;; - esac - - unset _flags_bool_ - return ${flags_return} -} - -# Validate a float. -# -# Args: -# _flags_float_: float: value to validate -# Returns: -# bool: true if the value is a valid integer -_flags_validFloat() -{ - flags_return=${FLAGS_FALSE} - [ -n "$1" ] || return ${flags_return} - _flags_float_=$1 - - if _flags_validInt ${_flags_float_}; then - flags_return=${FLAGS_TRUE} - elif _flags_useBuiltin; then - _flags_float_whole_=${_flags_float_%.*} - _flags_float_fraction_=${_flags_float_#*.} - if _flags_validInt ${_flags_float_whole_:-0} -a \ - _flags_validInt ${_flags_float_fraction_}; then - flags_return=${FLAGS_TRUE} - fi - unset _flags_float_whole_ _flags_float_fraction_ - else - flags_return=${FLAGS_TRUE} - case ${_flags_float_} in - -*) # negative floats - _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\ - '\(-[0-9]*\.[0-9]*\)'` - ;; - *) # positive floats - _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\ - '\([0-9]*\.[0-9]*\)'` - ;; - esac - [ "${_flags_test_}" != "${_flags_float_}" ] && flags_return=${FLAGS_FALSE} - unset _flags_test_ - fi - - unset _flags_float_ _flags_float_whole_ _flags_float_fraction_ - return ${flags_return} -} - -# Validate an integer. -# -# Args: -# _flags_int_: integer: value to validate -# Returns: -# bool: true if the value is a valid integer -_flags_validInt() -{ - flags_return=${FLAGS_FALSE} - [ -n "$1" ] || return ${flags_return} - _flags_int_=$1 - - case ${_flags_int_} in - -*.*) ;; # ignore negative floats (we'll invalidate them later) - -*) # strip possible leading negative sign - if _flags_useBuiltin; then - _flags_int_=${_flags_int_#-} - else - _flags_int_=`${FLAGS_EXPR_CMD} -- "${_flags_int_}" : '-\([0-9][0-9]*\)'` - fi - ;; - esac - - case ${_flags_int_} in - *[!0-9]*) flags_return=${FLAGS_FALSE} ;; - *) flags_return=${FLAGS_TRUE} ;; - esac - - unset _flags_int_ - return ${flags_return} -} - -# Parse command-line options using the standard getopt. -# -# Note: the flag options are passed around in the global __flags_opts so that -# the formatting is not lost due to shell parsing and such. -# -# Args: -# @: varies: command-line options to parse -# Returns: -# integer: a FLAGS success condition -_flags_getoptStandard() -{ - flags_return=${FLAGS_TRUE} - _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}` - - # check for spaces in passed options - for _flags_opt_ in "$@"; do - # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06 - _flags_match_=`echo "x${_flags_opt_}x" |sed 's/ //g'` - if [ "${_flags_match_}" != "x${_flags_opt_}x" ]; then - flags_error='the available getopt does not support spaces in options' - flags_return=${FLAGS_ERROR} - break - fi - done - - if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then - __flags_opts=`getopt ${_flags_shortOpts_} $@ 2>&1` - _flags_rtrn_=$? - if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then - _flags_warn "${__flags_opts}" - flags_error='unable to parse provided options with getopt.' - flags_return=${FLAGS_ERROR} - fi - fi - - unset _flags_match_ _flags_opt_ _flags_rtrn_ _flags_shortOpts_ - return ${flags_return} -} - -# Parse command-line options using the enhanced getopt. -# -# Note: the flag options are passed around in the global __flags_opts so that -# the formatting is not lost due to shell parsing and such. -# -# Args: -# @: varies: command-line options to parse -# Returns: -# integer: a FLAGS success condition -_flags_getoptEnhanced() -{ - flags_return=${FLAGS_TRUE} - _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}` - _flags_boolOpts_=`echo "${__flags_boolNames}" \ - |sed 's/^ *//;s/ *$//;s/ /,/g'` - _flags_longOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_LONG}` - - __flags_opts=`${FLAGS_GETOPT_CMD} \ - -o ${_flags_shortOpts_} \ - -l "${_flags_longOpts_},${_flags_boolOpts_}" \ - -- "$@" 2>&1` - _flags_rtrn_=$? - if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then - _flags_warn "${__flags_opts}" - flags_error='unable to parse provided options with getopt.' - flags_return=${FLAGS_ERROR} - fi - - unset _flags_boolOpts_ _flags_longOpts_ _flags_rtrn_ _flags_shortOpts_ - return ${flags_return} -} - -# Dynamically parse a getopt result and set appropriate variables. -# -# This function does the actual conversion of getopt output and runs it through -# the standard case structure for parsing. The case structure is actually quite -# dynamic to support any number of flags. -# -# Args: -# argc: int: original command-line argument count -# @: varies: output from getopt parsing -# Returns: -# integer: a FLAGS success condition -_flags_parseGetopt() -{ - _flags_argc_=$1 - shift - - flags_return=${FLAGS_TRUE} - - if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then - set -- $@ - else - # note the quotes around the `$@' -- they are essential! - eval set -- "$@" - fi - - # Provide user with the number of arguments to shift by later. - # NOTE: the FLAGS_ARGC variable is obsolete as of 1.0.3 because it does not - # properly give user access to non-flag arguments mixed in between flag - # arguments. Its usage was replaced by FLAGS_ARGV, and it is being kept only - # for backwards compatibility reasons. - FLAGS_ARGC=`_flags_math "$# - 1 - ${_flags_argc_}"` - - # handle options. note options with values must do an additional shift - while true; do - _flags_opt_=$1 - _flags_arg_=${2:-} - _flags_type_=${__FLAGS_TYPE_NONE} - _flags_name_='' - - # determine long flag name - case "${_flags_opt_}" in - --) shift; break ;; # discontinue option parsing - - --*) # long option - if _flags_useBuiltin; then - _flags_opt_=${_flags_opt_#*--} - else - _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '--\(.*\)'` - fi - _flags_len_=${__FLAGS_LEN_LONG} - if _flags_itemInList "${_flags_opt_}" ${__flags_longNames}; then - _flags_name_=${_flags_opt_} - else - # check for negated long boolean version - if _flags_itemInList "${_flags_opt_}" ${__flags_boolNames}; then - if _flags_useBuiltin; then - _flags_name_=${_flags_opt_#*no} - else - _flags_name_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : 'no\(.*\)'` - fi - _flags_type_=${__FLAGS_TYPE_BOOLEAN} - _flags_arg_=${__FLAGS_NULL} - fi - fi - ;; - - -*) # short option - if _flags_useBuiltin; then - _flags_opt_=${_flags_opt_#*-} - else - _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '-\(.*\)'` - fi - _flags_len_=${__FLAGS_LEN_SHORT} - if _flags_itemInList "${_flags_opt_}" ${__flags_shortNames}; then - # yes. match short name to long name. note purposeful off-by-one - # (too high) with awk calculations. - _flags_pos_=`echo "${__flags_shortNames}" \ - |awk 'BEGIN{RS=" ";rn=0}$0==e{rn=NR}END{print rn}' \ - e=${_flags_opt_}` - _flags_name_=`echo "${__flags_longNames}" \ - |awk 'BEGIN{RS=" "}rn==NR{print $0}' rn="${_flags_pos_}"` - fi - ;; - esac - - # die if the flag was unrecognized - if [ -z "${_flags_name_}" ]; then - flags_error="unrecognized option (${_flags_opt_})" - flags_return=${FLAGS_ERROR} - break - fi - - # set new flag value - _flags_usName_=`_flags_underscoreName ${_flags_name_}` - [ ${_flags_type_} -eq ${__FLAGS_TYPE_NONE} ] && \ - _flags_type_=`_flags_getFlagInfo \ - "${_flags_usName_}" ${__FLAGS_INFO_TYPE}` - case ${_flags_type_} in - ${__FLAGS_TYPE_BOOLEAN}) - if [ ${_flags_len_} -eq ${__FLAGS_LEN_LONG} ]; then - if [ "${_flags_arg_}" != "${__FLAGS_NULL}" ]; then - eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}" - else - eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}" - fi - else - _flags_strToEval_="_flags_val_=\ -\${__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}}" - eval "${_flags_strToEval_}" - if [ ${_flags_val_} -eq ${FLAGS_FALSE} ]; then - eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}" - else - eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}" - fi - fi - ;; - - ${__FLAGS_TYPE_FLOAT}) - if _flags_validFloat "${_flags_arg_}"; then - eval "FLAGS_${_flags_usName_}='${_flags_arg_}'" - else - flags_error="invalid float value (${_flags_arg_})" - flags_return=${FLAGS_ERROR} - break - fi - ;; - - ${__FLAGS_TYPE_INTEGER}) - if _flags_validInt "${_flags_arg_}"; then - eval "FLAGS_${_flags_usName_}='${_flags_arg_}'" - else - flags_error="invalid integer value (${_flags_arg_})" - flags_return=${FLAGS_ERROR} - break - fi - ;; - - ${__FLAGS_TYPE_STRING}) - eval "FLAGS_${_flags_usName_}='${_flags_arg_}'" - ;; - esac - - # handle special case help flag - if [ "${_flags_usName_}" = 'help' ]; then - if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then - flags_help - flags_error='help requested' - flags_return=${FLAGS_TRUE} - break - fi - fi - - # shift the option and non-boolean arguements out. - shift - [ ${_flags_type_} != ${__FLAGS_TYPE_BOOLEAN} ] && shift - done - - # give user back non-flag arguments - FLAGS_ARGV='' - while [ $# -gt 0 ]; do - FLAGS_ARGV="${FLAGS_ARGV:+${FLAGS_ARGV} }'$1'" - shift - done - - unset _flags_arg_ _flags_len_ _flags_name_ _flags_opt_ _flags_pos_ \ - _flags_strToEval_ _flags_type_ _flags_usName_ _flags_val_ - return ${flags_return} -} - -# Perform some path using built-ins. -# -# Args: -# $@: string: math expression to evaluate -# Output: -# integer: the result -# Returns: -# bool: success of math evaluation -_flags_math() -{ - if [ $# -eq 0 ]; then - flags_return=${FLAGS_FALSE} - elif _flags_useBuiltin; then - # Variable assignment is needed as workaround for Solaris Bourne shell, - # which cannot parse a bare $((expression)). - _flags_expr_='$(($@))' - eval echo ${_flags_expr_} - flags_return=$? - unset _flags_expr_ - else - eval expr $@ - flags_return=$? - fi - - return ${flags_return} -} - -# Cross-platform strlen() implementation. -# -# Args: -# _flags_str: string: to determine length of -# Output: -# integer: length of string -# Returns: -# bool: success of strlen evaluation -_flags_strlen() -{ - _flags_str_=${1:-} - - if [ -z "${_flags_str_}" ]; then - flags_output=0 - elif _flags_useBuiltin; then - flags_output=${#_flags_str_} - else - flags_output=`${FLAGS_EXPR_CMD} -- "${_flags_str_}" : '.*'` - fi - flags_return=$? - - unset _flags_str_ - echo ${flags_output} - return ${flags_return} -} - -# Use built-in helper function to enable unit testing. -# -# Args: -# None -# Returns: -# bool: true if built-ins should be used -_flags_useBuiltin() -{ - return ${__FLAGS_USE_BUILTIN} -} - -#------------------------------------------------------------------------------ -# public functions -# -# A basic boolean flag. Boolean flags do not take any arguments, and their -# value is either 1 (false) or 0 (true). For long flags, the false value is -# specified on the command line by prepending the word 'no'. With short flags, -# the presense of the flag toggles the current value between true and false. -# Specifying a short boolean flag twice on the command results in returning the -# value back to the default value. -# -# A default value is required for boolean flags. -# -# For example, lets say a Boolean flag was created whose long name was 'update' -# and whose short name was 'x', and the default value was 'false'. This flag -# could be explicitly set to 'true' with '--update' or by '-x', and it could be -# explicitly set to 'false' with '--noupdate'. -DEFINE_boolean() { _flags_define ${__FLAGS_TYPE_BOOLEAN} "$@"; } - -# Other basic flags. -DEFINE_float() { _flags_define ${__FLAGS_TYPE_FLOAT} "$@"; } -DEFINE_integer() { _flags_define ${__FLAGS_TYPE_INTEGER} "$@"; } -DEFINE_string() { _flags_define ${__FLAGS_TYPE_STRING} "$@"; } - -# Parse the flags. -# -# Args: -# unnamed: list: command-line flags to parse -# Returns: -# integer: success of operation, or error -FLAGS() -{ - # define a standard 'help' flag if one isn't already defined - [ -z "${__flags_help_type:-}" ] && \ - DEFINE_boolean 'help' false 'show this help' 'h' - - # parse options - if [ $# -gt 0 ]; then - if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then - _flags_getoptStandard "$@" - else - _flags_getoptEnhanced "$@" - fi - flags_return=$? - else - # nothing passed; won't bother running getopt - __flags_opts='--' - flags_return=${FLAGS_TRUE} - fi - - if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then - _flags_parseGetopt $# "${__flags_opts}" - flags_return=$? - fi - - [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_fatal "${flags_error}" - return ${flags_return} -} - -# This is a helper function for determining the 'getopt' version for platforms -# where the detection isn't working. It simply outputs debug information that -# can be included in a bug report. -# -# Args: -# none -# Output: -# debug info that can be included in a bug report -# Returns: -# nothing -flags_getoptInfo() -{ - # platform info - _flags_debug "uname -a: `uname -a`" - _flags_debug "PATH: ${PATH}" - - # shell info - if [ -n "${BASH_VERSION:-}" ]; then - _flags_debug 'shell: bash' - _flags_debug "BASH_VERSION: ${BASH_VERSION}" - elif [ -n "${ZSH_VERSION:-}" ]; then - _flags_debug 'shell: zsh' - _flags_debug "ZSH_VERSION: ${ZSH_VERSION}" - fi - - # getopt info - ${FLAGS_GETOPT_CMD} >/dev/null - _flags_getoptReturn=$? - _flags_debug "getopt return: ${_flags_getoptReturn}" - _flags_debug "getopt --version: `${FLAGS_GETOPT_CMD} --version 2>&1`" - - unset _flags_getoptReturn -} - -# Returns whether the detected getopt version is the enhanced version. -# -# Args: -# none -# Output: -# none -# Returns: -# bool: true if getopt is the enhanced version -flags_getoptIsEnh() -{ - test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} -} - -# Returns whether the detected getopt version is the standard version. -# -# Args: -# none -# Returns: -# bool: true if getopt is the standard version -flags_getoptIsStd() -{ - test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} -} - -# This is effectively a 'usage()' function. It prints usage information and -# exits the program with ${FLAGS_FALSE} if it is ever found in the command line -# arguments. Note this function can be overridden so other apps can define -# their own --help flag, replacing this one, if they want. -# -# Args: -# none -# Returns: -# integer: success of operation (always returns true) -flags_help() -{ - if [ -n "${FLAGS_HELP:-}" ]; then - echo "${FLAGS_HELP}" >&2 - else - echo "USAGE: ${FLAGS_PARENT:-$0} [flags] args" >&2 - fi - if [ -n "${__flags_longNames}" ]; then - echo 'flags:' >&2 - for flags_name_ in ${__flags_longNames}; do - flags_flagStr_='' - flags_boolStr_='' - flags_usName_=`_flags_underscoreName ${flags_name_}` - - flags_default_=`_flags_getFlagInfo \ - "${flags_usName_}" ${__FLAGS_INFO_DEFAULT}` - flags_help_=`_flags_getFlagInfo \ - "${flags_usName_}" ${__FLAGS_INFO_HELP}` - flags_short_=`_flags_getFlagInfo \ - "${flags_usName_}" ${__FLAGS_INFO_SHORT}` - flags_type_=`_flags_getFlagInfo \ - "${flags_usName_}" ${__FLAGS_INFO_TYPE}` - - [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \ - flags_flagStr_="-${flags_short_}" - - if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} ]; then - [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \ - flags_flagStr_="${flags_flagStr_}," - # add [no] to long boolean flag names, except the 'help' flag - [ ${flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} \ - -a "${flags_usName_}" != 'help' ] && \ - flags_boolStr_='[no]' - flags_flagStr_="${flags_flagStr_}--${flags_boolStr_}${flags_name_}:" - fi - - case ${flags_type_} in - ${__FLAGS_TYPE_BOOLEAN}) - if [ ${flags_default_} -eq ${FLAGS_TRUE} ]; then - flags_defaultStr_='true' - else - flags_defaultStr_='false' - fi - ;; - ${__FLAGS_TYPE_FLOAT}|${__FLAGS_TYPE_INTEGER}) - flags_defaultStr_=${flags_default_} ;; - ${__FLAGS_TYPE_STRING}) flags_defaultStr_="'${flags_default_}'" ;; - esac - flags_defaultStr_="(default: ${flags_defaultStr_})" - - flags_helpStr_=" ${flags_flagStr_} ${flags_help_} ${flags_defaultStr_}" - _flags_strlen "${flags_helpStr_}" >/dev/null - flags_helpStrLen_=${flags_output} - flags_columns_=`_flags_columns` - - if [ ${flags_helpStrLen_} -lt ${flags_columns_} ]; then - echo "${flags_helpStr_}" >&2 - else - echo " ${flags_flagStr_} ${flags_help_}" >&2 - # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06 - # because it doesn't like empty strings when used in this manner. - flags_emptyStr_="`echo \"x${flags_flagStr_}x\" \ - |awk '{printf "%"length($0)-2"s", ""}'`" - flags_helpStr_=" ${flags_emptyStr_} ${flags_defaultStr_}" - _flags_strlen "${flags_helpStr_}" >/dev/null - flags_helpStrLen_=${flags_output} - - if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} \ - -o ${flags_helpStrLen_} -lt ${flags_columns_} ]; then - # indented to match help string - echo "${flags_helpStr_}" >&2 - else - # indented four from left to allow for longer defaults as long flag - # names might be used too, making things too long - echo " ${flags_defaultStr_}" >&2 - fi - fi - done - fi - - unset flags_boolStr_ flags_default_ flags_defaultStr_ flags_emptyStr_ \ - flags_flagStr_ flags_help_ flags_helpStr flags_helpStrLen flags_name_ \ - flags_columns_ flags_short_ flags_type_ flags_usName_ - return ${FLAGS_TRUE} -} - -# Reset shflags back to an uninitialized state. -# -# Args: -# none -# Returns: -# nothing -flags_reset() -{ - for flags_name_ in ${__flags_longNames}; do - flags_usName_=`_flags_underscoreName ${flags_name_}` - flags_strToEval_="unset FLAGS_${flags_usName_}" - for flags_type_ in \ - ${__FLAGS_INFO_DEFAULT} \ - ${__FLAGS_INFO_HELP} \ - ${__FLAGS_INFO_SHORT} \ - ${__FLAGS_INFO_TYPE} - do - flags_strToEval_=\ -"${flags_strToEval_} __flags_${flags_usName_}_${flags_type_}" - done - eval ${flags_strToEval_} - done - - # reset internal variables - __flags_boolNames=' ' - __flags_longNames=' ' - __flags_shortNames=' ' - __flags_definedNames=' ' - - unset flags_name_ flags_type_ flags_strToEval_ flags_usName_ -} diff --git a/source/1.0/src/shflags_test.sh b/source/1.0/src/shflags_test.sh deleted file mode 100755 index 3d2c335..0000000 --- a/source/1.0/src/shflags_test.sh +++ /dev/null @@ -1,122 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# shFlags unit test suite runner. -# -# This script runs all the unit tests that can be found, and generates a nice -# report of the tests. - -MY_NAME=`basename $0` -MY_PATH=`dirname $0` - -PREFIX='shflags_test_' -SHELLS='/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh' -TESTS='' -for test in ${PREFIX}[a-z]*.sh; do - TESTS="${TESTS} ${test}" -done - -# load libraries -. ../lib/versions -. ./shflags_test_helpers - -usage() -{ - echo "usage: ${MY_NAME} [-e key=val ...] [-s shell(s)] [-t test(s)]" -} - -env='' - -# process command line flags -while getopts 'e:hs:t:' opt; do - case ${opt} in - e) # set an environment variable - key=`expr "${OPTARG}" : '\([^=]*\)='` - val=`expr "${OPTARG}" : '[^=]*=\(.*\)'` - if [ -z "${key}" -o -z "${val}" ]; then - usage - exit 1 - fi - eval "${key}='${val}'" - export ${key} - env="${env:+${env} }${key}" - ;; - h) usage; exit 0 ;; # help output - s) shells=${OPTARG} ;; # list of shells to run - t) tests=${OPTARG} ;; # list of tests to run - *) usage; exit 1 ;; - esac -done -shift `expr ${OPTIND} - 1` - -# fill shells and/or tests -shells=${shells:-${SHELLS}} -tests=${tests:-${TESTS}} - -# error checking -if [ -z "${tests}" ]; then - th_error 'no tests found to run; exiting' - exit 1 -fi - -cat <<EOF -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="${shells}" -tests="${tests}" -EOF -for key in ${env}; do - eval "echo \"${key}=\$${key}\"" -done -echo - -# output system data -echo "# system info" -echo "$ date" -date - -echo "$ uname -mprsv" -uname -mprsv - -# -# run tests -# - -for shell in ${shells}; do - echo - - cat <<EOF - -#------------------------------------------------------------------------------ -# Running the test suite with ${shell} -# -EOF - # check for existance of shell - if [ ! -x ${shell} ]; then - th_warn "unable to run tests with the ${shell} shell" - continue - fi - - shell_name=`basename ${shell}` - shell_version=`versions_shellVersion "${shell}"` - - echo "shell name: ${shell_name}" - echo "shell version: ${shell_version}" - - # execute the tests - for suite in ${tests}; do - suiteName=`expr "${suite}" : "${PREFIX}\(.*\).sh"` - echo - echo "--- Executing the '${suiteName}' test suite ---" - ( exec ${shell} ./${suite} 2>&1; ) - done -done diff --git a/source/1.0/src/shflags_test_defines.sh b/source/1.0/src/shflags_test_defines.sh deleted file mode 100755 index a46b3c4..0000000 --- a/source/1.0/src/shflags_test_defines.sh +++ /dev/null @@ -1,223 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# shFlags unit test for the flag definition methods - -# load test helpers -. ./shflags_test_helpers - -#------------------------------------------------------------------------------ -# suite tests -# - -testFlagsDefine() -{ - # no arguments - _flags_define >"${stdoutF}" 2>"${stderrF}" - assertFalse '_flags_define() with no arguments should have failed.' $? - assertErrorMsg '' 'no arguments' - - # one argument - _flags_define arg1 >"${stdoutF}" 2>"${stderrF}" - assertFalse '_flags_define() call with one argument should fail' $? - assertErrorMsg '' 'one argument' - - # two arguments - _flags_define arg1 arg2 >"${stdoutF}" 2>"${stderrF}" - assertFalse '_flags_define() call with two arguments should fail' $? - assertErrorMsg '' 'two arguments' - - # three arguments - _flags_define arg1 arg2 arg3 >"${stdoutF}" 2>"${stderrF}" - assertFalse '_flags_define() call with three arguments should fail' $? - assertErrorMsg '' 'three arguments' - - # multiple definition -- assumes working boolean definition (tested elsewhere) - _flags_define ${__FLAGS_TYPE_BOOLEAN} multiDefBool true 'multi def #1' m - _flags_define ${__FLAGS_TYPE_BOOLEAN} multiDefBool false 'multi def #2' m \ - >"${stdoutF}" 2>"${stderrF}" - assertFalse '_flags_define() with existing flag name should fail' $? - assertTrue \ - '_flags_define() should not overwrite previously defined default.' \ - "${FLAGS_multiDefBool:-}" - assertWarnMsg '' 'existing flag' - - # duplicate dashed and underscored definition - _flags_define ${__FLAGS_TYPE_STRING} long-name 'foo' 'dashed name' l - _flags_define ${__FLAGS_TYPE_STRING} long_name 'bar' 'underscored name' l \ - >"${stdoutF}" 2>"${stderrF}" - assertFalse '_flags_define() with existing flag name should fail' $? - assertEquals \ - '_flags_define() should not overwrite previously defined default.' \ - "${FLAGS_long_name}" 'foo' - assertWarnMsg '' 'already exists' - - # TODO(kward): test requirement of enhanced getopt - - # invalid type - _flags_define invalid arg2 arg3 arg4 i >"${stdoutF}" 2>"${stderrF}" - assertFalse '_flags_define() with "invalid" type should have failed.' $? - assertErrorMsg 'unrecognized flag type' 'invalid type' -} - -testBoolean() -{ - # test true defaults - for default in 'true' 't' 0; do - flags_reset - DEFINE_boolean boolVal "${default}" 'my boolean' b - rtrn=$? - assertTrue \ - "DEFINE_boolean() call with default of '${default}' failed." \ - "${FLAGS_boolVal:-}" - assertTrue \ - "DEFINE_boolean() call with default of '${default}' returned faliure." \ - ${rtrn} - done - - # test false defaults - for default in 'false' 'f' 1; do - flags_reset - DEFINE_boolean boolVal "${default}" 'my boolean' b - rtrn=$? - assertFalse \ - "DEFINE_boolean() call with default of '${default}' failed." \ - "${FLAGS_boolVal:-}" - assertTrue \ - "DEFINE_boolean() call with default of '${default}' returned faliure." \ - ${rtrn} - done - - # test invalid default - flags_reset - DEFINE_boolean boolVal 'invalid' 'my boolean' b >"${stdoutF}" 2>"${stderrF}" - assertFalse 'DEFINE_boolean() call with invalid default did not fail.' $? - assertErrorMsg -} - -testFloat() -{ - # test valid defaults - for default in ${TH_FLOAT_VALID}; do - flags_reset - DEFINE_float floatVal ${default} "float: ${default}" f - rtrn=$? - assertSame "DEFINE_float() call with valid default failed." \ - ${default} "${FLAGS_floatVal:-}" - assertTrue \ - "DEFINE_float() call with valid default of '${default}' returned faliure." \ - ${rtrn} - done - - # test invalid defaults - flags_reset - DEFINE_float floatVal 'invalid' 'invalid float: string' f \ - >"${stdoutF}" 2>"${stderrF}" - assertFalse 'DEFINE_float() call with string value default did not fail.' $? - assertErrorMsg -} - -testInteger() -{ - # test valid defaults - for default in ${TH_INT_VALID}; do - flags_reset - DEFINE_integer intVal ${default} "integer: ${default}" i - rtrn=$? - assertSame \ - "DEFINE_integer() call with valid default failed." \ - ${default} "${FLAGS_intVal:-}" - assertTrue \ - "DEFINE_integer() call with valid default of '${default}' returned failure." \ - ${rtrn} - done - - # test invalid defaults - flags_reset - DEFINE_integer intVal 1.234 'invalid integer: float' i \ - >"${stdoutF}" 2>"${stderrF}" - assertFalse 'DEFINE_integer() call with float value default did not fail.' $? - assertErrorMsg 'invalid default' 'float default' - - DEFINE_integer intVal -1.234 'invalid integer: negative float' i \ - >"${stdoutF}" 2>"${stderrF}" - assertFalse \ - 'DEFINE_integer() call with negative float value default did not fail.' \ - $? - assertErrorMsg 'invalid default' 'negative float default' - - DEFINE_integer intVal 'invalid' 'invalid integer: string' i \ - >"${stdoutF}" 2>"${stderrF}" - assertFalse \ - 'DEFINE_integer() call with string value default did not fail.' \ - $? - assertErrorMsg 'invalid default' 'string default' -} - -testString() -{ - # test valid defaults - for default in \ - ${TH_BOOL_VALID} \ - ${TH_FLOAT_VALID} \ - ${TH_INT_VALID} \ - 'also valid' - do - flags_reset - DEFINE_string strVal "${default}" "string: ${default}" s - rtrn=$? - assertSame \ - "DEFINE_string() call with valid default failed." \ - "${default}" "${FLAGS_strVal:-}" - assertTrue \ - "DEFINE_string() call with valid default of '${default}' returned faliure." \ - ${rtrn} - done - - # test "empty" strings - flags_reset - DEFINE_string str '' "string: empty single quotes" s - rtrn=$? - assertSame \ - "DEFINE_string() call with valid default failed." \ - '' "${FLAGS_str:-}" -} - -testShortNameLength() -{ - # make sure short names are no longer than a single character - : -} - -testFlagNameIsReserved() -{ - ( DEFINE_string TRUE '' 'true is a reserved flag name' t \ - >"${stdoutF}" 2>"${stderrF}" ) - rtrn=$? - assertEquals ${FLAGS_ERROR} ${rtrn} - assertErrorMsg 'flag name (TRUE) is reserved' -} - -#------------------------------------------------------------------------------ -# suite functions -# - -oneTimeSetUp() -{ - th_oneTimeSetUp -} - -tearDown() -{ - flags_reset -} - -# load and run shUnit2 -[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} diff --git a/source/1.0/src/shflags_test_helpers b/source/1.0/src/shflags_test_helpers deleted file mode 100644 index a96219e..0000000 --- a/source/1.0/src/shflags_test_helpers +++ /dev/null @@ -1,122 +0,0 @@ -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# shFlags unit test common functions - -__th_skipping=0 - -# treat unset variables as an error -set -u - -# set shwordsplit for zsh -[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit - -# my name -TH_MY_NAME=`basename "$0"` - -# path to shFlags library. can be overridden by setting SHFLAGS_INC -TH_SHFLAGS=${SHFLAGS_INC:-./shflags} - -# path to shUnit2 library. can be overridden by setting SHUNIT_INC -TH_SHUNIT=${SHUNIT_INC:-../lib/shunit2} - -TH_BOOL_VALID='true t 0 false f 1' -TH_BOOL_INVALID='123 123.0 invalid' -TH_FLOAT_VALID='-1234.0 -1.0 -.123 0.0 0. .123 1.0 1234.0' -TH_FLOAT_INVALID='true false 1.2.3 -1.2.3 ""' -TH_INT_VALID='-1234 -1 0 1 1234' -TH_INT_INVALID='true false -1.0 -.123 0.0 .123 1.0 ""' - -# -# test helper functions -# - -# message functions -th_trace() { echo "test:TRACE $@" >&2; } -th_debug() { echo "test:DEBUG $@" >&2; } -th_info() { echo "test:INFO $@" >&2; } -th_warn() { echo "test:WARN $@" >&2; } -th_error() { echo "test:ERROR $@" >&2; } -th_fatal() { echo "test:FATAL $@" >&2; } - -th_oneTimeSetUp() -{ - # load shFlags - [ -n "${ZSH_VERSION:-}" ] && FLAGS_PARENT=$0 - . ${TH_SHFLAGS} - - # these files will be cleaned up automatically by shUnit2 - tmpDir=${SHUNIT_TMPDIR} - stdoutF="${tmpDir}/stdout" - stderrF="${tmpDir}/stderr" - returnF="${tmpDir}/return" - expectedF="${tmpDir}/expected" -} - -th_showOutput() -{ - _th_rtrn=$1 - _th_stdout=$2 - _th_stderr=$3 - - isSkipping - if [ $? -eq ${SHUNIT_FALSE} -a ${_th_rtrn} != ${FLAGS_TRUE} ]; then - if [ -n "${_th_stdout}" -a -s "${_th_stdout}" ]; then - echo '>>> STDOUT' >&2 - cat "${_th_stdout}" >&2 - fi - if [ -n "${_th_stderr}" -a -s "${_th_stderr}" ]; then - echo '>>> STDERR' >&2 - cat "${_th_stderr}" >&2 - fi - if [ -n "${_th_stdout}" -o -n "${_th_stderr}" ]; then - echo '<<< end output' >&2 - fi - fi - - unset _th_rtrn _th_stdout _th_stderr -} - -# Some shells, zsh on Solaris in particular, return immediately from a sub-shell -# when a non-zero return value is encountered. To properly catch these values, -# they are either written to disk, or recognized as an error the file is empty. -th_clearReturn() { cp /dev/null "${returnF}"; } -th_queryReturn() -{ - if [ -s "${returnF}" ]; then - th_return=`cat "${returnF}"` - else - th_return=${SHUNIT_ERROR} - fi -} - -_th_assertMsg() -{ - _th_alert_type_=$1 - _th_alert_msg_=$2 - _th_msg_=$3 - - case ${_th_alert_type_} in - WARN) _th_alert_str_='a warning' ;; - ERROR) _th_alert_str_='an error' ;; - FATAL) _th_alert_str_='a fatal' ;; - esac - [ -z "${_th_alert_msg_}" ] && _th_alert_msg_='.*' - [ -n "${_th_msg_}" ] && _th_msg_="(${_th_msg_}) " - - grep -- "^flags:${_th_alert_type_} ${_th_alert_msg_}" "${stderrF}" \ - >/dev/null - assertTrue \ - "FLAGS ${_th_msg_}failure did not generate ${_th_alert_str_} message" $? - - unset _th_alert_type_ _th_alert_msg_ _th_alert_str_ _th_msg_ -} - -assertWarnMsg() { _th_assertMsg 'WARN' "${1:-}" "${2:-}"; } -assertErrorMsg() { _th_assertMsg 'ERROR' "${1:-}" "${2:-}"; } -assertFatalMsg() { _th_assertMsg 'FATAL' "${1:-}" "${2:-}"; } diff --git a/source/1.0/src/shflags_test_parsing.sh b/source/1.0/src/shflags_test_parsing.sh deleted file mode 100755 index 664db5b..0000000 --- a/source/1.0/src/shflags_test_parsing.sh +++ /dev/null @@ -1,371 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# shFlags unit test for the flag definition methods -# -# TODO(kward): assert on FLAGS errors -# TODO(kward): testNonStandardIFS() - -# exit immediately if a pipeline or subshell exits with a non-zero status. -#set -e - -# treat unset variables as an error -set -u - -# load test helpers -. ./shflags_test_helpers - -#------------------------------------------------------------------------------ -# suite tests -# - -testGetoptStandard() -{ - _flags_getoptStandard '-b' >"${stdoutF}" 2>"${stderrF}" - rslt=$? - assertTrue "didn't parse valid flag 'b'" ${rslt} - th_showOutput ${rslt} "${stdoutF}" "${stderrF}" - - _flags_getoptStandard '-x' >"${stdoutF}" 2>"${stderrF}" - assertFalse "parsed invalid flag 'x'" $? -} - -testGetoptEnhanced() -{ - flags_getoptIsEnh || return - - _flags_getoptEnhanced '-b' >"${stdoutF}" 2>"${stderrF}" - assertTrue "didn't parse valid flag 'b'" $? - _flags_getoptEnhanced '--bool' >"${stdoutF}" 2>"${stderrF}" - assertTrue "didn't parse valid flag 'bool'" $? - - _flags_getoptEnhanced '-x' >"${stdoutF}" 2>"${stderrF}" - assertFalse "parsed invalid flag 'x'" $? - _flags_getoptEnhanced '--xyz' >"${stdoutF}" 2>"${stderrF}" - assertFalse "parsed invalid flag 'xyz'" $? -} - -testValidBoolsShort() -{ - FLAGS -b >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "-b) FLAGS returned a non-zero result (${r3turn})" ${r3turn} - value=${FLAGS_bool:-} - assertTrue "-b) boolean was not true (${value})." "${value}" - assertFalse '-b) expected no output to STDERR' "[ -s '${stderrF}' ]" - test ${r3turn} -eq ${FLAGS_TRUE} -a ! -s "${stderrF}" - th_showOutput $? "${stdoutF}" "${stderrF}" - - DEFINE_boolean bool2 true '2nd boolean' B - FLAGS >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "-B) FLAGS returned a non-zero result (${r3turn})" ${r3turn} - value=${FLAGS_bool2:-} - assertTrue "-B) boolean was not true (${value})" ${value} - assertFalse '-B) expected no output to STDERR' "[ -s '${stderrF}' ]" - test ${r3turn} -eq ${FLAGS_TRUE} -a ! -s "${stderrF}" - th_showOutput $? "${stdoutF}" "${stderrF}" - - FLAGS -B >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "-B) FLAGS returned a non-zero result (${r3turn})" ${r3turn} - value=${FLAGS_bool2:-} - assertFalse "-B) boolean was not false (${value})" ${value} - assertFalse '-B) expected no output to STDERR' "[ -s '${stderrF}' ]" - test ${r3turn} -eq ${FLAGS_TRUE} -a ! -s "${stderrF}" - th_showOutput $? "${stdoutF}" "${stderrF}" -} - -# TODO(kate): separate into multiple functions to reflect correct usage -testValidBoolsLong() -{ - flags_getoptIsEnh || return - - # Note: the default value of bool is 'false'. - - # leave flag false - FLAGS --nobool >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn} - assertFalse '--noXX flag resulted in true value.' ${FLAGS_bool:-} - assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]" - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" - - # flip flag true - FLAGS --bool >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn} - assertTrue '--XX flag resulted in false value.' ${FLAGS_bool:-} - assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]" - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" - - # flip flag back false - FLAGS --nobool >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn} - assertFalse '--noXX flag resulted in true value.' ${FLAGS_bool:-} - assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]" - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" -} - -testValidFloats() -{ - _testValidFloats '-f' - flags_getoptIsEnh || return - _testValidFloats '--float' -} - -_testValidFloats() -{ - flag=$1 - for value in ${TH_FLOAT_VALID}; do - FLAGS ${flag} ${value} >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "FLAGS ${flag} ${value} returned non-zero result (${r3turn})" \ - ${r3turn} - assertEquals "float (${flag} ${value}) test failed." ${value} ${FLAGS_float} - assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]" - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" - done -} - -testInvalidFloats() -{ - _testInvalidFloats '-f' - flags_getoptIsEnh || return - _testInvalidFloats '--float' -} - -_testInvalidFloats() -{ - flag=$1 - for value in ${TH_FLOAT_INVALID}; do - th_clearReturn - ( - FLAGS ${flag} ${value} >"${stdoutF}" 2>"${stderrF}" - echo $? >"${returnF}" - ) - th_queryReturn - assertFalse "FLAGS (${value}) returned a zero result" ${th_return} - assertFalse 'expected no output to STDOUT' "[ -s '${stdoutF}' ]" - assertTrue 'expected output to STDERR' "[ -s '${stderrF}' ]" - done -} - -testValidIntegers() -{ - _testValidIntegers '-i' - flags_getoptIsEnh || return - _testValidIntegers '--int' -} - -_testValidIntegers() -{ - flag=$1 - for value in ${TH_INT_VALID}; do - FLAGS ${flag} ${value} >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "FLAGS (${value}) returned a non-zero result (${r3turn})" ${r3turn} - assertEquals "integer (${value}) test failed." ${value} ${FLAGS_int} - assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]" - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" - done -} - -testInvalidIntegers() -{ - _testInvalidIntegers '-i' - flags_getoptIsEnh || return - _testInvalidIntegers '--int' -} - -_testInvalidIntegers() -{ - flag=$1 - for value in ${TH_INT_INVALID}; do - th_clearReturn - ( - FLAGS ${flag} ${value} >"${stdoutF}" 2>"${stderrF}" - echo $? >"${returnF}" - ) - th_queryReturn - assertFalse "invalid integer (${value}) test returned success." ${th_return} - assertFalse 'expected no output to STDOUT' "[ -s '${stdoutF}' ]" - assertTrue 'expected output to STDERR' "[ -s '${stderrF}' ]" - done -} - -testValidStrings() -{ - _testValidStrings -s single_word - if flags_getoptIsEnh; then - _testValidStrings --str single_word - _testValidStrings --str 'string with spaces' - fi -} - -_testValidStrings() -{ - flag=$1 - value=$2 - - FLAGS ${flag} "${value}" >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "'FLAGS ${flag} ${value}' returned a non-zero result (${r3turn})" \ - ${r3turn} - assertEquals "string (${value}) test failed." "${value}" "${FLAGS_str}" - if [ ${r3turn} -eq ${FLAGS_TRUE} ]; then - assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]" - else - # validate that an error is thrown for unsupported getopt uses - assertFatalMsg '.* spaces in options' - fi - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" -} - -testMultipleFlags() -{ - _testMultipleFlags '-b' '-i' '-f' '-s' - flags_getoptIsEnh || return - _testMultipleFlags '--bool' '--int' '--float' '--str' -} - -_testMultipleFlags() -{ - boolFlag=$1 - intFlag=$2 - floatFlag=$3 - strFlag=$4 - - FLAGS \ - ${boolFlag} \ - ${intFlag} 567 \ - ${floatFlag} 123.45678 \ - ${strFlag} 'some_string' \ - >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue "use of multple flags returned a non-zero result" ${r3turn} - assertTrue 'boolean test failed.' ${FLAGS_bool} - assertNotSame 'float test failed.' 0 ${FLAGS_float} - assertNotSame 'integer test failed.' 0 ${FLAGS_int} - assertNotSame 'string test failed.' '' ${FLAGS_str} - assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]" - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" -} - -_testNonFlagArgs() -{ - argc=$1 - shift - - FLAGS "$@" >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue 'parse returned non-zero value.' ${r3turn} - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" - - eval set -- "${FLAGS_ARGV}" - assertEquals 'wrong count of argv arguments returned.' ${argc} $# - assertEquals 'wrong count of argc arguments returned.' 0 ${FLAGS_ARGC} -} - -testSingleNonFlagArg() -{ - _testNonFlagArgs 1 argOne -} - -testMultipleNonFlagArgs() -{ - _testNonFlagArgs 3 argOne argTwo arg3 -} - -testMultipleNonFlagStringArgsWithSpaces() -{ - flags_getoptIsEnh || return - _testNonFlagArgs 3 argOne 'arg two' arg3 -} - -testFlagsWithEquals() -{ - flags_getoptIsEnh || return - - FLAGS --str='str_flag' 'non_flag' >"${stdoutF}" 2>"${stderrF}" - assertTrue 'FLAGS returned a non-zero result' $? - assertEquals 'string flag not set properly' 'str_flag' "${FLAGS_str}" - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" - - eval set -- "${FLAGS_ARGV}" - assertEquals 'wrong count of argv arguments returned.' 1 $# - assertEquals 'wrong count of argc arguments returned.' 1 ${FLAGS_ARGC} -} - -testComplicatedCommandLineStandard() -{ - flags_getoptIsEnh && return - - # Note: standard getopt stops parsing after first non-flag argument, which - # results in the remaining flags being treated as arguments instead. - FLAGS -i 1 non_flag_1 -s 'two' non_flag_2 -f 3 non_flag_3 \ - >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue 'FLAGS returned a non-zero result' ${r3turn} - assertEquals 'failed int test' 1 ${FLAGS_int} - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" - - eval set -- "${FLAGS_ARGV}" - assertEquals 'incorrect number of argv values' 7 $# -} - -testComplicatedCommandLineEnhanced() -{ - flags_getoptIsEnh || return - - FLAGS -i 1 non_flag_1 --str='two' non_flag_2 --float 3 'non flag 3' \ - >"${stdoutF}" 2>"${stderrF}" - r3turn=$? - assertTrue 'FLAGS returned a non-zero result' ${r3turn} - assertEquals 'failed int test' 1 ${FLAGS_int} - assertEquals 'failed str test' 'two' "${FLAGS_str}" - assertEquals 'failed float test' 3 ${FLAGS_float} - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" - - eval set -- "${FLAGS_ARGV}" - assertEquals 'incorrect number of argv values' 3 $# -} - -#------------------------------------------------------------------------------ -# suite functions -# - -oneTimeSetUp() -{ - th_oneTimeSetUp - - if flags_getoptIsStd; then - th_warn 'Standard version of getopt found. Enhanced tests will be skipped.' - else - th_warn 'Enhanced version of getopt found. Standard tests will be skipped.' - fi -} - -setUp() -{ - DEFINE_boolean bool false 'boolean test' 'b' - DEFINE_float float 0.0 'float test' 'f' - DEFINE_integer int 0 'integer test' 'i' - DEFINE_string str '' 'string test' 's' -} - -tearDown() -{ - flags_reset -} - -# load and run shUnit2 -[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} diff --git a/source/1.0/src/shflags_test_private.sh b/source/1.0/src/shflags_test_private.sh deleted file mode 100755 index d5c6112..0000000 --- a/source/1.0/src/shflags_test_private.sh +++ /dev/null @@ -1,253 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# shFlags unit test for the internal functions - -# load test helpers -. ./shflags_test_helpers - -#------------------------------------------------------------------------------ -# suite tests -# - -testColumns() -{ - cols=`_flags_columns` - value=`expr "${cols}" : '\([0-9]*\)'` - assertNotNull "unexpected screen width (${cols})" "${value}" -} - -testGenOptStr() -{ - _testGenOptStr '' '' - - DEFINE_boolean bool false 'boolean value' b - _testGenOptStr 'b' 'bool' - - DEFINE_float float 0.0 'float value' f - _testGenOptStr 'bf:' 'bool,float:' - - DEFINE_integer int 0 'integer value' i - _testGenOptStr 'bf:i:' 'bool,float:,int:' - - DEFINE_string str 0 'string value' s - _testGenOptStr 'bf:i:s:' 'bool,float:,int:,str:' - - DEFINE_boolean help false 'show help' h - _testGenOptStr 'bf:i:s:h' 'bool,float:,int:,str:,help' -} - -_testGenOptStr() -{ - short=$1 - long=$2 - - result=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}` - assertTrue 'short option string generation failed' $? - assertEquals "${short}" "${result}" - - result=`_flags_genOptStr ${__FLAGS_OPTSTR_LONG}` - assertTrue 'long option string generation failed' $? - assertEquals "${long}" "${result}" -} - -testGetFlagInfo() -{ - __flags_blah_foobar='1234' - - rslt=`_flags_getFlagInfo 'blah' 'foobar'` - assertTrue 'request for valid flag info failed' $? - assertEquals 'invalid flag info returned' "${__flags_blah_foobar}" "${rslt}" - - rslt=`_flags_getFlagInfo 'blah' 'hubbabubba' >"${stdoutF}" 2>"${stderrF}"` - assertEquals 'invalid flag did not result in an error' ${FLAGS_ERROR} $? - assertErrorMsg 'missing flag info variable' -} - -testItemInList() -{ - list='this is a test' - - _flags_itemInList 'is' ${list} - assertTrue 'unable to find leading string (this)' $? - - _flags_itemInList 'is' ${list} - assertTrue 'unable to find string (is)' $? - - _flags_itemInList 'is' ${list} - assertTrue 'unable to find trailing string (test)' $? - - _flags_itemInList 'abc' ${list} - assertFalse 'found nonexistant string (abc)' $? - - _flags_itemInList '' ${list} - assertFalse 'empty strings should not match' $? - - _flags_itemInList 'blah' '' - assertFalse 'empty lists should not match' $? -} - -testValidBool() -{ - # valid values - for value in ${TH_BOOL_VALID}; do - _flags_validBool "${value}" - assertTrue "valid value (${value}) did not validate" $? - done - - # invalid values - for value in ${TH_BOOL_INVALID}; do - _flags_validBool "${value}" - assertFalse "invalid value (${value}) validated" $? - done -} - -_testValidFloat() -{ - # valid values - for value in ${TH_INT_VALID} ${TH_FLOAT_VALID}; do - _flags_validFloat "${value}" - assertTrue "valid value (${value}) did not validate" $? - done - - # invalid values - for value in ${TH_FLOAT_INVALID}; do - _flags_validFloat "${value}" - assertFalse "invalid value (${value}) validated" $? - done -} - -testValidFloatBuiltin() -{ - _flags_useBuiltin || startSkipping - _testValidFloat -} - -testValidFloatExpr() -{ - ( - _flags_useBuiltin() { return ${FLAGS_FALSE}; } - _testValidFloat - ) -} - -_testValidInt() -{ - # valid values - for value in ${TH_INT_VALID}; do - _flags_validInt "${value}" - assertTrue "valid value (${value}) did not validate" $? - done - - # invalid values - for value in ${TH_INT_INVALID}; do - _flags_validInt "${value}" - assertFalse "invalid value (${value}) should not validate" $? - done -} - -testValidIntBuiltin() -{ - _flags_useBuiltin || startSkipping - _testValidInt -} - -testValidIntExpr() -{ - ( - _flags_useBuiltin() { return ${FLAGS_FALSE}; } - _testValidInt - ) -} - -_testMath() -{ - result=`_flags_math 1` - assertTrue '1 failed' $? - assertEquals '1' 1 ${result} - - result=`_flags_math '1 + 2'` - assertTrue '1+2 failed' $? - assertEquals '1+2' 3 ${result} - - result=`_flags_math '1 + 2 + 3'` - assertTrue '1+2+3 failed' $? - assertEquals '1+2+3' 6 ${result} - - result=`_flags_math` - assertFalse 'missing math succeeded' $? -} - -testMathBuiltin() -{ - _flags_useBuiltin || startSkipping - _testMath -} - -testMathExpr() -{ - ( - _flags_useBuiltin() { return ${FLAGS_FALSE}; } - _testMath - ) -} - -_testStrlen() -{ - len=`_flags_strlen` - assertTrue 'missing argument failed' $? - assertEquals 'missing argument' 0 ${len} - - len=`_flags_strlen ''` - assertTrue 'empty argument failed' $? - assertEquals 'empty argument' 0 ${len} - - len=`_flags_strlen abc123` - assertTrue 'single-word failed' $? - assertEquals 'single-word' 6 ${len} - - len=`_flags_strlen 'This is a test'` - assertTrue 'multi-word failed' $? - assertEquals 'multi-word' 14 ${len} -} - -testStrlenBuiltin() -{ - _flags_useBuiltin || startSkipping - _testStrlen -} - -testStrlenExpr() -{ - ( - _flags_useBuiltin() { return ${FLAGS_FALSE}; } - _testStrlen - ) -} - -#------------------------------------------------------------------------------ -# suite functions -# - -oneTimeSetUp() -{ - th_oneTimeSetUp - - _flags_useBuiltin || \ - th_warn 'Shell built-ins not supported. Some tests will be skipped.' -} - -tearDown() -{ - flags_reset -} - -# load and run shUnit2 -[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} diff --git a/source/1.0/src/shflags_test_public.sh b/source/1.0/src/shflags_test_public.sh deleted file mode 100755 index 3877d80..0000000 --- a/source/1.0/src/shflags_test_public.sh +++ /dev/null @@ -1,186 +0,0 @@ -#! /bin/sh -# $Id$ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# -# Author: kate.ward@forestent.com (Kate Ward) -# -# shFlags unit test for the public functions - -# load test helpers -. ./shflags_test_helpers - -#------------------------------------------------------------------------------ -# suite tests -# - -testHelp() -{ - _testHelp '-h' - flags_getoptIsEnh || return - _testHelp '--help' -} - -_testHelp() -{ - flag=$1 - - # test default help output - th_clearReturn - ( - FLAGS ${flag} >"${stdoutF}" 2>"${stderrF}" - echo $? >"${returnF}" - ) - th_queryReturn - assertTrue \ - 'short help request should have returned a true exit code.' \ - ${th_return} - grep 'show this help' "${stderrF}" >/dev/null - grepped=$? - assertTrue \ - 'short request for help should have produced some help output.' \ - ${grepped} - [ ${grepped} -ne ${FLAGS_TRUE} ] && th_showOutput - - # test proper output when FLAGS_HELP set - ( - FLAGS_HELP='this is a test' - FLAGS ${flag} >"${stdoutF}" 2>"${stderrF}" - ) - grep 'this is a test' "${stderrF}" >/dev/null - grepped=$? - assertTrue 'setting FLAGS_HELP did not produce expected result' ${grepped} - [ ${grepped} -ne ${FLAGS_TRUE} ] && th_showOutput - - # test that "'" chars work in help string - ( - DEFINE_boolean b false "help string containing a ' char" b - FLAGS ${flag} >"${stdoutF}" 2>"${stderrF}" - ) - grep "help string containing a ' char" "${stderrF}" >/dev/null - grepped=$? - assertTrue "help strings containing apostrophes don't work" ${grepped} - [ ${grepped} -ne ${FLAGS_TRUE} ] && th_showOutput -} - -mock_flags_columns() -{ - echo 80 -} - -testStandardHelpOutput() -{ - flags_getoptIsStd || startSkipping - - DEFINE_boolean test_bool false 'test boolean' b - DEFINE_integer test_int 0 'test integer' i - DEFINE_string test_str '' 'test string' s - DEFINE_string long_desc 'blah' \ - 'testing of a long description to force wrap of default value' D - DEFINE_string long_default \ - 'this_is_a_long_default_value_to_force_alternate_indentation' \ - 'testing of long default value' F - help='USAGE: standard [flags] args' - - cat >"${expectedF}" <<EOF -${help} -flags: - -b test boolean (default: false) - -i test integer (default: 0) - -s test string (default: '') - -D testing of a long description to force wrap of default value - (default: 'blah') - -F testing of long default value - (default: 'this_is_a_long_default_value_to_force_alternate_indentation') - -h show this help (default: false) -EOF - ( - _flags_columns() { mock_flags_columns; } - FLAGS_HELP=${help}; - FLAGS -h >"${stdoutF}" 2>"${stderrF}" - ) - r3turn=$? - assertTrue 'a call for help should not return an error' ${r3turn} - - diff "${expectedF}" "${stderrF}" >/dev/null - r3turn=$? - assertTrue 'unexpected help output' ${r3turn} - th_showOutput ${r3turn} "${stdoutF}" "${stderrF}" -} - -testEnhancedHelpOutput() -{ - flags_getoptIsEnh || startSkipping - - DEFINE_boolean test_bool false 'test boolean' b - DEFINE_integer test_int 0 'test integer' i - DEFINE_string test_str '' 'test string' s - DEFINE_string long_desc 'blah' \ - 'testing of a long description to force wrap of default value' D - DEFINE_string long_default \ - 'this_is_a_long_default_value_to_force_alternate_indentation' \ - 'testing of long default value' F - help='USAGE: enhanced [flags] args' - - cat >"${expectedF}" <<EOF -${help} -flags: - -b,--[no]test_bool: test boolean (default: false) - -i,--test_int: test integer (default: 0) - -s,--test_str: test string (default: '') - -D,--long_desc: testing of a long description to force wrap of default value - (default: 'blah') - -F,--long_default: testing of long default value - (default: 'this_is_a_long_default_value_to_force_alternate_indentation') - -h,--help: show this help (default: false) -EOF - ( - _flags_columns() { mock_flags_columns; } - FLAGS_HELP=${help}; - FLAGS -h >"${stdoutF}" 2>"${stderrF}" - ) - r3turn=$? - assertTrue 'a call for help should not return an error' ${r3turn} - - diff "${expectedF}" "${stderrF}" >/dev/null - differed=$? - assertTrue 'unexpected help output' ${differed} - th_showOutput ${differed} "${stdoutF}" "${stderrF}" -} - -testNoHelp() -{ - flags_getoptIsEnh || startSkipping - - ( FLAGS --nohelp >"${stdoutF}" 2>"${stderrF}" ) - r3turn=$? - assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn} - assertFalse 'expected no output to STDOUT' "[ -s '${stdoutF}' ]" - assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]" -} - -#------------------------------------------------------------------------------ -# suite functions -# - -oneTimeSetUp() -{ - th_oneTimeSetUp - - if flags_getoptIsStd; then - th_warn 'Standard version of getopt found. Enhanced tests will be skipped.' - else - th_warn 'Enhanced version of getopt found. Standard tests will be skipped.' - fi -} - -setUp() -{ - flags_reset -} - -# load and run shUnit2 -[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} diff --git a/source/1.0/test_results/1.0.4/FreeBSD-9.1.txt b/source/1.0/test_results/1.0.4/FreeBSD-9.1.txt deleted file mode 100644 index 9980680..0000000 --- a/source/1.0/test_results/1.0.4/FreeBSD-9.1.txt +++ /dev/null @@ -1,111 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Tue Jan 15 00:08:36 UTC 2013 -$ uname -mprsv -FreeBSD 9.1-RELEASE FreeBSD 9.1-RELEASE #0: Fri Dec 7 20:50:48 GMT 2012 kirk@freenas:/usr/obj/usr/src/sys/GENERIC amd64 amd64 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# diff --git a/source/1.0/test_results/1.0.4/Linux-Ubuntu-10.04.4-LTS.txt b/source/1.0/test_results/1.0.4/Linux-Ubuntu-10.04.4-LTS.txt deleted file mode 100644 index 4dc2fb5..0000000 --- a/source/1.0/test_results/1.0.4/Linux-Ubuntu-10.04.4-LTS.txt +++ /dev/null @@ -1,451 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Tue Jan 15 00:09:41 UTC 2013 -$ uname -mprsv -Linux 2.6.32-45-server #101-Ubuntu SMP Mon Dec 3 15:54:27 UTC 2012 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 4.1.5(1)-release - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.5.1-3ubuntu2 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: JM-93t+-2009-05-01-$ - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.10 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) diff --git a/source/1.0/test_results/1.0.4/Linux-Ubuntu-12.04.1-LTS.txt b/source/1.0/test_results/1.0.4/Linux-Ubuntu-12.04.1-LTS.txt deleted file mode 100644 index c3a2a0d..0000000 --- a/source/1.0/test_results/1.0.4/Linux-Ubuntu-12.04.1-LTS.txt +++ /dev/null @@ -1,451 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Tue Jan 15 00:09:47 GMT 2013 -$ uname -mprsv -Linux 3.2.0-35-generic #55-Ubuntu SMP Wed Dec 5 17:42:16 UTC 2012 x86_64 x86_64 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 4.2.24(1)-release - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.7-2ubuntu2 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: JM-93u-2011-02-08-$ - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.17 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) diff --git a/source/1.0/test_results/1.0.4/Linux-Ubuntu-8.04.4-LTS.txt b/source/1.0/test_results/1.0.4/Linux-Ubuntu-8.04.4-LTS.txt deleted file mode 100644 index 62d42f8..0000000 --- a/source/1.0/test_results/1.0.4/Linux-Ubuntu-8.04.4-LTS.txt +++ /dev/null @@ -1,451 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Mon Jan 14 18:09:57 CST 2013 -$ uname -mprsv -Linux 2.6.24-32-server #1 SMP Mon Dec 3 15:54:12 UTC 2012 x86_64 unknown - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.39(1)-release - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# -shell name: dash -shell version: 0.5.4-8ubuntu1.1 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-1993-12-28 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# -shell name: pdksh -shell version: v5.2.14-99/07/13.2 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.4 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Enhanced version of getopt found. Standard tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=2) diff --git a/source/1.0/test_results/1.0.4/Mac_OS_X-10.8.2.txt b/source/1.0/test_results/1.0.4/Mac_OS_X-10.8.2.txt deleted file mode 100644 index c03b407..0000000 --- a/source/1.0/test_results/1.0.4/Mac_OS_X-10.8.2.txt +++ /dev/null @@ -1,315 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Tue Jan 15 01:10:24 CET 2013 -$ uname -mprsv -Darwin 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.48(1)-release - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: JM-93u-2011-02-08-$ - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.3.11 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) diff --git a/source/1.0/test_results/1.0.4/OpenSolaris-2009.06(snv_111b).txt b/source/1.0/test_results/1.0.4/OpenSolaris-2009.06(snv_111b).txt deleted file mode 100644 index 250dd52..0000000 --- a/source/1.0/test_results/1.0.4/OpenSolaris-2009.06(snv_111b).txt +++ /dev/null @@ -1,247 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Tue Jan 15 00:08:39 GMT 2013 -$ uname -mprsv -SunOS 5.11 snv_111b i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.25(1)-release - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# diff --git a/source/1.0/test_results/1.0.4/Solaris-10u10.txt b/source/1.0/test_results/1.0.4/Solaris-10u10.txt deleted file mode 100644 index ee3083b..0000000 --- a/source/1.0/test_results/1.0.4/Solaris-10u10.txt +++ /dev/null @@ -1,316 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Tue Jan 15 01:09:38 MET 2013 -$ uname -mprsv -SunOS 5.10 Generic_147441-01 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -test:WARN Shell built-ins not supported. Some tests will be skipped. -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK (skipped=46) - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 3.2.51(1)-release - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 4.2.1 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) diff --git a/source/1.0/test_results/1.0.4/Solaris-8u7.txt b/source/1.0/test_results/1.0.4/Solaris-8u7.txt deleted file mode 100644 index 754672c..0000000 --- a/source/1.0/test_results/1.0.4/Solaris-8u7.txt +++ /dev/null @@ -1,316 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Tue Jan 15 00:08:59 GMT 2013 -$ uname -mprsv -SunOS 5.8 Generic_108529-13 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -test:WARN Shell built-ins not supported. Some tests will be skipped. -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK (skipped=46) - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 2.03.0(1)-release - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 3.0.6 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) diff --git a/source/1.0/test_results/1.0.4/Solaris-9u8.txt b/source/1.0/test_results/1.0.4/Solaris-9u8.txt deleted file mode 100644 index 2ae38f4..0000000 --- a/source/1.0/test_results/1.0.4/Solaris-9u8.txt +++ /dev/null @@ -1,316 +0,0 @@ -#------------------------------------------------------------------------------ -# System data -# - -# test run info -shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh" -tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh" - -# system info -$ date -Tue Jan 15 00:09:36 GMT 2013 -$ uname -mprsv -SunOS 5.9 Generic_118559-11 i86pc i386 - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/sh -# -shell name: sh -shell version: unknown - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -test:WARN Shell built-ins not supported. Some tests will be skipped. -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK (skipped=46) - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/bash -# -shell name: bash -shell version: 2.05.0(1)-release - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/dash -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/ksh -# -shell name: ksh -shell version: M-11/16/88i - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/pdksh -# - - -#------------------------------------------------------------------------------ -# Running the test suite with /bin/zsh -# -shell name: zsh -shell version: 3.0.8 - ---- Executing the 'defines' test suite --- -testFlagsDefine -testBoolean -testFloat -testInteger -testString -testShortNameLength -testFlagNameIsReserved - -Ran 7 tests. - -OK - ---- Executing the 'parsing' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testGetoptStandard -testGetoptEnhanced -testValidBoolsShort -testValidBoolsLong -testValidFloats -testInvalidFloats -testValidIntegers -testInvalidIntegers -testValidStrings -testMultipleFlags -testSingleNonFlagArg -testMultipleNonFlagArgs -testMultipleNonFlagStringArgsWithSpaces -testFlagsWithEquals -testComplicatedCommandLineStandard -testComplicatedCommandLineEnhanced - -Ran 16 tests. - -OK - ---- Executing the 'private' test suite --- -testColumns -testGenOptStr -testGetFlagInfo -testItemInList -testValidBool -testValidFloatBuiltin -testValidFloatExpr -testValidIntBuiltin -testValidIntExpr -testMathBuiltin -testMathExpr -testStrlenBuiltin -testStrlenExpr - -Ran 13 tests. - -OK - ---- Executing the 'public' test suite --- -test:WARN Standard version of getopt found. Enhanced tests will be skipped. -testHelp -testStandardHelpOutput -testEnhancedHelpOutput -testNoHelp - -Ran 4 tests. - -OK (skipped=5) |