mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-07 08:21:01 +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)
|
bundle=$(pwd)
|
||||||
|
|
||||||
# To mount $HOOKLIBCR we need to do that in the container namespace
|
# To mount $HOOKLIBCR we need to do that in the container namespace
|
||||||
create_runtime_hook=$(
|
create_runtime_hook="pid=\$(cat - | jq -r '.pid'); touch "$LIBPATH/$HOOKLIBCR.1.0.0" && \
|
||||||
cat <<-EOF
|
nsenter -m \$ns -t \$pid mount --bind "$bundle/$HOOKLIBCR.1.0.0" "$LIBPATH/$HOOKLIBCR.1.0.0""
|
||||||
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_container_hook="touch ./lib/$HOOKLIBCC.1.0.0 && mount --bind $bundle/$HOOKLIBCC.1.0.0 ./lib/$HOOKLIBCC.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
|
# make sure we're running
|
||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
|
|
||||||
tty_info_with_consize_size=$(
|
tty_info_with_consize_size='
|
||||||
cat <<EOF
|
|
||||||
{
|
{
|
||||||
"terminal": true,
|
"terminal": true,
|
||||||
"consoleSize": {
|
"consoleSize": {
|
||||||
@@ -167,9 +166,7 @@ function teardown() {
|
|||||||
"/bin/stty -a > /tmp/tty-info"
|
"/bin/stty -a > /tmp/tty-info"
|
||||||
],
|
],
|
||||||
"cwd": "/"
|
"cwd": "/"
|
||||||
}
|
}'
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
# Run the detached exec.
|
# 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
|
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 for the exec to finish.
|
||||||
wait_pids_gone 100 0.5 "$(cat pid.txt)"
|
wait_pids_gone 100 0.5 "$(cat pid.txt)"
|
||||||
|
|
||||||
tty_info=$(
|
tty_info='
|
||||||
cat <<EOF
|
|
||||||
{
|
{
|
||||||
"args": [
|
"args": [
|
||||||
"/bin/cat",
|
"/bin/cat",
|
||||||
"/tmp/tty-info"
|
"/tmp/tty-info"
|
||||||
],
|
],
|
||||||
"cwd": "/"
|
"cwd": "/"
|
||||||
}
|
}'
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
# run the exec
|
# run the exec
|
||||||
runc exec -t -p <(echo "$tty_info") test_busybox
|
runc exec -t -p <(echo "$tty_info") test_busybox
|
||||||
|
Reference in New Issue
Block a user