diff options
| author | Richard Hansen <rhansen@rhansen.org> | 2016-01-23 03:22:03 -0500 |
|---|---|---|
| committer | Richard Hansen <rhansen@rhansen.org> | 2016-01-31 16:13:19 -0500 |
| commit | 09ef2538bde7486e3327784c5968c5ee2482394b (patch) | |
| tree | a2585d658ea8983beb522e3b124c07672b08510c | |
| parent | c100a04eba7d9cd401333882a82948e7f644cea2 (diff) | |
| download | gitlab-09ef2538bde7486e3327784c5968c5ee2482394b.tar.gz | |
quote underquoted variable expansions
This protects against word splitting if the variable contains IFS
characters, and it ensures that an empty variable doesn't become an
elided argument.
| -rwxr-xr-x | tools/build_test_env.sh | 12 | ||||
| -rwxr-xr-x | tools/functional_tests.sh | 24 | ||||
| -rwxr-xr-x | tools/py_functional_tests.sh | 6 |
3 files changed, 21 insertions, 21 deletions
diff --git a/tools/build_test_env.sh b/tools/build_test_env.sh index e65f2bc..9788d57 100755 --- a/tools/build_test_env.sh +++ b/tools/build_test_env.sh @@ -55,7 +55,7 @@ cleanup() { docker kill gitlab-test >/dev/null 2>&1 docker rm gitlab-test >/dev/null 2>&1 command -v deactivate >/dev/null 2>&1 && deactivate || true - rm -rf $VENV + rm -rf "$VENV" } [ -z "${BUILD_TEST_ENV_AUTO_CLEANUP+set}" ] || { trap cleanup EXIT @@ -68,10 +68,10 @@ docker run --name gitlab-test --detach --publish 8080:80 \ LOGIN='root' PASSWORD='5iveL!fe' CONFIG=/tmp/python-gitlab.cfg -GITLAB() { gitlab --config-file $CONFIG "$@"; } +GITLAB() { gitlab --config-file "$CONFIG" "$@"; } GREEN='\033[0;32m' NC='\033[0m' -OK() { echo -e ${GREEN}OK${NC}; } +OK() { echo -e "${GREEN}OK${NC}"; } log "Waiting for gitlab to come online... " I=0 @@ -82,7 +82,7 @@ while :; do curl -s http://localhost:8080/users/sign_in 2>/dev/null \ | grep -q "GitLab Community Edition" && break let I=I+5 - [ $I -eq 120 ] && exit 1 + [ "$I" -eq 120 ] && exit 1 done sleep 5 @@ -106,8 +106,8 @@ EOF log "Config file content ($CONFIG):" log <$CONFIG -$VENV_CMD $VENV -. $VENV/bin/activate +"$VENV_CMD" "$VENV" +. "$VENV"/bin/activate pip install -rrequirements.txt pip install -e . diff --git a/tools/functional_tests.sh b/tools/functional_tests.sh index 687d738..cf9c632 100755 --- a/tools/functional_tests.sh +++ b/tools/functional_tests.sh @@ -14,9 +14,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -setenv_script=$(dirname $0)/build_test_env.sh +setenv_script=$(dirname "$0")/build_test_env.sh BUILD_TEST_ENV_AUTO_CLEANUP=true -. $setenv_script "$@" +. "$setenv_script" "$@" set -e @@ -27,7 +27,7 @@ GITLAB project list | grep -q test-project1 OK echo -n "Testing project update... " -GITLAB project update --id $PROJECT_ID --description "My New Description" +GITLAB project update --id "$PROJECT_ID" --description "My New Description" OK echo -n "Testing user creation... " @@ -44,37 +44,37 @@ GITLAB -v user list | grep -qv config-file OK echo -n "Testing adding member to a project... " -GITLAB project-member create --project-id $PROJECT_ID \ - --user-id $USER_ID --access-level 40 >/dev/null 2>&1 +GITLAB project-member create --project-id "$PROJECT_ID" \ + --user-id "$USER_ID" --access-level 40 >/dev/null 2>&1 OK echo -n "Testing file creation... " -GITLAB project-file create --project-id $PROJECT_ID \ +GITLAB project-file create --project-id "$PROJECT_ID" \ --file-path README --branch-name master --content "CONTENT" \ --commit-message "Initial commit" >/dev/null 2>&1 OK echo -n "Testing issue creation... " -ISSUE_ID=$(GITLAB project-issue create --project-id $PROJECT_ID \ +ISSUE_ID=$(GITLAB project-issue create --project-id "$PROJECT_ID" \ --title "my issue" --description "my issue description" \ | grep ^id: | cut -d' ' -f2) OK echo -n "Testing note creation... " -GITLAB project-issue-note create --project-id $PROJECT_ID \ - --issue-id $ISSUE_ID --body "the body" >/dev/null 2>&1 +GITLAB project-issue-note create --project-id "$PROJECT_ID" \ + --issue-id "$ISSUE_ID" --body "the body" >/dev/null 2>&1 OK echo -n "Testing branch creation... " -GITLAB project-branch create --project-id $PROJECT_ID \ +GITLAB project-branch create --project-id "$PROJECT_ID" \ --branch-name branch1 --ref master >/dev/null 2>&1 OK echo -n "Testing branch deletion... " -GITLAB project-branch delete --project-id $PROJECT_ID \ +GITLAB project-branch delete --project-id "$PROJECT_ID" \ --name branch1 >/dev/null 2>&1 OK echo -n "Testing project deletion... " -GITLAB project delete --id $PROJECT_ID +GITLAB project delete --id "$PROJECT_ID" OK diff --git a/tools/py_functional_tests.sh b/tools/py_functional_tests.sh index 3555144..b6e9597 100755 --- a/tools/py_functional_tests.sh +++ b/tools/py_functional_tests.sh @@ -14,8 +14,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -setenv_script=$(dirname $0)/build_test_env.sh +setenv_script=$(dirname "$0")/build_test_env.sh BUILD_TEST_ENV_AUTO_CLEANUP=true -. $setenv_script "$@" +. "$setenv_script" "$@" -python $(dirname $0)/python_test.py +python "$(dirname "$0")"/python_test.py |
