mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-26 19:41:35 +08:00
tests/int: simplify assignments
Assigning a multi-line value to a bash variable should not be so complex. While at it, slightly reformat create_runtime_hook. No functional change. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -30,13 +30,8 @@ function teardown() {
|
||||
bundle=$(pwd)
|
||||
|
||||
# To mount $HOOKLIBCR we need to do that in the container namespace
|
||||
create_runtime_hook=$(
|
||||
cat <<-EOF
|
||||
pid=\$(cat - | jq -r '.pid')
|
||||
touch "$LIBPATH/$HOOKLIBCR.1.0.0"
|
||||
nsenter -m \$ns -t \$pid mount --bind "$bundle/$HOOKLIBCR.1.0.0" "$LIBPATH/$HOOKLIBCR.1.0.0"
|
||||
EOF
|
||||
)
|
||||
create_runtime_hook="pid=\$(cat - | jq -r '.pid'); touch "$LIBPATH/$HOOKLIBCR.1.0.0" && \
|
||||
nsenter -m \$ns -t \$pid mount --bind "$bundle/$HOOKLIBCR.1.0.0" "$LIBPATH/$HOOKLIBCR.1.0.0""
|
||||
|
||||
create_container_hook="touch ./lib/$HOOKLIBCC.1.0.0 && mount --bind $bundle/$HOOKLIBCC.1.0.0 ./lib/$HOOKLIBCC.1.0.0"
|
||||
|
||||
|
@@ -153,8 +153,7 @@ function teardown() {
|
||||
# make sure we're running
|
||||
testcontainer test_busybox running
|
||||
|
||||
tty_info_with_consize_size=$(
|
||||
cat <<EOF
|
||||
tty_info_with_consize_size='
|
||||
{
|
||||
"terminal": true,
|
||||
"consoleSize": {
|
||||
@@ -167,9 +166,7 @@ function teardown() {
|
||||
"/bin/stty -a > /tmp/tty-info"
|
||||
],
|
||||
"cwd": "/"
|
||||
}
|
||||
EOF
|
||||
)
|
||||
}'
|
||||
|
||||
# Run the detached exec.
|
||||
runc exec -t --pid-file pid.txt -d --console-socket "$CONSOLE_SOCKET" -p <(echo "$tty_info_with_consize_size") test_busybox
|
||||
@@ -179,17 +176,14 @@ EOF
|
||||
# Wait for the exec to finish.
|
||||
wait_pids_gone 100 0.5 "$(cat pid.txt)"
|
||||
|
||||
tty_info=$(
|
||||
cat <<EOF
|
||||
tty_info='
|
||||
{
|
||||
"args": [
|
||||
"/bin/cat",
|
||||
"/tmp/tty-info"
|
||||
],
|
||||
"cwd": "/"
|
||||
}
|
||||
EOF
|
||||
)
|
||||
}'
|
||||
|
||||
# run the exec
|
||||
runc exec -t -p <(echo "$tty_info") test_busybox
|
||||
|
Reference in New Issue
Block a user