Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
17d9d072
Unverified
Commit
17d9d072
authored
Feb 08, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: add logging to lxc-test-unpriv
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
7369e6bf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
lxc-test-unpriv
src/tests/lxc-test-unpriv
+23
-20
No files found.
src/tests/lxc-test-unpriv
View file @
17d9d072
...
@@ -66,11 +66,12 @@ which newuidmap >/dev/null 2>&1 || { echo "'newuidmap' command is missing" >&2;
...
@@ -66,11 +66,12 @@ which newuidmap >/dev/null 2>&1 || { echo "'newuidmap' command is missing" >&2;
DONE
=
0
DONE
=
0
KNOWN_RELEASES
=
"precise trusty xenial yakkety zesty"
KNOWN_RELEASES
=
"precise trusty xenial yakkety zesty"
UNPRIV_LOG
=
$(
mktemp
--dry-run
)
cleanup
()
{
cleanup
()
{
cd
/
cd
/
run_cmd lxc-stop
-n
c2
-k
||
true
run_cmd lxc-stop
-n
c2
-k
-l
trace
-o
"
${
UNPRIV_LOG
}
"
||
true
run_cmd lxc-stop
-n
c1
-k
||
true
run_cmd lxc-stop
-n
c1
-k
-l
trace
-o
"
${
UNPRIV_LOG
}
"
||
true
pkill
-u
$(
id
-u
$TUSER
)
-9
||
true
pkill
-u
$(
id
-u
$TUSER
)
-9
||
true
sed
-i
'/lxcunpriv/d'
/run/lxc/nics /etc/lxc/lxc-usernet
sed
-i
'/lxcunpriv/d'
/run/lxc/nics /etc/lxc/lxc-usernet
...
@@ -81,6 +82,8 @@ cleanup() {
...
@@ -81,6 +82,8 @@ cleanup() {
deluser
$TUSER
deluser
$TUSER
if
[
$DONE
-eq
0
]
;
then
if
[
$DONE
-eq
0
]
;
then
cat
"
${
UNPRIV_LOG
}
"
rm
-f
"
${
UNPRIV_LOG
}
"
||
true
echo
"FAIL"
echo
"FAIL"
exit
1
exit
1
fi
fi
...
@@ -173,45 +176,45 @@ run_cmd mkdir -p $HDIR/.cache/lxc
...
@@ -173,45 +176,45 @@ run_cmd mkdir -p $HDIR/.cache/lxc
cp
-R
/var/cache/lxc/download
$HDIR
/.cache/lxc
&&
\
cp
-R
/var/cache/lxc/download
$HDIR
/.cache/lxc
&&
\
chown
-R
$TUSER
:
$HDIR
/.cache/lxc
chown
-R
$TUSER
:
$HDIR
/.cache/lxc
run_cmd lxc-create
-t
download
-n
c1
--
-d
ubuntu
-r
$release
-a
$ARCH
run_cmd lxc-create
-t
download
-n
c1
-
l
trace
-o
"
${
UNPRIV_LOG
}
"
-
-
-d
ubuntu
-r
$release
-a
$ARCH
# Make sure we can start it - twice
# Make sure we can start it - twice
for
count
in
`
seq
1 2
`
;
do
for
count
in
`
seq
1 2
`
;
do
run_cmd lxc-start
-n
c1
-d
run_cmd lxc-start
-n
c1
-d
-l
trace
-o
"
${
UNPRIV_LOG
}
"
p1
=
$(
run_cmd lxc-info
-n
c1
-p
-H
)
p1
=
$(
run_cmd lxc-info
-n
c1
-p
-H
-l
trace
-o
"
${
UNPRIV_LOG
}
"
)
[
"
$p1
"
!=
"-1"
]
||
{
echo
"Failed to start container c1 (run
$count
)"
;
false
;
}
[
"
$p1
"
!=
"-1"
]
||
{
echo
"Failed to start container c1 (run
$count
)"
;
false
;
}
run_cmd lxc-info
-n
c1
run_cmd lxc-info
-n
c1
-l
trace
-o
"
${
UNPRIV_LOG
}
"
run_cmd lxc-attach
-n
c1
--
/bin/true
run_cmd lxc-attach
-n
c1
-
l
trace
-o
"
${
UNPRIV_LOG
}
"
-
-
/bin/true
run_cmd lxc-stop
-n
c1
-k
run_cmd lxc-stop
-n
c1
-k
-l
trace
-o
"
${
UNPRIV_LOG
}
"
done
done
run_cmd lxc-copy
-s
-n
c1
-N
c2
run_cmd lxc-copy
-s
-n
c1
-N
c2
-l
trace
-o
"
${
UNPRIV_LOG
}
"
run_cmd lxc-start
-n
c2
-d
run_cmd lxc-start
-n
c2
-d
-l
trace
-o
"
${
UNPRIV_LOG
}
"
p1
=
$(
run_cmd lxc-info
-n
c2
-p
-H
)
p1
=
$(
run_cmd lxc-info
-n
c2
-p
-H
-l
trace
-o
"
${
UNPRIV_LOG
}
"
)
[
"
$p1
"
!=
"-1"
]
||
{
echo
"Failed to start container c2"
;
false
;
}
[
"
$p1
"
!=
"-1"
]
||
{
echo
"Failed to start container c2"
;
false
;
}
run_cmd lxc-stop
-n
c2
-k
run_cmd lxc-stop
-n
c2
-k
-l
trace
-o
"
${
UNPRIV_LOG
}
"
if
which cgm
>
/dev/null 2>&1
;
then
if
which cgm
>
/dev/null 2>&1
;
then
echo
"Testing containers under different cgroups per subsystem"
echo
"Testing containers under different cgroups per subsystem"
run_cmd cgm create freezer x1/x2
run_cmd cgm create freezer x1/x2
cgm movepid freezer x1
$$
cgm movepid freezer x1
$$
run_cmd lxc-start
-n
c1
-d
run_cmd lxc-start
-n
c1
-d
-l
trace
-o
"
${
UNPRIV_LOG
}
"
p1
=
$(
run_cmd lxc-info
-n
c1
-p
-H
)
p1
=
$(
run_cmd lxc-info
-n
c1
-p
-H
-l
trace
-o
"
${
UNPRIV_LOG
}
"
)
[
"
$p1
"
!=
"-1"
]
||
{
echo
"Failed to start container c1"
;
false
;
}
[
"
$p1
"
!=
"-1"
]
||
{
echo
"Failed to start container c1"
;
false
;
}
run_cmd lxc-info
-n
c1
run_cmd lxc-info
-n
c1
-l
trace
-o
"
${
UNPRIV_LOG
}
"
run_cmd lxc-attach
-n
c1
--
/bin/true
run_cmd lxc-attach
-n
c1
-
l
trace
-o
"
${
UNPRIV_LOG
}
"
-
-
/bin/true
run_cmd lxc-cgroup
-n
c1 freezer.state
run_cmd lxc-cgroup
-n
c1 freezer.state
-l
trace
-o
"
${
UNPRIV_LOG
}
"
echo
"Testing lxc-attach and lxc-cgroup from different cgroup"
echo
"Testing lxc-attach and lxc-cgroup from different cgroup"
cgm movepid freezer x2
$$
cgm movepid freezer x2
$$
run_cmd lxc-attach
-n
c1
--
/bin/true
run_cmd lxc-attach
-n
c1
-
l
trace
-o
"
${
UNPRIV_LOG
}
"
-
-
/bin/true
run_cmd lxc-cgroup
-n
c1 freezer.state
run_cmd lxc-cgroup
-n
c1
-l
trace
-o
"
${
UNPRIV_LOG
}
"
freezer.state
run_cmd lxc-cgroup
-n
c1 memory.limit_in_bytes
run_cmd lxc-cgroup
-n
c1
-l
trace
-o
"
${
UNPRIV_LOG
}
"
memory.limit_in_bytes
fi
fi
DONE
=
1
DONE
=
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment