Skip to content

Commit 57f1ad5

Browse files
committed
convert scripts to POSIX shell by eliminating bashisms
1 parent 09ef253 commit 57f1ad5

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

tools/build_test_env.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22
# Copyright (C) 2016 Gauvain Pocentek <gauvain@pocentek.net>
33
#
44
# This program is free software: you can redistribute it and/or modify
@@ -71,7 +71,7 @@ CONFIG=/tmp/python-gitlab.cfg
7171
GITLAB() { gitlab --config-file "$CONFIG" "$@"; }
7272
GREEN='\033[0;32m'
7373
NC='\033[0m'
74-
OK() { echo -e "${GREEN}OK${NC}"; }
74+
OK() { printf "${GREEN}OK${NC}\\n"; }
7575

7676
log "Waiting for gitlab to come online... "
7777
I=0
@@ -81,7 +81,7 @@ while :; do
8181
sleep 4
8282
curl -s http://localhost:8080/users/sign_in 2>/dev/null \
8383
| grep -q "GitLab Community Edition" && break
84-
let I=I+5
84+
I=$((I+5))
8585
[ "$I" -eq 120 ] && exit 1
8686
done
8787
sleep 5

tools/functional_tests.sh

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22
# Copyright (C) 2015 Gauvain Pocentek <gauvain@pocentek.net>
33
#
44
# This program is free software: you can redistribute it and/or modify
@@ -20,61 +20,61 @@ BUILD_TEST_ENV_AUTO_CLEANUP=true
2020

2121
set -e
2222

23-
echo -n "Testing project creation... "
23+
printf %s "Testing project creation... "
2424
PROJECT_ID=$(GITLAB project create --name test-project1 \
2525
| grep ^id: | cut -d' ' -f2)
2626
GITLAB project list | grep -q test-project1
2727
OK
2828

29-
echo -n "Testing project update... "
29+
printf %s "Testing project update... "
3030
GITLAB project update --id "$PROJECT_ID" --description "My New Description"
3131
OK
3232

33-
echo -n "Testing user creation... "
33+
printf %s "Testing user creation... "
3434
USER_ID=$(GITLAB user create --email fake@email.com --username user1 \
3535
--name "User One" --password fakepassword | grep ^id: | cut -d' ' -f2)
3636
OK
3737

38-
echo -n "Testing verbose output... "
38+
printf %s "Testing verbose output... "
3939
GITLAB -v user list | grep -q avatar-url
4040
OK
4141

42-
echo -n "Testing CLI args not in output... "
42+
printf %s "Testing CLI args not in output... "
4343
GITLAB -v user list | grep -qv config-file
4444
OK
4545

46-
echo -n "Testing adding member to a project... "
46+
printf %s "Testing adding member to a project... "
4747
GITLAB project-member create --project-id "$PROJECT_ID" \
4848
--user-id "$USER_ID" --access-level 40 >/dev/null 2>&1
4949
OK
5050

51-
echo -n "Testing file creation... "
51+
printf %s "Testing file creation... "
5252
GITLAB project-file create --project-id "$PROJECT_ID" \
5353
--file-path README --branch-name master --content "CONTENT" \
5454
--commit-message "Initial commit" >/dev/null 2>&1
5555
OK
5656

57-
echo -n "Testing issue creation... "
57+
printf %s "Testing issue creation... "
5858
ISSUE_ID=$(GITLAB project-issue create --project-id "$PROJECT_ID" \
5959
--title "my issue" --description "my issue description" \
6060
| grep ^id: | cut -d' ' -f2)
6161
OK
6262

63-
echo -n "Testing note creation... "
63+
printf %s "Testing note creation... "
6464
GITLAB project-issue-note create --project-id "$PROJECT_ID" \
6565
--issue-id "$ISSUE_ID" --body "the body" >/dev/null 2>&1
6666
OK
6767

68-
echo -n "Testing branch creation... "
68+
printf %s "Testing branch creation... "
6969
GITLAB project-branch create --project-id "$PROJECT_ID" \
7070
--branch-name branch1 --ref master >/dev/null 2>&1
7171
OK
7272

73-
echo -n "Testing branch deletion... "
73+
printf %s "Testing branch deletion... "
7474
GITLAB project-branch delete --project-id "$PROJECT_ID" \
7575
--name branch1 >/dev/null 2>&1
7676
OK
7777

78-
echo -n "Testing project deletion... "
78+
printf %s "Testing project deletion... "
7979
GITLAB project delete --id "$PROJECT_ID"
8080
OK

tools/py_functional_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22
# Copyright (C) 2015 Gauvain Pocentek <gauvain@pocentek.net>
33
#
44
# This program is free software: you can redistribute it and/or modify

0 commit comments

Comments
 (0)