tests/int/*bats: ignore SC2016

Ignore the shellcheck warnings like this one:

> In tty.bats line 32:
> 	update_config '(.. | select(.[]? == "sh")) += ["-c", "stat -c %u:%g $(tty) | tr : \\\\n"]'
>                     ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.

While at it, fix some minor whitespace issues in tty.bats.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-08-09 14:26:03 -07:00
parent 598d8b73a5
commit f36fb46bdf
4 changed files with 18 additions and 8 deletions

View File

@ -170,6 +170,7 @@ function setup() {
[[ ${lines[0]} == "0::/foo" ]]
# teardown: remove "/foo"
# shellcheck disable=SC2016
runc exec test_cgroups_group sh -uxc 'echo -memory > /sys/fs/cgroup/cgroup.subtree_control; for f in $(cat /sys/fs/cgroup/foo/cgroup.procs); do echo $f > /sys/fs/cgroup/cgroup.procs; done; rmdir /sys/fs/cgroup/foo'
runc exec test_cgroups_group test ! -d /sys/fs/cgroup/foo
[ "$status" -eq 0 ]

View File

@ -27,6 +27,7 @@ function teardown() {
function setup_pipes() {
# The changes to 'terminal' are needed for running in detached mode
# shellcheck disable=SC2016
update_config ' (.. | select(.terminal? != null)) .terminal |= false
| (.. | select(.[]? == "sh")) += ["-c", "for i in `seq 10`; do read xxx || continue; echo ponG $xxx; done"]'

View File

@ -131,6 +131,7 @@ function teardown() {
(__runc events test_busybox > events.log) &
(
retry 10 1 eval "grep -q 'test_busybox' events.log"
# shellcheck disable=SC2016
__runc exec -d test_busybox sh -c 'test=$(dd if=/dev/urandom ibs=5120k)'
retry 10 1 eval "grep -q 'oom' events.log"
__runc delete -f test_busybox

View File

@ -13,6 +13,7 @@ function teardown() {
@test "runc run [tty ptsname]" {
# Replace sh script with readlink.
# shellcheck disable=SC2016
update_config '(.. | select(.[]? == "sh")) += ["-c", "for file in /proc/self/fd/[012]; do readlink $file; done"]'
# run busybox
@ -29,6 +30,7 @@ function teardown() {
[[ "$ROOTLESS" -ne 0 ]] && requires rootless_idmap
# Replace sh script with stat.
# shellcheck disable=SC2016
update_config '(.. | select(.[]? == "sh")) += ["-c", "stat -c %u:%g $(tty) | tr : \\\\n"]'
# run busybox
@ -46,6 +48,7 @@ function teardown() {
# replace "uid": 0 with "uid": 1000
# and do a similar thing for gid.
# Replace sh script with stat.
# shellcheck disable=SC2016
update_config ' (.. | select(.uid? == 0)) .uid |= 1000
| (.. | select(.gid? == 0)) .gid |= 100
| (.. | select(.[]? == "sh")) += ["-c", "stat -c %u:%g $(tty) | tr : \\\\n"]'
@ -67,7 +70,8 @@ function teardown() {
testcontainer test_busybox running
# run the exec
runc exec -t test_busybox sh -c 'for file in /proc/self/fd/[012]; do readlink $file; done'
# shellcheck disable=SC2016
runc exec -t test_busybox sh -c 'for file in /proc/self/fd/[012]; do readlink $file; done'
[ "$status" -eq 0 ]
[[ ${lines[0]} =~ /dev/pts/+ ]]
[[ ${lines[1]} =~ /dev/pts/+ ]]
@ -87,7 +91,8 @@ function teardown() {
testcontainer test_busybox running
# run the exec
runc exec -t test_busybox sh -c 'stat -c %u:%g $(tty) | tr : \\n'
# shellcheck disable=SC2016
runc exec -t test_busybox sh -c 'stat -c %u:%g $(tty) | tr : \\n'
[ "$status" -eq 0 ]
[[ ${lines[0]} =~ 0 ]]
[[ ${lines[1]} =~ 5 ]]
@ -99,8 +104,9 @@ function teardown() {
# replace "uid": 0 with "uid": 1000
# and do a similar thing for gid.
# shellcheck disable=SC2016
update_config ' (.. | select(.uid? == 0)) .uid |= 1000
| (.. | select(.gid? == 0)) .gid |= 100'
| (.. | select(.gid? == 0)) .gid |= 100'
# run busybox detached
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
@ -110,6 +116,7 @@ function teardown() {
testcontainer test_busybox running
# run the exec
# shellcheck disable=SC2016
runc exec -t test_busybox sh -c 'stat -c %u:%g $(tty) | tr : \\n'
[ "$status" -eq 0 ]
[[ ${lines[0]} =~ 1000 ]]